# Accordion (/docs/components/accordion) Import [#import] ```jsx import {Accordion,AccordionContent,AccordionItem,AccordionTrigger} from "@sparrowengg/twigs-react"; ``` Usage [#usage] ```jsx const AccordionExample = () => { return ( Page settings Configure your page settings including layout, theme, and display options. Profile Information Manage your profile details, avatar, and personal preferences. ); }; ``` Examples [#examples] Dynamic Selection [#dynamic-selection] Allow the change of the Selection type dynamically as single or multiple using the `type` prop. Value Variants [#value-variants] Individual accordion items can be set disabled and also as a default value Props [#props] Accordion [#accordion] void", description: "Event handler called when the expanded state changes.", }, collapsible: { type: "boolean", description: "When type is single, allows closing content when clicking trigger for opened item.", default: "false", }, disabled: { type: "boolean", description: "When true, prevents the user from interacting with the accordion.", default: "false", }, dir: { type: " 'ltr' | 'rtl' ", description: "The reading direction of the accordion when applicable. If omitted, assumes LTR (left-to-right) reading mode.", default: "ltr", }, css: { type: "object", description: "Custom CSS styles for the component", }, }} /> AccordionItem [#accordionitem] Data Attributes [#data-attributes] These props are used for the conditional rendering of the components **Applicable** \- Accordion **Applicable** \- AccordionItem/ AccordionContent/ AccordionTrigger # AlertDialog (/docs/components/alert-dialog) Import [#import] ```jsx import {AlertDialog,AlertDialogAction,AlertDialogActions,AlertDialogCancel,AlertDialogContent,AlertDialogDescription,AlertDialogTitle,AlertDialogTrigger,Button} from "@sparrowengg/twigs-react"; ``` Usage [#usage] ```jsx const AlertDialogExample = () => { return ( Are you absolutely sure? This action cannot be undone. This will permanently delete your account and remove your data from our servers. ); }; ``` Props [#props] AlertDialog [#alertdialog] Data Attributes [#data-attributes] These props are used for the conditional rendering of the components # Alert (/docs/components/alert) Import [#import] ```jsx import { Alert, AlertDescription } from "@sparrowengg/twigs-react"; ``` Usage [#usage] ```jsx Password should have a minimum length of 6. ``` Examples [#examples] Different status with variable sizes [#different-status-with-variable-sizes] Props [#props] Alert [#alert] # Avatar (/docs/components/avatar) Import [#import] ```jsx import { Avatar } from "@sparrowengg/twigs-react"; ``` Usage [#usage] ```jsx ``` Examples [#examples] Avatar group with different variants [#avatar-group-with-different-variants] By default, the overflow label is shown as `+N` based on the extra avatar count. Once the count exceeds 99, it is capped at `+99`. If you need a different format or cap behavior, use `limitExceededFormatter` to customize it. Props [#props] Avatar [#avatar] Avatar Group [#avatar-group] React.ReactNode", description: "Provides a custom formatter for the overflow label using the extra avatar count.", }, }} /> # Box (/docs/components/box) Import [#import] ```jsx import { Box } from "@sparrowengg/twigs-react"; ``` Usage [#usage] ```jsx The quick brown fox jumps over the lazy dog. ``` Examples [#examples] Box with styling options [#box-with-styling-options] Props [#props] Box [#box] # Button (/docs/components/button) Import [#import] ```jsx import { Button } from "@sparrowengg/twigs-react"; ``` Usage [#usage] ```jsx ``` Examples [#examples] Button variants and with icons [#button-variants-and-with-icons] Button states [#button-states] Props [#props] Button [#button] # CalendarRange (/docs/components/calendar-range) Prerequisite [#prerequisite] `CalendarRange` component requires additional dependency of `@internationalized/date` to be installed. We will be working on removing this additional dependency in the future. ```bash npm install --save @internationalized/date ``` Import [#import] ```jsx import { CalendarRange } from "@sparrowengg/twigs-react"; import { parseDate } from "@internationalized/date"; ``` Usage [#usage] ```jsx function App() { const [value, setValue] = React.useState({ start: parseDate("2025-08-04"), end: parseDate("2025-08-15"), }); return ( setValue(value as { start: CalendarDate; end: CalendarDate })} value={value} minValue={parseDate("2025-08-03")} /> ); } ``` Examples [#examples] Compact calendar range and footer variants [#compact-calendar-range-and-footer-variants] Props [#props] CalendarRange [#calendarrange] void", description: "Callback function when date range is selected", }, minValue: { type: "DateValue", description: "Minimum selectable date value. Dates beyond this value will be disabled", }, maxValue: { type: "DateValue", description: "Maximum selectable date value. Dates beyond this value will be disabled", }, isDisabled: { type: "boolean", description: "Disable the calendar component", default: "false", }, isDateUnavailable: { type: "(date: DateValue) => boolean", description: "Function to determine if a date is unavailable for selection", }, size: { type: "'sm' | 'md' | 'lg'", description: "Size of the calendar component", default: "lg", }, compact: { type: "boolean", description: "Display calendar in a compact single-month view", default: "false", }, showFooter: { type: "boolean", description: "Show footer with action button", default: "true", }, footerActionText: { type: "string", description: "Text to be displayed on footer button", default: "'Apply'", }, footerAction: { type: "(state: RangeCalendarState) => void", description: "Action to be performed on footer button click", }, renderFooter: { type: "(state: RangeCalendarState) => ReactNode", description: "Custom footer component", }, onDaySelect: { type: "(date: DateValue, range: 'start' | 'end') => void", description: "Callback function when day is selected", }, onMonthSelect: { type: "(date: DateValue, range: 'start' | 'end') => void", description: "Callback function when month is selected", }, onYearSelect: { type: "(date: DateValue, range: 'start' | 'end') => void", description: "Callback function when year is selected", }, showTimePicker: { type: "boolean", description: "Show time picker for date and time selection", default: "false", }, showTimezonePicker: { type: "boolean", description: "Show timezone picker for timezone-aware selection", default: "false", }, containerCSS: { type: "CSS Object", description: "Custom CSS for the container element", }, }} /> # Calendar (/docs/components/calendar) Prerequisite [#prerequisite] `Calendar` component requires additional dependency of `@internationalized/date` to be installed. We will be working on removing this additional dependency in the future. ```bash npm install --save @internationalized/date ``` Import [#import] ```jsx import { Calendar } from "@sparrowengg/twigs-react"; import { parseDate } from "@internationalized/date"; ``` Usage [#usage] ```jsx function App() { const [value, setValue] = React.useState(parseDate("2025-08-24")); return ( ); } ``` Examples [#examples] Calendar with customization [#calendar-with-customization] Props [#props] Calendar [#calendar] void", description: "Callback function when date is selected", }, minValue: { type: "DateValue", description: "Minimum selectable date value. Dates beyond this value will be disabled", }, maxValue: { type: "DateValue", description: "Maximum selectable date value. Dates beyond this value will be disabled", }, isDisabled: { type: "boolean", description: "Disable the calendar component", default: "false", }, isReadOnly: { type: "boolean", description: "Make the calendar read-only", default: "false", }, isDateUnavailable: { type: "(date: DateValue) => boolean", description: "Function to determine if a date is unavailable for selection", }, autoFocus: { type: "boolean", description: "Whether to auto focus the calendar on mount", default: "false", }, focusedValue: { type: "DateValue", description: "Controlled focused date value", }, defaultFocusedValue: { type: "DateValue", description: "Default focused date value (uncontrolled)", }, onFocusChange: { type: "(date: DateValue) => void", description: "Callback when the focused date changes", }, size: { type: "'sm' | 'md' | 'lg'", description: "Size of the calendar component", default: "lg", }, showFooter: { type: "boolean", description: "Show footer with action button", default: "true", }, footerActionText: { type: "string", description: "Text to be displayed on footer button", default: "'Select'", }, footerAction: { type: "(state: CalendarState) => void", description: "Action to be performed on footer button click", }, renderFooter: { type: "(state: CalendarState) => ReactNode", description: "Custom footer component", }, onDaySelect: { type: "(date: DateValue) => void", description: "Callback function when day is selected", }, onMonthSelect: { type: "(date: DateValue) => void", description: "Callback function when month is selected", }, onYearSelect: { type: "(date: DateValue) => void", description: "Callback function when year is selected", }, showTimePicker: { type: "boolean", description: "Show time picker for date and time selection", default: "false", }, showTimezonePicker: { type: "boolean", description: "Show timezone picker for timezone-aware selection", default: "false", }, hourCycle: { type: "12 | 24", description: "Hour cycle - 12 for 12-hour format with AM/PM, 24 for 24-hour format", default: "12", }, containerCSS: { type: "CSS Object", description: "Custom CSS for the container element", }, }} /> # Cascader (/docs/components/cascader) Import [#import] ```jsx import { Cascader } from "@sparrowengg/twigs-react"; ``` Usage [#usage] ```jsx setValue(val)} /> ``` We have stored the `test-data` seperately for the easy accessibility, all the example will use the same data. Examples [#examples] Cascader features [#cascader-features] Props [#props] Cascader [#cascader] void", description: "Callback fired when the value changes", }, label: { type: "string", description: "Label text for the cascader input", }, placeholder: { type: "string", description: "Placeholder text displayed when no value is selected", }, creatable: { type: "boolean", description: "Allows users to create new options", default: "false", }, cancelButtonText: { type: "string", description: "Text for the cancel button", default: "'Cancel'", }, chooseButtonText: { type: "string", description: "Text for the choose button", default: "'Choose'", }, fetchOptions: { type: "(data: { value: string; label: string } & Record) => Promise", description: "Function to fetch options dynamically for a node", }, fetchSearchOptions: { type: "(searchString: string) => Promise", description: "Function to fetch search results dynamically", }, renderValue: { type: "(value: CascaderItem | null, selectionPath: CascaderItem[]) => ReactNode", description: "Custom renderer for the selected value display", }, renderValueText: { type: "(value: CascaderItem | null, selectionPath: CascaderItem[]) => ReactNode", description: "Custom renderer for the value text", }, renderBreadCrumb: { type: "(data: CascaderItem | null, selectionPath: CascaderItem[]) => ReactNode", description: "Custom renderer for the breadcrumb display", }, inputAriaDescription: { type: "string", description: "ARIA description for the input field", }, ariaLiveContent: { type: "(data: { breadcrumb: string; label: string; totalItems: any; itemPosition: number; hasOptions: boolean; hasParent: boolean; } | null) => ReactNode", description: "Custom ARIA live region content for accessibility", }, searchLoadingIndicator: { type: "ReactNode", description: "Loading indicator shown during search", default: "'Loading Results...'", }, popoverPortal: { type: "HTMLElement", description: "Portal element for the popover", }, css: { type: "object", description: "Custom CSS styles for the component", }, }} /> # Checkbox (/docs/components/checkbox) Import [#import] ```jsx import { Checkbox } from "@sparrowengg/twigs-react"; ``` Usage [#usage] ```jsx const CheckboxExample = () => { return ( Accept terms and conditions ); }; ``` Examples [#examples] Indeterminate State [#indeterminate-state] The checkbox supports an indeterminate state, useful for representing partial selections (e.g., "select all" scenarios). When set to `'indeterminate'`, the checkbox displays a horizontal line icon instead of a checkmark. Props [#props] Checkbox [#checkbox] void", description: "Event handler called when the checked state changes.", }, children: { type: "ReactNode", description: "The content to display as the checkbox label.", }, disabled: { type: "boolean", description: "When true, prevents the user from interacting with the checkbox.", default: "false", }, required: { type: "boolean", description: "When true, indicates that the user must check the checkbox before submitting the form.", default: "false", }, id: { type: "string", description: "The id of the checkbox element. Auto-generated if not provided.", }, name: { type: "string", description: "The name of the checkbox. Useful for form submission.", }, value: { type: "string", description: "The value given as data when submitted with a name.", default: "on", }, size: { type: "'sm' | 'md'", description: "The size of the checkbox.", default: "'sm'", }, containerRef: { type: "React.Ref", description: "Ref to the container div element wrapping the checkbox.", }, css: { type: "object", description: "Custom CSS styles for the component.", }, }} /> Data Attributes [#data-attributes] These props are used for the conditional rendering of the components # Chip (/docs/components/chip) Import [#import] ```jsx import { Chip } from "@sparrowengg/twigs-react"; ``` Usage [#usage] ```jsx const ChipExample = () => { return (
Primary Success
); }; ``` You can customize the chip by adding `icons`, `variant` and `color` Examples [#examples] Selectable Chip [#selectable-chip] Interactive chips that can be selected and maintain an active state. Props [#props] Chip [#chip] void", description: "Callback function called when the close icon is clicked.", }, leftElement: { type: "ReactNode", description: "React element to display on the left side of the chip content.", }, rightElement: { type: "ReactNode", description: "React element to display on the right side of the chip content.", }, selectable: { type: "boolean", description: "When true, makes the chip selectable with hover and active states.", default: "false", }, active: { type: "boolean", description: "The controlled active state of the chip when selectable.", }, defaultActive: { type: "boolean", description: "The default active state when uncontrolled and selectable.", default: "false", }, onActiveStateChange: { type: "(active: boolean) => void", description: "Event handler called when the active state changes in selectable chips.", }, css: { type: "object", description: "Custom CSS styles for the component.", }, }} /> # Circle Loader (/docs/components/circle-loader) Import [#import] ```jsx import { CircleLoader } from "@sparrowengg/twigs-react"; ``` Usage [#usage] ```jsx const CircleLoaderExample = () => { return ( ); }; ``` Props [#props] CircleLoader [#circleloader] # DatePicker (/docs/components/datepicker) Prerequisite [#prerequisite] `DatePicker` component requires additional dependency of `@internationalized/date` to be installed.We will be working on removing this additional dependency in the future. ```bash npm install --save @internationalized/date ``` Import [#import] ```jsx import { DatePicker } from "@sparrowengg/twigs-react"; import { parseDate } from "@internationalized/date"; ``` Usage [#usage] ```jsx const DatePickerExample = () => { const [value, setValue] = React.useState(parseDate("2023-07-24")); return ( setValue(value as CalendarDate)} label="Enter date of birth" /> ); }; ``` Examples [#examples] Format Segments [#format-segments] Customize the display format of the date picker using the `formatSegments` prop. Props [#props] DatePicker [#datepicker] void", description: "Callback function when date is selected.", }, minValue: { type: "DateValue", description: "Minimum selectable date value. Dates beyond this value will be disabled.", }, maxValue: { type: "DateValue", description: "Maximum selectable date value. Dates beyond this value will be disabled.", }, isDisabled: { type: "boolean", description: "Disable the calendar component.", default: "false", }, isOpen: { type: "boolean", description: "Control the open state of the calendar popover.", default: "false", }, closeOnSelect: { type: "boolean", description: "Close datepicker on selecting a date.", default: "false", }, label: { type: "string", description: "Label text displayed above the date picker field.", }, enablePortal: { type: "boolean", description: "Calendar popover will render in body instead of parent container.", default: "false", }, portalTarget: { type: "Element", description: "Render Calendar Popover in specific element.", }, onDaySelect: { type: "(date: DateValue) => void", description: "Callback function when day is selected.", }, onMonthSelect: { type: "(date: DateValue) => void", description: "Callback function when month is selected.", }, onYearSelect: { type: "(date: DateValue) => void", description: "Callback function when year is selected.", }, showFooter: { type: "boolean", description: "Show footer with action button.", default: "true", }, footerAction: { type: "(state: CalendarState, setPopoverOpen: (isOpen: boolean) => void) => void", description: "Action to be performed on footer button click.", }, footerActionText: { type: "string", description: "Text to be displayed on footer button.", default: "'Select'", }, renderFooter: { type: "(state: CalendarState, setPopoverOpen: (isOpen: boolean) => void) => ReactNode", description: "Custom footer component.", }, containerCSS: { type: "CSS", description: "Custom CSS for the container element.", }, calendarContainerCSS: { type: "CSS", description: "Custom CSS for the calendar container element.", }, popoverContentProps: { type: "PopoverContentProps", description: "Additional props to be passed to the popover content component.", }, formatSegments: { type: "(segments: DateSegment[]) => DateSegment[]", description: "Custom format segments for the date picker display.", }, showTimePicker: { type: "boolean", description: "Show time picker in the calendar.", default: "false", }, showTimezonePicker: { type: "boolean", description: "Show timezone picker in the calendar.", default: "false", }, hourCycle: { type: "12 | 24", description: "Hour cycle - 12 for 12-hour format with AM/PM, 24 for 24-hour format.", default: "12", }, }} /> # Dialog (/docs/components/dialog) Import [#import] ```jsx import { Dialog, DialogTrigger, DialogContent, DialogHeader, DialogTitle, DialogDescription, DialogBody,DialogFooter, DialogClose } from "@sparrowengg/twigs-react"; ``` Usage [#usage] ```jsx const DialogExample = () => { return ( Edit profile Make changes to your profile here. Click save when done. {/* Your content here */} ); }; ``` Props [#props] Dialog [#dialog] void", description: "Event handler called when the open state of the dialog changes.", }, size: { type: "'sm' | 'md' | 'lg' | 'xl' | 'full'", description: "The size of the dialog.", default: "'md'", }, scrollBehavior: { type: "'auto' | 'scroll' | 'hidden'", description: "Control scroll behavior of the dialog content.", default: "'auto'", }, css: { type: "object", description: "Custom CSS styles for the component.", }, }} /> DialogContent [#dialogcontent] DialogTitle [#dialogtitle] Data Attributes [#data-attributes] These props are used for the conditional rendering of the components # DialogsManager (/docs/components/dialogs-manager) Import [#import] ```jsx import { DialogsManager, dialogs } from "@sparrowengg/twigs-react"; ``` Usage [#usage] Add `DialogsManager` to a top level component like `App` as shown below: ```jsx import { DialogsManager } from "@sparrowengg/twigs-react"; function App() { return (
); } ``` And now you can call `dialogs.open` or `dialogs.push` to open new dialogs. Methods [#methods] dialogs.open(dialogName, options) [#dialogsopendialogname-options] **Returns object with two properties:** dialogs.push(dialogName, options) [#dialogspushdialogname-options] The parameters and return types are same as that of `dialogs.open`, the only difference is that `push` doesn't close existing modals. dialogs.close(dialogId) [#dialogsclosedialogid] Used to close a particular dialog. dialogs.closeAll() [#dialogscloseall] Used to close all open dialogs. Props [#props] DialogsManager [#dialogsmanager] void; [x: string]: any }) => ReactNode>", description: "Custom dialogs that can be opened using dialogs methods.", default: "{}", }, }} /> Default Dialogs Props [#default-dialogs-props] Alert [#alert] ) => void", description: "Callback when action button is clicked.", default: "undefined", }, onClose: { type: "() => void", description: "Callback when dialog is closed.", default: "undefined", }, }} /> Confirm [#confirm] ) => void", description: "Callback when confirm button is clicked.", default: "undefined", }, onCancel: { type: "(e: React.MouseEvent) => void", description: "Callback when cancel button is clicked.", default: "undefined", }, onClose: { type: "() => void", description: "Callback when dialog is closed.", default: "undefined", }, css: { type: "CSS", description: "Custom styles to be applied on the content.", default: "{}", }, }} /> Modal [#modal] ) => void", description: "Callback when action button is clicked.", default: "undefined", }, onClose: { type: "() => void", description: "Callback when dialog is closed.", default: "undefined", }, size: { type: "'sm' | 'md' | 'lg' | 'xl' | 'full'", description: "The size of the modal dialog.", default: "'md'", }, }} /> Typesafe Options [#typesafe-options] When creating custom dialogs, you can ensure type safety to `dialogs.open` and `dialogs.push` by overriding the `DialogOptionsOverride` interface as shown below: ```tsx declare module "@sparrowengg/twigs-react" { export interface DialogOptionsOverride { deleteModal: { title: string; onDelete: () => void; }; } } ``` # Drawer (/docs/components/drawer) Import [#import] ```jsx import { Drawer, DrawerHeader, DrawerFooter, DrawerBody } from "@sparrowengg/twigs-react"; ``` Usage [#usage] ```jsx const DrawerExample = () => { const [isDrawerOpen, setIsDrawerOpen] = React.useState(false); return ( <> setIsDrawerOpen(false)} placement="right" > Edit Profile {/* Your content here */} {/* Footer content */} ); }; ``` Props [#props] Drawer [#drawer] You can alter the placement of the Modal by changing the prop to `top` ,`right` ,`left` and `bottom` void", description: "Callback function called when the drawer is closed.", }, placement: { type: "'top' | 'left' | 'right' | 'bottom'", description: "The placement of the drawer on the screen.", default: "'right'", }, finalFocusRef: { type: "React.RefObject", description: "Reference to the element that should receive focus when the drawer closes.", }, portalContainer: { type: "HTMLElement", description: "Custom container element for the drawer portal.", }, children: { type: "ReactNode", description: "The content to be rendered inside the drawer.", }, css: { type: "object", description: "Custom CSS styles for the component.", }, }} /> # Dropdown (/docs/components/dropdown) Import [#import] ```jsx import {DropdownMenu,DropdownMenuTrigger,DropdownMenuContent,DropdownMenuItem,DropdownMenuCheckboxItem,DropdownMenuRadioGroup,DropdownMenuRadioItem,DropdownMenuItemIndicator,DropdownMenuLabel,DropdownMenuSeparator,DropdownMenuSub,DropdownMenuSubTrigger,DropdownMenuSubContent} from "@sparrowengg/twigs-react"; ``` Usage [#usage] ```jsx const DropdownExample = () => { const [bookmarksChecked, setBookmarksChecked] = React.useState(true); const [urlsChecked, setUrlsChecked] = React.useState(false); const [person, setPerson] = React.useState("pedro"); return ( New Tab New Window More Tools Save Page As… ); }; ``` Examples [#examples] Advanced customization [#advanced-customization] The dropdown component supports a wide range of features you can customize the component based on your own needs. Props [#props] DropdownMenu [#dropdownmenu] void", description: "Event handler called when the open state of the dropdown menu changes.", }, modal: { type: "boolean", description: "When true, prevents the dropdown menu from closing when clicking outside of it.", default: "true", }, dir: { type: "'ltr' | 'rtl'", description: "The reading direction of the dropdown menu when applicable.", }, size: { type: "'sm' | 'md'", description: "The size of the dropdown menu items and content.", default: "'md'", }, }} /> DropdownMenuTrigger [#dropdownmenutrigger] DropdownMenuContent [#dropdownmenucontent] >", description: "The distance in pixels from the boundary.", default: "0", }, arrowPadding: { type: "number", description: "The padding between the arrow and the edges of the content.", default: "0", }, sticky: { type: "'partial' | 'always'", description: "The sticky behavior on the align axis.", default: "'partial'", }, hideWhenDetached: { type: "boolean", description: "Whether to hide the content when the trigger becomes occluded.", default: "false", }, loop: { type: "boolean", description: "Whether focus should loop inside the content.", default: "false", }, onCloseAutoFocus: { type: "(event: Event) => void", description: "Event handler called when focus moves to the trigger after closing.", }, onEscapeKeyDown: { type: "(event: KeyboardEvent) => void", description: "Event handler called when the escape key is pressed.", }, onPointerDownOutside: { type: "(event: PointerDownOutsideEvent) => void", description: "Event handler called when a pointer event occurs outside the content.", }, onFocusOutside: { type: "(event: FocusOutsideEvent) => void", description: "Event handler called when focus moves outside the content.", }, onInteractOutside: { type: "(event: PointerDownOutsideEvent | FocusOutsideEvent) => void", description: "Event handler called when an interaction outside the content occurs.", }, forceMount: { type: "boolean", description: "Used to force mounting when more control is needed.", }, container: { type: "HTMLElement", description: "The container inside which to render the content.", }, showArrow: { type: "boolean", description: "Whether to show an arrow pointing to the trigger.", default: "false", }, }} /> DropdownMenuItem [#dropdownmenuitem] void", description: "Event handler called when the item is selected.", }, textValue: { type: "string", description: "Optional text used for typeahead purposes.", }, }} /> DropdownMenuCheckboxItem [#dropdownmenucheckboxitem] void", description: "Event handler called when the checked state changes.", }, disabled: { type: "boolean", description: "When true, prevents the user from interacting with the item.", default: "false", }, textValue: { type: "string", description: "Optional text used for typeahead purposes.", }, }} /> DropdownMenuRadioGroup [#dropdownmenuradiogroup] void", description: "Event handler called when the value changes.", }, disabled: { type: "boolean", description: "When true, prevents the user from interacting with the group.", default: "false", }, }} /> DropdownMenuRadioItem [#dropdownmenuradioitem] DropdownMenuSub [#dropdownmenusub] void", description: "Event handler called when the open state of the submenu changes.", }, }} /> DropdownMenuSubTrigger [#dropdownmenusubtrigger] DropdownMenuSubContent [#dropdownmenusubcontent] >", description: "The distance in pixels from the boundary.", default: "0", }, arrowPadding: { type: "number", description: "The padding between the arrow and the edges of the content.", default: "0", }, sticky: { type: "'partial' | 'always'", description: "The sticky behavior on the align axis.", default: "'partial'", }, hideWhenDetached: { type: "boolean", description: "Whether to hide the content when the trigger becomes occluded.", default: "false", }, loop: { type: "boolean", description: "Whether focus should loop inside the content.", default: "false", }, onCloseAutoFocus: { type: "(event: Event) => void", description: "Event handler called when focus moves to the trigger after closing.", }, onEscapeKeyDown: { type: "(event: KeyboardEvent) => void", description: "Event handler called when the escape key is pressed.", }, onPointerDownOutside: { type: "(event: PointerDownOutsideEvent) => void", description: "Event handler called when a pointer event occurs outside the content.", }, onFocusOutside: { type: "(event: FocusOutsideEvent) => void", description: "Event handler called when focus moves outside the content.", }, onInteractOutside: { type: "(event: PointerDownOutsideEvent | FocusOutsideEvent) => void", description: "Event handler called when an interaction outside the content occurs.", }, forceMount: { type: "boolean", description: "Used to force mounting when more control is needed.", }, container: { type: "HTMLElement", description: "The container inside which to render the content.", }, }} /> Data Attributes [#data-attributes] These props are used for the conditional rendering of the components **Applicable** \- DropdownMenu **Applicable** \- DropdownMenuTrigger **Applicable** \- DropdownMenuContent/ DropdownMenuSubContent **Applicable** \- DropdownMenuItem/ DropdownMenuCheckboxItem/ DropdownMenuRadioItem/ DropdownMenuSubTrigger **Applicable** \- DropdownMenuSubTrigger # Flex (/docs/components/flex) Import [#import] ```jsx import { Flex } from "@sparrowengg/twigs-react"; ``` Usage [#usage] ```jsx const FlexExample = () => { return ( Item 1 Item 2 Item 3 ); }; ``` Props [#props] Flex [#flex] # FormHelperText (/docs/components/form-helper-text) Import [#import] ```jsx import { FormHelperText } from "@sparrowengg/twigs-react"; ``` Usage [#usage] ```jsx const FormHelperTextExample = () => { return ( This is a helpful message for the user This is an error message Password should have a minimum length of 6. ); }; ``` Props [#props] FormHelperText [#formhelpertext] # FormInput (/docs/components/form-input) Import [#import] ```jsx import { FormInput } from "@sparrowengg/twigs-react"; ``` Usage [#usage] ```jsx const FormInputExample = () => { return ( ); }; ``` Examples [#examples] Variants and advanced features [#variants-and-advanced-features] Explore all available features and varieties of the FormInput component. Props [#props] FormInput [#forminput] ReactNode", description: "Custom function to render the character counter. Overrides the default counter when provided.", }, size: { type: "'sm' | 'md' | 'lg' | 'xl'", description: "Controls the size of the input field, affecting height, padding, and font size.", default: "'md'", }, variant: { type: "'default' | 'filled'", description: "Controls the visual style variant of the input field.", default: "'default'", }, disabled: { type: "boolean", description: "When true, disables the input field and prevents user interaction.", default: "false", }, leftIcon: { type: "ReactElement", description: "Icon element displayed on the left side of the input field.", }, rightIcon: { type: "ReactElement", description: "Icon element displayed on the right side of the input field.", }, leftElement: { type: "ReactElement", description: "Custom element displayed on the left side of the input field.", }, rightElement: { type: "ReactElement", description: "Custom element displayed on the right side of the input field.", }, errorBorder: { type: "boolean", description: "When true, applies error border styling to the input field.", default: "false", }, maxLength: { type: "number", description: "Maximum number of characters allowed in the input field.", }, onChange: { type: "(e: React.ChangeEvent | React.FormEvent) => void", description: "Event handler called when the input value changes.", }, value: { type: "string", description: "The controlled value of the input field.", }, defaultValue: { type: "string", description: "The default value of the input field when uncontrolled.", }, placeholder: { type: "string", description: "Placeholder text displayed when the input field is empty.", }, type: { type: "string", description: "The type of the input field (e.g., 'text', 'password', 'email').", default: "'text'", }, css: { type: "object", description: "Custom CSS styles for the component.", }, as: { type: "React.ElementType", description: "Allows you to render the component as a different HTML element or custom component.", }, }} /> # FormLabel (/docs/components/form-label) Import [#import] ```jsx import { FormLabel } from "@sparrowengg/twigs-react"; ``` Usage [#usage] ```jsx const FormLabelExample = () => { return ( Small Label Medium Label Required Field Label with Info Optional}> Label with Right Addon ); }; ``` Props [#props] FormLabel [#formlabel] ", description: "Ref for the container div that wraps the label and addons.", }, as: { type: "React.ElementType", description: "The element type to render the label as. Inherits from styled component.", }, css: { type: "object", description: "Custom CSS styles for the component.", }, }} /> # Grid (/docs/components/grid) Import [#import] ```jsx import { Grid } from "@sparrowengg/twigs-react"; ``` Usage [#usage] ```jsx const GridExample = () => { return ( Grid Item 1 Grid Item 2 Grid Item 3 Grid Item 4 ); }; ``` Props [#props] Grid [#grid] ", description: "Array containing [rowGap, columnGap] values for grid spacing. Numbers are converted to design tokens.", default: "[3, 3]", }, repeat: { type: "'fit' | 'fill'", description: "Controls how auto-generated columns behave when using width prop. 'fit' creates columns that fit content, 'fill' fills available space.", default: "'fit'", }, children: { type: "ReactNode", description: "Grid items to be rendered within the grid container.", }, css: { type: "object", description: "Custom CSS styles for the component.", }, }} /> # Heading (/docs/components/heading) Import [#import] ```jsx import { Heading } from "@sparrowengg/twigs-react"; ``` Usage [#usage] ```jsx const HeadingExample = () => { return ( Heading 1 - Bold Heading 2 - Semibold Heading 3 - Medium Heading 4 - Regular Heading 5 as H1 Heading 6 as H2 ); }; ``` Changing the `size` of the heading does not change its html element type. It only changes the font size of the heading. If you want to change the html element type, you can use the `as` prop. Props [#props] Heading [#heading] # HoverCard (/docs/components/hover-card) Import [#import] ```jsx import {HoverCard,HoverCardTrigger,HoverCardContent,HoverCardPortal,HoverCardArrow} from "@sparrowengg/twigs-react"; ``` Usage [#usage] ```jsx const HoverCardExample = () => { return ( Hover Card Title This is a detailed description that appears when you hover over the trigger element. ); }; ``` Props [#props] HoverCard [#hovercard] void", description: "Event handler called when the open state changes.", }, openDelay: { type: "number", description: "The duration in milliseconds from when the mouse enters the trigger until the hover card opens.", default: "700", }, closeDelay: { type: "number", description: "The duration in milliseconds from when the mouse leaves the trigger until the hover card closes.", default: "300", }, css: { type: "object", description: "Custom CSS styles for the component.", }, }} /> HoverCardTrigger [#hovercardtrigger] HoverCardContent [#hovercardcontent] HoverCardPortal [#hovercardportal] Data Attributes [#data-attributes] **Applicable** \- HoverCardTrigger **Applicable** \- HoverCardContent # IconButton (/docs/components/icon-button) Import [#import] ```jsx import { IconButton } from "@sparrowengg/twigs-react"; ``` Usage [#usage] ```jsx const IconButtonExample = () => { return ( } aria-label="Edit" size="md" color="primary" variant="solid" /> ); }; ``` Props [#props] IconButton [#iconbutton] # Image (/docs/components/image) Import [#import] ```jsx import { Image } from "@sparrowengg/twigs-react"; ``` Usage [#usage] ```jsx const ImageExample = () => { return ( Mountain landscape ); }; ``` Props [#props] Image [#image] # Overview (/docs/components) import { ComponentHome } from "@/component/component-home"; # Input (/docs/components/input) Import [#import] ```jsx import { Input } from "@sparrowengg/twigs-react"; ``` Usage [#usage] ```jsx const InputExample = () => { return ( ); }; ``` Examples [#examples] With Icons and Advanced Features [#with-icons-and-advanced-features] Comprehensive example showing all Input features including icons, different states, and interactive elements. Props [#props] Input [#input] | React.FormEvent) => void", description: "Event handler called when the input value changes.", }, css: { type: "object", description: "Custom CSS styles for the component.", }, className: { type: "string", description: "Additional CSS class names to apply to the input element.", }, }} /> The Input component also accepts all standard HTML input attributes such as `type`, `placeholder`, `value`, `defaultValue`, `name`, `id`, `required`, `readOnly`, `autoComplete`, `autoFocus`, `pattern`, `min`, `max`, `step`, and event handlers like `onFocus`, `onBlur`, `onKeyDown`, etc. # LineLoader (/docs/components/line-loader) Import [#import] ```jsx import { LineLoader } from "@sparrowengg/twigs-react"; ``` Usage [#usage] ```jsx const LineLoaderExample = () => { return ( ); }; ``` Props [#props] LineLoader [#lineloader] ", description: "Ref to access the underlying container element.", }, }} /> # Link (/docs/components/link) Import [#import] ```jsx import { Link } from "@sparrowengg/twigs-react"; ``` Usage [#usage] ```jsx const LinkExample = () => { return ( Link ); }; ``` Props [#props] Link [#link] The Link component also accepts all standard HTML anchor attributes such as `download`, `hreflang`, `media`, `ping`, `referrerPolicy`, `type`, and event handlers like `onClick`, `onFocus`, `onBlur`, etc. # Pagination (/docs/components/pagination) Import [#import] ```jsx import { Pagination } from "@sparrowengg/twigs-react"; ``` Usage [#usage] ```jsx const PaginationExample = () => { const [activePage, setActivePage] = useState(1); return ( setActivePage(page)} /> ); }; ``` Examples [#examples] Advanced Pagination [#advanced-pagination] Comprehensive example showing different pagination configurations with various sizes, sibling counts, and page ranges. Props [#props] Pagination [#pagination] void", description: "Event handler called when the page changes. Receives the click event and the new page number.", }, size: { type: "'xxs' | 'xs' | 'sm' | 'md' | 'lg' | 'xl' | '2xl'", description: "The size of the pagination buttons. Affects the overall size and spacing of the pagination component.", default: "'sm'", }, css: { type: "object", description: "Custom CSS styles for the component.", }, }} /> # Popover (/docs/components/popover) Import [#import] ```jsx import {Popover,PopoverTrigger,PopoverContent,PopoverClose,PopoverArrow,PopoverPortal,PopoverAnchor} from "@sparrowengg/twigs-react"; ``` Usage [#usage] ```jsx const PopoverExample = () => { return ( Settings Configure your preferences Update your profile settings Manage notifications ); }; ``` Props [#props] Popover [#popover] void", description: "Event handler called when the open state changes.", }, modal: { type: "boolean", description: "When true, the popover will be modal, preventing interaction with elements outside of it.", default: "false", }, css: { type: "object", description: "Custom CSS styles for the component.", }, }} /> PopoverTrigger [#popovertrigger] PopoverContent [#popovercontent] void", description: "Event handler called when focus moves into the component after opening.", }, onCloseAutoFocus: { type: "(event: Event) => void", description: "Event handler called when focus moves to the trigger after closing.", }, onEscapeKeyDown: { type: "(event: KeyboardEvent) => void", description: "Event handler called when the escape key is pressed.", }, onPointerDownOutside: { type: "(event: PointerDownOutsideEvent) => void", description: "Event handler called when a pointer event occurs outside the content.", }, onFocusOutside: { type: "(event: FocusOutsideEvent) => void", description: "Event handler called when focus moves outside the content.", }, onInteractOutside: { type: "(event: PointerDownOutsideEvent | FocusOutsideEvent) => void", description: "Event handler called when an interaction outside the content occurs.", }, asChild: { type: "boolean", description: "Change the default rendered element for the one passed as a child, merging their props and behavior.", default: "false", }, }} /> PopoverClose [#popoverclose] PopoverArrow [#popoverarrow] PopoverPortal [#popoverportal] PopoverAnchor [#popoveranchor] Data Attributes [#data-attributes] These props are used for the conditional rendering of the components **Applicable** \- PopoverTrigger **Applicable** \- PopoverContent # Radio (/docs/components/radio) Import [#import] ```jsx import { RadioGroup, Radio } from "@sparrowengg/twigs-react"; ``` Usage [#usage] ```jsx const RadioExample = () => { const [selectedValue, setSelectedValue] = useState("option1"); return ( Choose your preference: Small radio option Medium radio option Disabled radio option Default selection: Default option Comfortable option Compact option ); }; ``` Props [#props] RadioGroup [#radiogroup] void", description: "Event handler called when the value changes.", }, disabled: { type: "boolean", description: "When true, prevents the user from interacting with the radio group.", default: "false", }, required: { type: "boolean", description: "When true, indicates that the user must fill in a value before submitting a form.", default: "false", }, name: { type: "string", description: "The name of the group. Submitted with its owning form as part of a name/value pair.", }, orientation: { type: "'horizontal' | 'vertical'", description: "The orientation of the radio group.", }, dir: { type: "'ltr' | 'rtl'", description: "The reading direction of the radio group. If omitted, assumes LTR (left-to-right) reading mode.", }, loop: { type: "boolean", description: "Whether focus should loop around when the end/start is reached.", default: "true", }, asChild: { type: "boolean", description: "Change the default rendered element for the one passed as a child, merging their props and behavior.", default: "false", }, }} /> Radio [#radio] ", description: "Ref to access the container element wrapping the radio and label.", }, css: { type: "object", description: "Custom CSS styles for the component.", }, }} /> Data Attributes [#data-attributes] These props are used for the conditional rendering of the components **Applicable** \- RadioGroup **Applicable** \- Radio # Select (/docs/components/select) Import [#import] ```jsx import { Select } from "@sparrowengg/twigs-react"; ``` Usage [#usage] ```jsx const SelectExample = () => { const [selectedValue, setSelectedValue] = useState(null); return (