UNPKG

1.96 kBTypeScriptView Raw
1import * as React from 'react';
2import { Simplify } from '@mui/types';
3import { UseTabPanelRootSlotProps } from '../useTabPanel';
4import { PolymorphicProps, SlotComponentProps } from '../utils';
5export interface TabPanelRootSlotPropsOverrides {
6}
7export interface TabPanelOwnProps {
8 /**
9 * The content of the component.
10 */
11 children?: React.ReactNode;
12 className?: string;
13 /**
14 * The value of the TabPanel. It will be shown when the Tab with the corresponding value is selected.
15 * If not provided, it will fall back to the index of the panel.
16 * It is recommended to explicitly provide it, as it's required for the tab panel to be rendered on the server.
17 */
18 value?: number | string;
19 /**
20 * The components used for each slot inside the TabPanel.
21 * Either a string to use a HTML element or a component.
22 * @default {}
23 */
24 slots?: TabPanelSlots;
25 /**
26 * The props used for each slot inside the TabPanel.
27 * @default {}
28 */
29 slotProps?: {
30 root?: SlotComponentProps<'div', TabPanelRootSlotPropsOverrides, TabPanelOwnerState>;
31 };
32}
33export interface TabPanelSlots {
34 /**
35 * The component that renders the root.
36 * @default 'div'
37 */
38 root?: React.ElementType;
39}
40export interface TabPanelTypeMap<AdditionalProps = {}, RootComponentType extends React.ElementType = 'div'> {
41 props: TabPanelOwnProps & AdditionalProps;
42 defaultComponent: RootComponentType;
43}
44export type TabPanelProps<RootComponentType extends React.ElementType = TabPanelTypeMap['defaultComponent']> = PolymorphicProps<TabPanelTypeMap<{}, RootComponentType>, RootComponentType>;
45export type TabPanelOwnerState = Simplify<TabPanelOwnProps & {
46 hidden: boolean;
47}>;
48export type TabPanelRootSlotProps = UseTabPanelRootSlotProps & {
49 children?: React.ReactNode;
50 className?: string;
51 ownerState: TabPanelOwnerState;
52 ref: React.Ref<any>;
53 role: React.AriaRole;
54};