UNPKG

@radix-ui/react-tabs

Version:
51 lines (49 loc) 2.59 kB
import * as React from "react"; import { Primitive } from "@radix-ui/react-primitive"; import { RovingFocusGroup, RovingFocusItem } from "@radix-ui/react-roving-focus"; import * as Polymorphic from "@radix-ui/react-polymorphic"; type RovingFocusGroupProps = React.ComponentProps<typeof RovingFocusGroup>; type TabsOwnProps = Polymorphic.Merge<Polymorphic.OwnProps<typeof Primitive>, { /** The value for the selected tab, if controlled */ value?: string; /** The value of the tab to select by default, if uncontrolled */ defaultValue?: string; /** A function called when a new tab is selected */ onValueChange?: (value: string) => void; /** * The orientation the tabs are layed out. * Mainly so arrow navigation is done accordingly (left & right vs. up & down) * @defaultValue horizontal */ orientation?: RovingFocusGroupProps['orientation']; /** * The direction of navigation between toolbar items. * @defaultValue ltr */ dir?: RovingFocusGroupProps['dir']; /** Whether a tab is activated automatically or manually (default: automatic) */ activationMode?: 'automatic' | 'manual'; }>; export type TabsPrimitive = Polymorphic.ForwardRefComponent<Polymorphic.IntrinsicElement<typeof Primitive>, TabsOwnProps>; export const Tabs: TabsPrimitive; declare const TAB_LIST_DEFAULT_TAG = "div"; type TabsListOwnProps = Omit<Polymorphic.OwnProps<typeof RovingFocusGroup>, 'orientation' | 'currentTabStopId' | 'defaultCurrentTabStopId' | 'onCurrentTabStopIdChange' | 'onEntryFocus'>; export type TabsListPrimitive = Polymorphic.ForwardRefComponent<typeof TAB_LIST_DEFAULT_TAG, TabsListOwnProps>; export const TabsList: TabsListPrimitive; declare const TRIGGER_DEFAULT_TAG = "div"; type TabsTriggerOwnProps = Polymorphic.Merge<Omit<Polymorphic.OwnProps<typeof RovingFocusItem>, 'focusable' | 'active'>, { value: string; disabled?: boolean; }>; export type TabsTriggerPrimitive = Polymorphic.ForwardRefComponent<typeof TRIGGER_DEFAULT_TAG, TabsTriggerOwnProps>; export const TabsTrigger: TabsTriggerPrimitive; type TabsContentPropsOwnProps = Polymorphic.Merge<Polymorphic.OwnProps<typeof Primitive>, { value: string; }>; export type TabsContentPrimitive = Polymorphic.ForwardRefComponent<Polymorphic.IntrinsicElement<typeof Primitive>, TabsContentPropsOwnProps>; export const TabsContent: TabsContentPrimitive; export const Root: TabsPrimitive; export const List: TabsListPrimitive; export const Trigger: TabsTriggerPrimitive; export const Content: TabsContentPrimitive; //# sourceMappingURL=index.d.ts.map