UNPKG

2 kBTypeScriptView Raw
1import * as React from 'react';
2import { TabsListProviderValue } from './TabsListProvider';
3import { ListAction } from '../useList';
4export interface UseTabsListParameters {
5 /**
6 * Ref to the root element.
7 */
8 rootRef: React.Ref<Element>;
9}
10export type UseTabsListRootSlotProps<TOther = {}> = TOther & {
11 'aria-label'?: React.AriaAttributes['aria-label'];
12 'aria-labelledby'?: React.AriaAttributes['aria-labelledby'];
13 'aria-orientation'?: React.AriaAttributes['aria-orientation'];
14 role: React.AriaRole;
15 ref: React.RefCallback<Element> | null;
16 onKeyDown?: React.KeyboardEventHandler<HTMLElement>;
17};
18export interface UseTabsListReturnValue {
19 /**
20 * The value to be passed to the TabListProvider above all the tabs.
21 */
22 contextValue: TabsListProviderValue;
23 /**
24 * Action dispatcher for the tabs list component.
25 * Allows to programmatically control the tabs list.
26 */
27 dispatch: (action: ListAction<string | number>) => void;
28 /**
29 * Resolver for the root slot's props.
30 * @param externalProps props for the root slot
31 * @returns props that should be spread on the root slot
32 */
33 getRootProps: <TOther extends Record<string, any> = {}>(externalProps?: TOther) => UseTabsListRootSlotProps<TOther>;
34 /**
35 * The value of the currently highlighted tab.
36 */
37 highlightedValue: string | number | null;
38 /**
39 * If `true`, it will indicate that the text's direction in right-to-left.
40 */
41 isRtl: boolean;
42 /**
43 * The component orientation (layout flow direction).
44 */
45 orientation: 'horizontal' | 'vertical';
46 rootRef: React.RefCallback<Element> | null;
47 /**
48 * The value of the currently selected tab.
49 */
50 selectedValue: string | number | null;
51}
52export declare const TabsListActionTypes: {
53 readonly valueChange: "valueChange";
54};
55export interface ValueChangeAction {
56 type: typeof TabsListActionTypes.valueChange;
57 value: string | number | null;
58}