UNPKG

1.42 kBTypeScriptView Raw
1import * as React from 'react';
2export interface TabsContextValue {
3 /**
4 * The currently selected tab's value.
5 */
6 value: number | string | null;
7 /**
8 * Callback for setting new value.
9 */
10 onSelected: (event: React.SyntheticEvent | null, value: number | string | null) => void;
11 /**
12 * The component orientation (layout flow direction).
13 */
14 orientation?: 'horizontal' | 'vertical';
15 /**
16 * The direction of the tabs.
17 */
18 direction?: 'ltr' | 'rtl';
19 /**
20 * Registers a function that returns the id of the tab with the given value.
21 */
22 registerTabIdLookup: (lookupFunction: (id: string | number) => string | undefined) => void;
23 /**
24 * If `true` the selected tab changes on focus. Otherwise it only
25 * changes on activation.
26 */
27 selectionFollowsFocus?: boolean;
28 /**
29 * Gets the id of the tab with the given value.
30 * @param value Value to find the tab for.
31 */
32 getTabId: (value: number | string) => string | undefined;
33 /**
34 * Gets the id of the tab panel with the given value.
35 * @param value Value to find the tab panel for.
36 */
37 getTabPanelId: (value: number | string) => string | undefined;
38}
39/**
40 * @ignore - internal component.
41 */
42declare const TabsContext: React.Context<TabsContextValue | null>;
43export declare function useTabsContext(): TabsContextValue;
44export { TabsContext };