From d9306b60cf7922665ff85ec91b0bb9b87ee8ab65 Mon Sep 17 00:00:00 2001 From: harish-viswa Date: Mon, 10 Feb 2025 21:38:09 +0530 Subject: [PATCH] docs: added docs for ui components --- .../docs/components/branch-chooser.mdx | 92 +++++ .../docs/components/commit-copy-action.mdx | 59 ++++ .../content/docs/components/dropdown-menu.mdx | 334 ++++++++++++++++++ .../components/file-additions-trigger.mdx | 69 ++++ .../content/docs/components/file-explorer.mdx | 167 +++++++++ .../docs/components/file-toolbar-actions.mdx | 67 ++++ .../docs/components/image-carousel.mdx | 80 +++++ .../src/content/docs/components/input-otp.mdx | 197 +++++++++++ .../content/docs/components/label-marker.mdx | 84 +++++ .../content/docs/components/list-actions.mdx | 168 +++++++++ .../src/content/docs/components/meter.mdx | 72 ++++ .../docs/components/more-actions-tooltip.mdx | 91 +++++ .../content/docs/components/pagination.mdx | 258 ++++++++++++++ .../src/content/docs/components/progress.mdx | 58 +++ .../src/content/docs/components/radio.mdx | 168 +++++++++ .../src/content/docs/components/separator.mdx | 83 +++++ .../src/content/docs/components/switch.mdx | 75 ++++ .../src/content/docs/components/tabnav.mdx | 74 ++-- .../src/content/docs/components/toggle.mdx | 56 +++ packages/ui/src/components/index.ts | 1 + 20 files changed, 2220 insertions(+), 33 deletions(-) create mode 100644 apps/portal/src/content/docs/components/branch-chooser.mdx create mode 100644 apps/portal/src/content/docs/components/commit-copy-action.mdx create mode 100644 apps/portal/src/content/docs/components/dropdown-menu.mdx create mode 100644 apps/portal/src/content/docs/components/file-additions-trigger.mdx create mode 100644 apps/portal/src/content/docs/components/file-explorer.mdx create mode 100644 apps/portal/src/content/docs/components/file-toolbar-actions.mdx create mode 100644 apps/portal/src/content/docs/components/image-carousel.mdx create mode 100644 apps/portal/src/content/docs/components/input-otp.mdx create mode 100644 apps/portal/src/content/docs/components/label-marker.mdx create mode 100644 apps/portal/src/content/docs/components/list-actions.mdx create mode 100644 apps/portal/src/content/docs/components/meter.mdx create mode 100644 apps/portal/src/content/docs/components/more-actions-tooltip.mdx create mode 100644 apps/portal/src/content/docs/components/pagination.mdx create mode 100644 apps/portal/src/content/docs/components/progress.mdx create mode 100644 apps/portal/src/content/docs/components/radio.mdx create mode 100644 apps/portal/src/content/docs/components/separator.mdx create mode 100644 apps/portal/src/content/docs/components/switch.mdx create mode 100644 apps/portal/src/content/docs/components/toggle.mdx diff --git a/apps/portal/src/content/docs/components/branch-chooser.mdx b/apps/portal/src/content/docs/components/branch-chooser.mdx new file mode 100644 index 0000000000..3d2c8f5fd3 --- /dev/null +++ b/apps/portal/src/content/docs/components/branch-chooser.mdx @@ -0,0 +1,92 @@ +--- +title: Branch Chooser +description: Branch Chooser component documentation +--- + +The Branch Chooser component provides a UI element for selecting a branch from a list of branches. It includes a dropdown menu for branch selection. + +import { DocsPage } from "@/components/docs-page"; + + console.log('Selected branch:', branch)} +/>`} +/> + +## Usage + +```typescript jsx +import { BranchSelector } from '@harnessio/ui/components' + +return ( + console.log('Selected branch:', branch)} + /> +) +``` + +## Anatomy + +The Branch Chooser component can be used to select a branch from a list of branches with a dropdown menu. + +```typescript jsx + console.log('Selected branch:', branch)} +/> +``` + +## API Reference + +### BranchSelector + +The `BranchSelector` component serves as the main container for the branch chooser element. + + void", + }, + { + name: "prefix", + description: "Optional prefix to display before the branch name", + required: false, + value: "string", + }, + ]} +/> diff --git a/apps/portal/src/content/docs/components/commit-copy-action.mdx b/apps/portal/src/content/docs/components/commit-copy-action.mdx new file mode 100644 index 0000000000..dd2876289c --- /dev/null +++ b/apps/portal/src/content/docs/components/commit-copy-action.mdx @@ -0,0 +1,59 @@ +--- +title: Commit Copy Action +description: Commit Copy Action component documentation +--- + +The Commit Copy Action component provides a UI element for displaying a commit SHA and copying it to the clipboard. It also allows navigation to the commit details page. + +import { DocsPage } from "@/components/docs-page"; + + + \`/commit/\${sha}\`} /> + `} +/> + +## Usage + +```typescript jsx +import { CommitCopyActions } from '@harnessio/ui/components' + +return ( +
+ \`/commit/\${sha}\`} /> +
+) +``` + +## Anatomy + +The Commit Copy Action component can be used to display a commit SHA and provide copy and navigation functionalities. + +```typescript jsx +
+ \`/commit/\${sha}\`} /> +
+``` + +## API Reference + +### CommitCopyActions + +The `CommitCopyActions` component serves as the main container for displaying the commit SHA and providing copy and navigation functionalities. + + diff --git a/apps/portal/src/content/docs/components/dropdown-menu.mdx b/apps/portal/src/content/docs/components/dropdown-menu.mdx new file mode 100644 index 0000000000..e4aa839186 --- /dev/null +++ b/apps/portal/src/content/docs/components/dropdown-menu.mdx @@ -0,0 +1,334 @@ +--- +title: Dropdown Menu +description: A vertically stacked menu that appears when triggered by a button. +--- + +The Dropdown Menu component provides a flexible menu interface that appears when triggered by a button. It's built on top of Radix UI's dropdown menu primitive and includes various subcomponents for creating rich menu structures. + +import { DocsPage } from "@/components/docs-page"; + + + + + + + New File + Open + + + + More Options + + + Save As... + Export + + + + + Show Line Numbers + + + Word Wrap + + + + + VS Code Theme + + + Atom Theme + + + Sublime Theme + + + +`} +/> + +## Usage + +```typescript jsx +import { DropdownMenu } from '@harnessio/ui/components' + +return ( + + + + + + New File + Open + + + + More Options + + + + Save As... + Export + + + + + Show Line Numbers + + + Word Wrap + + + + + VS Code Theme + + + Atom Theme + + + Sublime Theme + + + + +) +``` + +## Anatomy + +The Dropdown Menu is composed of several subcomponents that can be imported and used as needed: + +```typescript jsx + + + + + + + + + + + + + + + + + + +``` + +## API Reference + +### Root + +The main container for the dropdown menu. + + void", + }, + { + name: "modal", + description: "The modality of the dropdown menu", + required: false, + value: "boolean", + }, + ]} +/> + +### Trigger + +The button that triggers the dropdown menu. + + + +### Content + +The content container for the dropdown menu items. + + + +### Item + +An individual menu item. + + void", + }, + ]} +/> + +### CheckboxItem + +A menu item that can be checked/unchecked. + + void", + }, + { + name: "disabled", + description: + "When true, prevents the user from interacting with the item", + required: false, + value: "boolean", + }, + ]} +/> + +### RadioGroup + +A group of radio items where only one can be checked. + + void", + }, + ]} +/> + +### RadioItem + +A menu item that can be selected as part of a radio group. + + diff --git a/apps/portal/src/content/docs/components/file-additions-trigger.mdx b/apps/portal/src/content/docs/components/file-additions-trigger.mdx new file mode 100644 index 0000000000..99d1d99f93 --- /dev/null +++ b/apps/portal/src/content/docs/components/file-additions-trigger.mdx @@ -0,0 +1,69 @@ +--- +title: File Additions Trigger +description: File Additions Trigger component documentation +--- + +The File Additions Trigger component provides a UI element for creating new files or uploading files. It uses a dropdown menu to offer these options. + +import { DocsPage } from "@/components/docs-page"; + + ({ t: (key, fallback) => fallback })} + pathNewFile="/new-file" + pathUploadFiles="/upload-files" +/>`} +/> + +## Usage + +```typescript jsx +import { FileAdditionsTrigger } from '@harnessio/ui/components' + +return ( + ({ t: (key, fallback) => fallback })} + pathNewFile="/new-file" + pathUploadFiles="/upload-files" + /> +) +``` + +## Anatomy + +The File Additions Trigger component can be used to provide options for creating new files or uploading files. + +```typescript jsx + ({ t: (key, fallback) => fallback })} + pathNewFile="/new-file" + pathUploadFiles="/upload-files" +/> +``` + +## API Reference + +### FileAdditionsTrigger + +The `FileAdditionsTrigger` component serves as the main container for the dropdown menu options to create new files or upload files. + + diff --git a/apps/portal/src/content/docs/components/file-explorer.mdx b/apps/portal/src/content/docs/components/file-explorer.mdx new file mode 100644 index 0000000000..9deab620f0 --- /dev/null +++ b/apps/portal/src/content/docs/components/file-explorer.mdx @@ -0,0 +1,167 @@ +--- +title: File Explorer +description: File Explorer component documentation +--- + +The File Explorer component provides a UI element for browsing and selecting files or directories. It displays a hierarchical view of the file system. + +import { DocsPage } from "@/components/docs-page"; + + console.log('Value changed:', value)} +> + + index.tsx + FileExplorer.tsx + type.ts + + } value="src" link="/src"> + src + + + + index.tsx + FileExplorer.tsx + type.ts + + } value="assets" link="/assets"> + assets + + package.json +`} +/> + +## Usage + +```typescript jsx +import { Root, FileItem, FolderItem } from '@harnessio/ui/components/file-explorer' + +return ( + console.log('Value changed:', value)}> + + src + index.tsx + + package.json + +) +``` + +## Anatomy + +The File Explorer component can be used to display a hierarchical view of the file system and handle file or directory selection. + +```typescript jsx + console.log('Value changed:', value)}> + + src + index.tsx + + package.json + +``` + +## API Reference + +### Root + +The `Root` component serves as the main container for displaying the file system hierarchy and handling file or directory selection. + + void", + }, + { + name: "value", + description: "The current value of the selected items", + required: true, + value: "string[]", + }, + ]} +/> + +### FolderItem + +The `FolderItem` component is used to display a folder in the file explorer. + + + +### FileItem + +The `FileItem` component is used to display a file in the file explorer. + + diff --git a/apps/portal/src/content/docs/components/file-toolbar-actions.mdx b/apps/portal/src/content/docs/components/file-toolbar-actions.mdx new file mode 100644 index 0000000000..f6ba245042 --- /dev/null +++ b/apps/portal/src/content/docs/components/file-toolbar-actions.mdx @@ -0,0 +1,67 @@ +--- +title: File Toolbar Actions +description: File Toolbar Actions component documentation +--- + +The File Toolbar Actions component provides a set of actions for file management, including copying, editing, and downloading files. + +import { DocsPage } from "@/components/docs-page"; + + + console.log('Download clicked')} + onEditClick={() => console.log('Edit clicked')} + copyContent="Sample content to copy" + showEdit={true} + /> + `} +/> + +## Usage + +```typescript jsx +import { FileToolbarActions } from '@harnessio/ui/components' + +return ( + console.log('Download clicked')} + onEditClick={() => console.log('Edit clicked')} + copyContent="Sample content to copy" + showEdit={true} + /> +) +``` + +## API Reference + + void", + }, + { + name: "onEditClick", + description: "Handler for the edit button click", + required: true, + value: "() => void", + }, + { + name: "copyContent", + description: "Content to be copied to the clipboard", + required: true, + value: "string", + }, + { + name: "showEdit", + description: "Whether to show the edit button", + required: false, + value: "boolean", + defaultValue: "false", + }, + ]} +/> diff --git a/apps/portal/src/content/docs/components/image-carousel.mdx b/apps/portal/src/content/docs/components/image-carousel.mdx new file mode 100644 index 0000000000..d6f6f25e73 --- /dev/null +++ b/apps/portal/src/content/docs/components/image-carousel.mdx @@ -0,0 +1,80 @@ +--- +title: Image Carousel +description: Image Carousel component documentation +--- + +The Image Carousel component provides a UI element for displaying a series of images in a carousel format. It includes zoom in and zoom out functionalities. + +import { DocsPage } from "@/components/docs-page"; + + { + const [isOpen, setIsOpen] = React.useState(false); + return <> + setIsOpen(value)} + imgEvent={['https://picsum.photos/1240/800', 'https://picsum.photos/seed/picsum/1240/800']} + title="Image Carousel" + initialSlide={1} + /> + + + +}`} +/> + +## Usage + +```typescript jsx +import { ImageCarousel } from '@harnessio/ui/components' + +return ( + console.log('Set isOpen:', value)} + imgEvent={['/path/to/image1.jpg', '/path/to/image2.jpg']} + title="Image Carousel" + initialSlide={0} + /> +) +``` + +## API Reference + + void", + }, + { + name: "imgEvent", + description: "Array of image URLs to display in the carousel", + required: true, + value: "string[]", + }, + { + name: "title", + description: "Title of the carousel", + required: false, + value: "string", + }, + { + name: "initialSlide", + description: "Index of the initial slide to display", + required: false, + value: "number", + defaultValue: "0", + }, + ]} +/> diff --git a/apps/portal/src/content/docs/components/input-otp.mdx b/apps/portal/src/content/docs/components/input-otp.mdx new file mode 100644 index 0000000000..1eb33d289e --- /dev/null +++ b/apps/portal/src/content/docs/components/input-otp.mdx @@ -0,0 +1,197 @@ +--- +title: Input OTP +description: Input OTP component documentation +--- + +The Input OTP component provides a UI element for entering one-time passwords (OTPs). It includes slots for each digit and supports custom separators. + +import { DocsPage } from "@/components/docs-page"; + + + + + + + + + + + + + +`} +/> + +## Usage + +```typescript jsx +import { InputOTP } from '@harnessio/ui/components' + +return ( + + + + + + + + + + + + + +) +``` + +## Anatomy + +The Input OTP component can be used to enter one-time passwords with custom separators. + +```typescript jsx + + + + + + + + + + + +``` + +## API Reference + +### InputOTP + +The `InputOTP` component serves as the main container for entering one-time passwords. + + unknown", + }, + { + name: "maxLength", + description: "Maximum length of the OTP input", + required: true, + value: "number", + }, + { + name: "textAlign", + description: "Text alignment within the OTP input", + required: false, + value: "'left' | 'center' | 'right'", + }, + { + name: "onComplete", + description: "Handler for when the OTP input is complete", + required: false, + value: "(...args: any[]) => unknown", + }, + { + name: "pushPasswordManagerStrategy", + description: "Strategy for handling password managers", + required: false, + value: "'increase-width' | 'none'", + }, + { + name: "pasteTransformer", + description: "Function to transform pasted content", + required: false, + value: "(pasted: string) => string", + }, + { + name: "noScriptCSSFallback", + description: "Fallback CSS for no-script scenarios", + required: false, + value: "string | null", + }, + ]} +/> + +### InputOTPGroup + +The `InputOTPGroup` component is used to group the OTP slots. + + + +### InputOTPSlot + +The `InputOTPSlot` component is used to display an individual OTP slot. + + + +### InputOTPSeparator + +The `InputOTPSeparator` component is used to display a separator between OTP slots. + + diff --git a/apps/portal/src/content/docs/components/label-marker.mdx b/apps/portal/src/content/docs/components/label-marker.mdx new file mode 100644 index 0000000000..b1b9e60379 --- /dev/null +++ b/apps/portal/src/content/docs/components/label-marker.mdx @@ -0,0 +1,84 @@ +--- +title: Label Marker +description: Label Marker component documentation +--- + +The Label Marker component provides a UI element for displaying labels with optional values and color coding. + +import { DocsPage } from "@/components/docs-page"; + + + + + + + +`} +/> + +## Usage + +```typescript jsx +import { LabelMarker } from '@harnessio/ui/components' + +return ( +
+ + + + + +
+) +``` + +## Anatomy + +The Label Marker component can be used to display labels with optional values and color coding. + +```typescript jsx + +``` + +## API Reference + +### LabelMarker + +The `LabelMarker` component serves as the main container for displaying labels with optional values and color coding. + + diff --git a/apps/portal/src/content/docs/components/list-actions.mdx b/apps/portal/src/content/docs/components/list-actions.mdx new file mode 100644 index 0000000000..fad55ab026 --- /dev/null +++ b/apps/portal/src/content/docs/components/list-actions.mdx @@ -0,0 +1,168 @@ +--- +title: List Actions +description: List Actions component documentation +--- + +The List Actions component provides a UI element for displaying actions that can be performed on a list of items. It includes dropdown menus for selecting actions. + +import { DocsPage } from "@/components/docs-page"; + + + + console.log('Selected:', value)} + /> + + + + +`} +/> + +## Usage + +```typescript jsx +import { ListActions } from '@harnessio/ui/components' + +return ( + + + console.log('Selected:', value)} + /> + + + + + +) +``` + +## Anatomy + +The List Actions component can be used to display actions that can be performed on a list of items. + +```typescript jsx + + + console.log('Selected:', value)} + /> + + + + + +``` + +## API Reference + +### ListActions + +The `ListActions` component serves as the main container for displaying actions that can be performed on a list of items. + + + +### ListActions.Left + +The `ListActions.Left` component is used to group the actions on the left side. + + + +### ListActions.Right + +The `ListActions.Right` component is used to group the actions on the right side. + + + +### ListActions.Dropdown + +The `ListActions.Dropdown` component is used to display a dropdown menu for selecting actions. + +", + }, + { + name: "onChange", + description: "Handler for when an item is selected", + required: false, + value: "(value: string) => void", + }, + { + name: "selectedValue", + description: "The currently selected value", + required: false, + value: "string | null", + }, + ]} +/> diff --git a/apps/portal/src/content/docs/components/meter.mdx b/apps/portal/src/content/docs/components/meter.mdx new file mode 100644 index 0000000000..fd19fa8dbc --- /dev/null +++ b/apps/portal/src/content/docs/components/meter.mdx @@ -0,0 +1,72 @@ +--- +title: Meter +description: Meter component documentation +--- + +The Meter component provides a UI element for displaying progress or performance metrics. It includes a visual representation of the metric. + +import { DocsPage } from "@/components/docs-page"; + +`} +/> + +## Usage + +```typescript jsx +import { Meter, MeterState } from '@harnessio/ui/components' + +return ( + +) +``` + +## Anatomy + +The Meter component can be used to display progress or performance metrics with a visual representation. + +```typescript jsx + +``` + +## API Reference + +### Meter + +The `Meter` component serves as the main container for displaying progress or performance metrics. + + diff --git a/apps/portal/src/content/docs/components/more-actions-tooltip.mdx b/apps/portal/src/content/docs/components/more-actions-tooltip.mdx new file mode 100644 index 0000000000..dbc6e434bb --- /dev/null +++ b/apps/portal/src/content/docs/components/more-actions-tooltip.mdx @@ -0,0 +1,91 @@ +--- +title: More Actions Tooltip +description: More Actions Tooltip component documentation +--- + +The More Actions Tooltip component provides a UI element for displaying a button that, when clicked, shows a tooltip with a list of actions. + +import { DocsPage } from "@/components/docs-page"; + + console.log('Edit clicked') }, + { title: 'Delete', onClick: () => console.log('Delete clicked'), isDanger: true } + ]} +/>`} +/> + +## Usage + +```typescript jsx +import { MoreActionsTooltip } from '@harnessio/ui/components' + +return ( + console.log('Edit clicked') }, + { title: 'Delete', onClick: () => console.log('Delete clicked'), isDanger: true } + ]} + /> +) +``` + +## API Reference + +### MoreActionsTooltip + +The `MoreActionsTooltip` component serves as the main container for displaying a button that shows a tooltip with a list of actions. + + + +### ActionData + +The `ActionData` type represents an action to display in the tooltip. + + void", + }, + { + name: "isDanger", + description: "Whether the action is a dangerous action", + required: false, + value: "boolean", + }, + ]} +/> diff --git a/apps/portal/src/content/docs/components/pagination.mdx b/apps/portal/src/content/docs/components/pagination.mdx new file mode 100644 index 0000000000..2235c105c6 --- /dev/null +++ b/apps/portal/src/content/docs/components/pagination.mdx @@ -0,0 +1,258 @@ +--- +title: Pagination +description: Pagination component documentation +--- + +The Pagination component provides a UI element for navigating through pages. It includes links for previous, next, and specific pages. + +import { DocsPage } from "@/components/docs-page"; + + + + + "Previous"} disabled={false} /> + + + 1 + + + 2 + + + 3 + + + + + + 10 + + + "Next"} disabled={false} /> + + +`} +/> + +## Usage + +```typescript jsx +import { Pagination, PaginationContent, PaginationItem, PaginationLink, PaginationPrevious, PaginationNext } from '@harnessio/ui/components' + +return ( + + + + key} disabled={false} /> + + + 1 + + + 2 + + + key} disabled={false} /> + + + +) +``` + +## Anatomy + +The Pagination component can be used to navigate through pages with links for previous, next, and specific pages. + +```typescript jsx + + + + key} disabled={false} /> + + + 1 + + + 2 + + + key} disabled={false} /> + + + +``` + +## API Reference + +### Pagination + +The `Pagination` component serves as the main container for pagination elements. + + + +### PaginationContent + +The `PaginationContent` component is used to group pagination items. + + + +### PaginationItem + +The `PaginationItem` component is used to display an individual pagination item. + + + +### PaginationLink + +The `PaginationLink` component is used to display a link for a specific page. + + + +### PaginationPrevious + +The `PaginationPrevious` component is used to display a link for the previous page. + + + +### PaginationNext + +The `PaginationNext` component is used to display a link for the next page. + + + +### PaginationEllipsis + +The `PaginationEllipsis` component is used to display an ellipsis indicating more pages. + + diff --git a/apps/portal/src/content/docs/components/progress.mdx b/apps/portal/src/content/docs/components/progress.mdx new file mode 100644 index 0000000000..c5b59729cb --- /dev/null +++ b/apps/portal/src/content/docs/components/progress.mdx @@ -0,0 +1,58 @@ +--- +title: Progress +description: Progress component documentation +--- + +The Progress component provides a UI element for displaying progress or performance metrics. It includes a visual representation of the metric. + +import { DocsPage } from "@/components/docs-page"; + +`} +/> + +## Usage + +```typescript jsx +import { Progress } from '@harnessio/ui/components' + +return ( + +) +``` + +## API Reference + +### Progress + +The `Progress` component serves as the main container for displaying progress or performance metrics. + + string", + }, + { + name: "className", + description: "Additional class names for the progress", + required: false, + value: "string", + }, + ]} +/> diff --git a/apps/portal/src/content/docs/components/radio.mdx b/apps/portal/src/content/docs/components/radio.mdx new file mode 100644 index 0000000000..520e0f93b6 --- /dev/null +++ b/apps/portal/src/content/docs/components/radio.mdx @@ -0,0 +1,168 @@ +--- +title: Radio +description: Radio component documentation +--- + +The Radio component provides a UI element for selecting a single option from a list of options. It includes a radio button and a label. + +import { DocsPage } from "@/components/docs-page"; + + +
+ + +
+
+ + +
+`} +/> + +## Usage + +```typescript jsx +import { RadioGroup, RadioButton, Label } from '@harnessio/ui/components' + +return ( + +
+ + +
+
+ + +
+
+) +``` + +## Anatomy + +The Radio component can be used to select a single option from a list of options. + +```typescript jsx + +
+ + +
+
+ + +
+
+``` + +## API Reference + +### RadioGroup + +The `RadioGroup` component serves as the main container for radio group items. + + void", + }, + { + name: "className", + description: "Additional class names for the radio group", + required: false, + value: "string", + }, + ]} +/> + +### RadioButton + +The `RadioButton` component is used to display an individual radio button. + + void", + }, + { + name: "className", + description: "Additional class names for the radio button", + required: false, + value: "string", + }, + ]} +/> diff --git a/apps/portal/src/content/docs/components/separator.mdx b/apps/portal/src/content/docs/components/separator.mdx new file mode 100644 index 0000000000..0e40c1b848 --- /dev/null +++ b/apps/portal/src/content/docs/components/separator.mdx @@ -0,0 +1,83 @@ +--- +title: Separator +description: Separator component documentation +--- + +The Separator component provides a UI element for creating a visual separation between content. It supports both horizontal and vertical orientations. + +import { DocsPage } from "@/components/docs-page"; + + +
+

Radix Primitives

+

+ An open-source UI component library. +

+
+ + + +
+
Blog
+ +
Docs
+ +
Source
+
+ `} + +/> + +## Usage + +```typescript jsx +import { Separator } from '@harnessio/ui/components' + +return ( +
+
+

Radix Primitives

+

+ An open-source UI component library. +

+
+ +
+
Blog
+ +
Docs
+ +
Source
+
+
+) +``` + +## API Reference + + diff --git a/apps/portal/src/content/docs/components/switch.mdx b/apps/portal/src/content/docs/components/switch.mdx new file mode 100644 index 0000000000..aa8eaf2273 --- /dev/null +++ b/apps/portal/src/content/docs/components/switch.mdx @@ -0,0 +1,75 @@ +--- +title: Switch +description: Switch component documentation +--- + +The Switch component provides a UI element for toggling between two states. It includes a thumb that moves when the switch is toggled. + +import { DocsPage } from "@/components/docs-page"; + +`} /> + +## Usage + +```typescript jsx +import { Switch } from '@harnessio/ui/components' + +return ( + +) +``` + +## Anatomy + +The Switch component can be used to toggle between two states. + +```typescript jsx + +``` + +## API Reference + +### Switch + +The `Switch` component serves as the main container for the switch element. + + void", + }, + { + name: "className", + description: "Additional class names for the switch", + required: false, + value: "string", + }, + ]} +/> diff --git a/apps/portal/src/content/docs/components/tabnav.mdx b/apps/portal/src/content/docs/components/tabnav.mdx index 717afb9c5b..9bd407aa4b 100644 --- a/apps/portal/src/content/docs/components/tabnav.mdx +++ b/apps/portal/src/content/docs/components/tabnav.mdx @@ -1,9 +1,9 @@ --- title: TabNav -description: TabNav component +description: TabNav component documentation --- -The `TabNav` component is used to create a tabbed navigation interface. It consists of a root container and individual tab items that can be linked to different routes. +The `TabNav` component provides a tabbed navigation interface. It consists of a root container and individual tab items that can be linked to different routes. import { DocsPage } from "@/components/docs-page"; @@ -21,8 +21,6 @@ import { DocsPage } from "@/components/docs-page"; ```typescript jsx import { TabNav } from '@harnessio/ui/components' -//... - return ( Home @@ -34,6 +32,8 @@ return ( ## Anatomy +The TabNav component can be used to create a tabbed navigation interface. + ```typescript jsx Home @@ -44,35 +44,43 @@ return ( ## API Reference -### [`TabNav`](packages/ui/src/components/tabnav.tsx) - -The [`TabNav`](packages/ui/src/components/tabnav.tsx) component provides a tabbed navigation interface. It consists of the following subcomponents: - -### [`TabNav.Root`](packages/ui/src/components/tabnav.tsx) - -The root container for the tab navigation. It wraps the individual tab items. - -```typescript jsx - - {/* TabNav.Item elements as children */} - -``` - -### [`TabNav.Item`](packages/ui/src/components/tabnav.tsx) - -An individual tab item that links to a specific route. It accepts the same props as `NavLink` from `react-router-dom`: +### TabNav.Root -```typescript jsx - - {label} - -``` +The `Root` component serves as the main container for the tab navigation. -### Props + -- `to`: A string representing the route path to link to. -- `label`: A string or ReactNode representing the label to display for the tab. -- `activeClassname`: An optional string for additional class names to apply when the tab is active. +### TabNav.Item + +The `Item` component is used to display an individual tab item. + + diff --git a/apps/portal/src/content/docs/components/toggle.mdx b/apps/portal/src/content/docs/components/toggle.mdx new file mode 100644 index 0000000000..6065454e01 --- /dev/null +++ b/apps/portal/src/content/docs/components/toggle.mdx @@ -0,0 +1,56 @@ +--- +title: Toggle +description: Toggle component documentation +--- + +The Toggle component provides a UI element for toggling between two states. It includes various styles and sizes. + +import { DocsPage } from "@/components/docs-page"; + +Toggle`} +/> + +## Usage + +```typescript jsx +import { Toggle } from '@harnessio/ui/components' + +return ( + Toggle +) +``` + +## API Reference + + diff --git a/packages/ui/src/components/index.ts b/packages/ui/src/components/index.ts index 5910e61efa..71f99f87c4 100644 --- a/packages/ui/src/components/index.ts +++ b/packages/ui/src/components/index.ts @@ -22,6 +22,7 @@ export * from './theme-selector' export * from './theme-selector/types' export * from './theme-selector/utils' export * from './no-data' +export * from './branch-chooser' export * from './tabs' export * from './tabnav' export * from './command'