UNPKG

@styleless-ui/react

Version:

Completely unstyled, headless and accessible React UI components.

40 lines (39 loc) 1.33 kB
import * as React from "react"; import type { MergeElementProps } from "../typings"; interface OwnProps { /** * The content of the tab group. */ children?: React.ReactNode; /** * The className applied to the component. */ className?: string; /** * The currently selected tab. */ activeTab?: number; /** * The default selected tab. Use when the component is not controlled. */ defaultActiveTab?: number; /** * The Callback is fired when the state changes. */ onChange?: (tabIndex: number) => void; /** * Indicates whether the element's orientation is horizontal or vertical. * This effects the keyboard interactions. * @default "horizontal" */ orientation?: "horizontal" | "vertical"; /** * If `automatic`, tabs are automatically activated and their panel is displayed when they receive focus. * If `manual`, users activate a tab and display its panel by focusing them and pressing `Space` or `Enter`. * @default "manual" */ keyboardActivationBehavior?: "manual" | "automatic"; } export type Props = Omit<MergeElementProps<"div", OwnProps>, "defaultChecked" | "defaultValue">; declare const TabGroup: (props: Props, ref: React.Ref<HTMLDivElement>) => JSX.Element; export default TabGroup;