@theguild/components
Version:
34 lines (31 loc) • 1.25 kB
text/typescript
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.
* Defaults to `tabs-${id}` if not provided.
* Set to `null` to disable localStorage persistence.
*/
storageKey?: string | 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 };