UNPKG

@theguild/components

Version:
35 lines (32 loc) 1.32 kB
import * as react_jsx_runtime from 'react/jsx-runtime'; import { ReactElement, ReactNode, FC } from 'react'; import { TabGroupProps, TabListProps, TabProps, TabPanelProps } from '@headlessui/react'; type TabItem = string | ReactElement; type TabObjectItem = { key?: string; label: TabItem; disabled: boolean; }; interface TabsProps extends Pick<TabGroupProps, 'defaultIndex' | 'selectedIndex' | 'onChange'> { items: (TabItem | TabObjectItem)[]; children: ReactNode; /** * URLSearchParams key for persisting the selected tab. * @default "tab" */ searchParamKey?: string; /** * LocalStorage key for persisting the selected tab. * Set to `true` to use the default key `tabs-${id}`. * Leave empty or set to `null` to disable localStorage persistence. * Set to a string to use a custom key. */ storageKey?: string | true | null; /** Tabs CSS class name. */ className?: TabListProps['className']; /** Tab CSS class name. */ tabClassName?: TabProps['className']; } declare const Tabs: ({ items, children, searchParamKey, storageKey, defaultIndex, selectedIndex: _selectedIndex, onChange, className, tabClassName, }: TabsProps) => react_jsx_runtime.JSX.Element; declare const Tab: FC<TabPanelProps>; export { Tab, Tabs, type TabsProps };