UNPKG

2.18 kBTypeScriptView Raw
1import * as React from 'react';
2import { SxProps } from '@mui/system';
3import { Theme } from '..';
4import { ExtendButtonBase, ExtendButtonBaseTypeMap } from '../ButtonBase';
5import { OverrideProps } from '../OverridableComponent';
6import { TabClasses } from './tabClasses';
7
8export interface TabOwnProps {
9 /**
10 * This prop isn't supported.
11 * Use the `component` prop if you need to change the children structure.
12 */
13 children?: null;
14 /**
15 * Override or extend the styles applied to the component.
16 */
17 classes?: Partial<TabClasses>;
18 /**
19 * If `true`, the component is disabled.
20 * @default false
21 */
22 disabled?: boolean;
23 /**
24 * If `true`, the keyboard focus ripple is disabled.
25 * @default false
26 */
27 disableFocusRipple?: boolean;
28 /**
29 * The icon to display.
30 */
31 icon?: string | React.ReactElement<unknown>;
32 /**
33 * The position of the icon relative to the label.
34 * @default 'top'
35 */
36 iconPosition?: 'top' | 'bottom' | 'start' | 'end';
37 /**
38 * The label element.
39 */
40 label?: React.ReactNode;
41 /**
42 * The system prop that allows defining system overrides as well as additional CSS styles.
43 */
44 sx?: SxProps<Theme>;
45 /**
46 * You can provide your own value. Otherwise, we fallback to the child position index.
47 */
48 value?: any;
49 /**
50 * Tab labels appear in a single row.
51 * They can use a second line if needed.
52 * @default false
53 */
54 wrapped?: boolean;
55}
56
57export type TabTypeMap<
58 AdditionalProps = {},
59 RootComponent extends React.ElementType = 'div',
60> = ExtendButtonBaseTypeMap<{
61 props: AdditionalProps & TabOwnProps;
62 defaultComponent: RootComponent;
63}>;
64
65/**
66 *
67 * Demos:
68 *
69 * - [Tabs](https://mui.com/material-ui/react-tabs/)
70 *
71 * API:
72 *
73 * - [Tab API](https://mui.com/material-ui/api/tab/)
74 * - inherits [ButtonBase API](https://mui.com/material-ui/api/button-base/)
75 */
76declare const Tab: ExtendButtonBase<TabTypeMap>;
77
78export type TabProps<
79 RootComponent extends React.ElementType = TabTypeMap['defaultComponent'],
80 AdditionalProps = {},
81> = OverrideProps<TabTypeMap<AdditionalProps, RootComponent>, RootComponent> & {
82 component?: React.ElementType;
83};
84
85export default Tab;