UNPKG

@payfit/unity-components

Version:

51 lines (50 loc) 1.78 kB
import { VariantProps } from '@payfit/unity-themes'; import { TabsProps as AriaTabsProps } from 'react-aria-components/Tabs'; import { tabsVariant } from './Tabs.variant.js'; export interface TabsProps extends Omit<AriaTabsProps, 'isDisabled' | 'orientation' | 'className' | 'style' | 'disabledKeys' | 'keyboardActivation' | 'slot'>, VariantProps<typeof tabsVariant> { /** set to true to make the tabs scrollable */ scrollable?: boolean; } /** * Use these tabs when switching between sections without changing the URL. * * When each tab represents a navigable page and its selection must be * shareable, bookmarkable, or preserved by browser history, use the * [TanStack Router Tabs integration](?path=/docs/library-integrations-reference-tanstack-router-tabs--docs) * instead. * @example Static API * ```tsx * <Tabs defaultSelectedKey="profile"> * <TabList aria-label="Account"> * <RawTab id="profile">Profile</RawTab> * <RawTab id="settings">Settings</RawTab> * </TabList> * <TabPanels> * <TabPanel id="profile"> * <Profile /> * </TabPanel> * <TabPanel id="settings"> * <Settings /> * </TabPanel> * </TabPanels> * </Tabs> * ``` * @example Dynamic API * ```tsx * const tabs = [ * { id: 'profile', title: 'Profile', content: <Profile /> }, * { id: 'settings', title: 'Settings', content: <Settings /> }, * ] * * <Tabs> * <TabList aria-label="Account" items={tabs}> * {item => <RawTab>{item.title}</RawTab>} * </TabList> * <TabPanels items={tabs}> * {item => <TabPanel>{item.content}</TabPanel>} * </TabPanels> * </Tabs> * ``` */ declare const Tabs: import('react').ForwardRefExoticComponent<TabsProps & import('react').RefAttributes<HTMLDivElement>>; export { Tabs };