UNPKG

2.46 kBTypeScriptView Raw
1import * as React from 'react';
2import { Simplify } from '@mui/types';
3import { SlotComponentProps } from '../utils';
4import { PolymorphicProps } from '../utils/PolymorphicComponent';
5export interface TabsRootSlotPropsOverrides {
6}
7type TabsOrientation = 'horizontal' | 'vertical';
8type TabsDirection = 'ltr' | 'rtl';
9export interface TabsOwnProps {
10 /**
11 * The content of the component.
12 */
13 children?: React.ReactNode;
14 /**
15 * The value of the currently selected `Tab`.
16 * If you don't want any selected `Tab`, you can set this prop to `null`.
17 */
18 value?: string | number | null;
19 /**
20 * The default value. Use when the component is not controlled.
21 */
22 defaultValue?: string | number | null;
23 /**
24 * The component orientation (layout flow direction).
25 * @default 'horizontal'
26 */
27 orientation?: TabsOrientation;
28 /**
29 * The direction of the text.
30 * @default 'ltr'
31 */
32 direction?: TabsDirection;
33 className?: string;
34 /**
35 * Callback invoked when new value is being set.
36 */
37 onChange?: (event: React.SyntheticEvent | null, value: number | string | null) => void;
38 /**
39 * If `true` the selected tab changes on focus. Otherwise it only
40 * changes on activation.
41 */
42 selectionFollowsFocus?: boolean;
43 /**
44 * The props used for each slot inside the Tabs.
45 * @default {}
46 */
47 slotProps?: {
48 root?: SlotComponentProps<'div', TabsRootSlotPropsOverrides, TabsOwnerState>;
49 };
50 /**
51 * The components used for each slot inside the Tabs.
52 * Either a string to use a HTML element or a component.
53 * @default {}
54 */
55 slots?: TabsSlots;
56}
57export interface TabsSlots {
58 /**
59 * The component that renders the root.
60 * @default 'div'
61 */
62 root?: React.ElementType;
63}
64export interface TabsTypeMap<AdditionalProps = {}, RootComponentType extends React.ElementType = 'div'> {
65 props: TabsOwnProps & AdditionalProps;
66 defaultComponent: RootComponentType;
67}
68export type TabsProps<RootComponentType extends React.ElementType = TabsTypeMap['defaultComponent']> = PolymorphicProps<TabsTypeMap<{}, RootComponentType>, RootComponentType>;
69export type TabsOwnerState = Simplify<TabsOwnProps & {
70 orientation: TabsOrientation;
71 direction: TabsDirection;
72}>;
73export type TabsRootSlotProps = {
74 ownerState: TabsOwnerState;
75 ref: React.Ref<any>;
76 className?: string;
77};
78export {};