Tabs
Navigate related panels using native Tabs and Tab controls.
This guide covers Material UI Core with the default Emotion engine; extensions and additional demos are explicitly classified.
Use case and business boundary
Core requires host panel semantics; Lab TabContext/TabList/TabPanel are excluded. Hidden keep-mounted panels can still run effects.
Native composition and scope
Tabs, Tab, TabScrollButton
Preserve native Material UI composition and types; do not substitute JGuang UI/Base UI/Radix APIs. Example entries are not extra components.
Excluded integrations: TabContext (@mui/lab), TabList (@mui/lab), TabPanel (@mui/lab). Not claimed verified in the default Emotion environment.
Native installation and initialization
npm install @mui/material@9.4.0 @emotion/react@11.14.0 @emotion/styled@11.14.1
Use native npm and Emotion, not an invented JGuang UI Registry URL. Place examples inside native ThemeProvider; choose CssBaseline or ScopedCssBaseline for the project. Inspect React, existing providers, lockfile and SSR first. Never overwrite files or conceal peer conflicts. This batch verified React 19.2.8; React 18 and below require matching react-is. See the included bilingual setup guide.
Practical native parameters
These selected parameters are not a flattened universal API. Preserve the native declaring owner, slot structure, nullable values and generics.
| Owner.prop | Practical role | Declaration source |
|---|---|---|
Tabs.value | Controlled native value; its scalar/array/nullable type is owner-specific. | Tabs |
Tabs.onChange | Owning control's native callback; preserve its exact event/value/nullable signature. | Tabs |
Tabs.variant | Owning native presentation enum; never substitute a universal variant prop. | Tabs |
Tabs.selectionFollowsFocus | Activate Tabs on keyboard focus only if panel loading is immediate enough. | Tabs |
Tab.disabled | Native disabled interaction state; not an authorization check. | Tab |
Runnable native examples
Machine keys select example entries, not universal variant props. Native demo JSX/data stay unchanged; JGuang-authored acceptance fixtures are explicitly labelled.
- Introduction ·
BasicTabs· upstream native demo - With standard API ·
KeepMountedStandardTabs· upstream native demo - Wrapped labels ·
TabsWrappedLabel· upstream native demo - Colored tab ·
ColorTabs· upstream native demo - Disabled tab ·
DisabledTabs· upstream native demo - Full width ·
FullWidthTabs· upstream native demo - Centered ·
CenteredTabs· upstream native demo - Automatic scroll buttons ·
ScrollableTabsButtonAuto· upstream native demo - Forced scroll buttons ·
ScrollableTabsButtonForce· upstream native demo - Forced scroll buttons ·
ScrollableTabsButtonVisible· upstream native demo - Prevent scroll buttons ·
ScrollableTabsButtonPrevent· upstream native demo - Customization ·
CustomizedTabs· upstream native demo - Vertical tabs ·
VerticalTabs· upstream native demo - Nav tabs ·
NavTabs· upstream native demo - Icon tabs ·
IconTabs· upstream native demo - Icon tabs ·
IconLabelTabs· upstream native demo - Icon position ·
IconPositionTabs· upstream native demo - Demo ·
AccessibleTabs1· upstream native demo - Demo ·
AccessibleTabs2· upstream native demo
Explicitly unsupported additional examples
These remain in the upstream inventory, not silently skipped or presented as working previews. Additional dependency/framework acceptance is required.
- Experimental API ·
LabTabs:@mui/lab/TabContext,@mui/lab/TabList,@mui/lab/TabPanel - With lab API ·
KeepMountedLabTabs:@mui/lab/TabContext,@mui/lab/TabList,@mui/lab/TabPanel
Actual usage example
Unmodified pinned native demo; copy its required local helper files together.
import * as React from 'react';
import Tabs from '@mui/material/Tabs';
import Tab from '@mui/material/Tab';
import Box from '@mui/material/Box';
interface TabPanelProps {
children?: React.ReactNode;
index: number;
value: number;
}
function CustomTabPanel(props: TabPanelProps) {
const { children, value, index, ...other } = props;
return (
<div
role="tabpanel"
hidden={value !== index}
tabIndex={0}
id={`simple-tabpanel-${index}`}
aria-labelledby={`simple-tab-${index}`}
{...other}
>
{value === index && <Box sx={{ p: 3 }}>{children}</Box>}
</div>
);
}
function a11yProps(index: number) {
return {
id: `simple-tab-${index}`,
'aria-controls': `simple-tabpanel-${index}`,
};
}
export default function BasicTabs() {
const [value, setValue] = React.useState(0);
const handleChange = (event: React.SyntheticEvent, newValue: number) => {
setValue(newValue);
};
return (
<Box sx={{ width: '100%' }}>
<Box sx={{ borderBottom: 1, borderColor: 'divider' }}>
<Tabs value={value} onChange={handleChange} aria-label="basic tabs example">
<Tab label="Item One" {...a11yProps(0)} />
<Tab label="Item Two" {...a11yProps(1)} />
<Tab label="Item Three" {...a11yProps(2)} />
</Tabs>
</Box>
<CustomTabPanel value={value} index={0}>
Item One
</CustomTabPanel>
<CustomTabPanel value={value} index={1}>
Item Two
</CustomTabPanel>
<CustomTabPanel value={value} index={2}>
Item Three
</CustomTabPanel>
</Box>
);
}
Example dependency boundaries
react, @mui/material/Tabs, @mui/material/Tab, @mui/material/Box, @mui/material/TextField, @mui/material/styles, @mui/material/AppBar, @mui/material/Typography, @mui/icons-material/Phone, @mui/icons-material/Favorite, @mui/icons-material/PersonPin, @mui/icons-material/PhoneMissed
Direct Icons/System/Utils example imports require their matching 9.4.0 packages. Relative data/helpers are part of the example closure, not extra components. Remote images and simulated operations do not supply a backend.
Pinned upstream API metadata reference
These tables retain the upstream metadata, not a newly inferred generic type system. Conditional generics, inherited props and callback details are defined by the source declarations below. Theme defaults may override metadata defaults.
Tabs
import Tabs from '@mui/material/Tabs';
import { Tabs } from '@mui/material';
| Prop | Required | Upstream metadata type / constraint | Metadata default |
|---|---|---|---|
action | no | ref | — |
allowScrollButtonsMobile | no | bool | false |
aria-label | no | string | — |
aria-labelledby | no | string | — |
centered | no | bool | false |
children | no | node | — |
classes | no | object | — |
component | no | elementType | — |
indicatorColor | no | 'primary' | 'secondary' | string | 'primary' |
onChange | no | func | — |
orientation | no | 'horizontal' | 'vertical' | 'horizontal' |
scrollButtons | no | 'auto' | false | true | 'auto' |
selectionFollowsFocus | no | bool | — |
slotProps | no | { endScrollButtonIcon?: func | object, indicator?: func | object, list?: func | object, root?: func | object, scrollbar?: func | object, scrollButtons?: func | object, scroller?: func | object, startScrollButtonIcon?: func | object } | {} |
slots | no | { endScrollButtonIcon?: elementType, indicator?: elementType, list?: elementType, root?: elementType, scrollbar?: elementType, scrollButtons?: elementType, scroller?: elementType, startScrollButtonIcon?: elementType } | {} |
sx | no | Array<func | object | bool> | func | object | — |
textColor | no | 'inherit' | 'primary' | 'secondary' | 'primary' |
value | no | any | — |
variant | no | 'fullWidth' | 'scrollable' | 'standard' | 'standard' |
visibleScrollbar | no | bool | false |
Tab
import Tab from '@mui/material/Tab';
import { Tab } from '@mui/material';
Native inheritance: ButtonBase. Parent/DOM props are not fabricated as additional own props.
| Prop | Required | Upstream metadata type / constraint | Metadata default |
|---|---|---|---|
children | no | unsupportedProp | — |
classes | no | object | — |
disabled | no | bool | false |
disableFocusRipple | no | bool | false |
disableRipple | no | bool | false |
icon | no | element | string | — |
iconPosition | no | 'bottom' | 'end' | 'start' | 'top' | 'top' |
label | no | node | — |
sx | no | Array<func | object | bool> | func | object | — |
value | no | any | — |
wrapped | no | bool | false |
TabScrollButton
import TabScrollButton from '@mui/material/TabScrollButton';
import { TabScrollButton } from '@mui/material';
| Prop | Required | Upstream metadata type / constraint | Metadata default |
|---|---|---|---|
direction | yes | 'left' | 'right' | — |
orientation | yes | 'horizontal' | 'vertical' | — |
children | no | node | — |
classes | no | object | — |
disabled | no | bool | false |
slotProps | no | { endScrollButtonIcon?: func | object, startScrollButtonIcon?: func | object } | {} |
slots | no | { EndScrollButtonIcon?: elementType, StartScrollButtonIcon?: elementType } | {} |
sx | no | Array<func | object | bool> | func | object | — |
Native source declarations
Declarations/imports are extracted from pinned source without flattening unions or external inheritance. Original English comments/types are source reference, not a claim of translated upstream prose. Shared types stay in their native packages.
vendor/src/Tabs/Tabs.d.ts
import * as React from 'react';
import { SxProps } from '@mui/system';
import { OverridableStringUnion } from '@mui/types';
import { CreateSlotsAndSlotProps, SlotProps } from '../utils/types';
import { Theme } from '../styles';
import TabScrollButton from '../TabScrollButton';
import { OverridableComponent, OverrideProps } from '../OverridableComponent';
import { TabsClasses } from './tabsClasses';
import SvgIcon from '../SvgIcon';
export interface TabsPropsIndicatorColorOverrides {}
export interface TabsPropsVariantOverrides {}
export interface TabsRootSlotPropsOverrides {}
export interface TabsScrollerSlotPropsOverrides {}
export interface TabsListSlotPropsOverrides {}
export interface TabsScrollbarSlotPropsOverrides {}
export interface TabsIndicatorSlotPropsOverrides {}
export interface TabsScrollButtonsSlotPropsOverrides {}
export interface TabsStartScrollButtonIconSlotPropsOverrides {}
export interface TabsEndScrollButtonIconSlotPropsOverrides {}
export interface TabsSlots {
/**
* The component used for the popper.
* @default div
*/
root: React.ElementType;
/**
* The component used for the scroller.
* @default div
*/
scroller: React.ElementType;
/**
* The component used for the flex container.
* @default div
*/
list: React.ElementType;
/**
* The component used for the scroller.
* @default ScrollbarSize
*/
scrollbar: React.ElementType;
/**
* The component used for the tab indicator.
* @default span
*/
indicator: React.ElementType;
/**
* The component used for the scroll button.
* @default TabScrollButton
*/
scrollButtons: React.ElementType;
/**
* The component used for the start scroll button icon.
* @default KeyboardArrowLeft
*/
startScrollButtonIcon: React.ElementType;
/**
* The component used for the end scroll button icon.
* @default KeyboardArrowRight
*/
endScrollButtonIcon: React.ElementType;
}
export type TabsSlotsAndSlotProps = CreateSlotsAndSlotProps<
TabsSlots,
{
/**
* Props forwarded to the root slot.
* By default, the available props are based on the div element.
*/
root: SlotProps<'div', TabsRootSlotPropsOverrides, TabsOwnerState>;
/**
* Props forwarded to the scroller slot.
* By default, the available props are based on the div element.
*/
scroller: SlotProps<'div', TabsScrollerSlotPropsOverrides, TabsOwnerState>;
/**
* Props forwarded to the list slot.
* By default, the available props are based on the div element.
*/
list: SlotProps<'div', TabsListSlotPropsOverrides, TabsOwnerState>;
/**
* Props forwarded to the scrollbar slot.
* By default, the available props are based on the div element.
*/
scrollbar: SlotProps<
'div',
{
onChange?: ((scrollbarWidth: undefined | number) => void) | undefined;
} & TabsScrollbarSlotPropsOverrides,
TabsOwnerState
>;
/**
* Props forwarded to the indicator slot.
* By default, the available props are based on the span element.
*/
indicator: SlotProps<'span', TabsIndicatorSlotPropsOverrides, TabsOwnerState>;
/**
* Props forwarded to the scrollButtons slot.
* By default, the available props are based on the [TabScrollButton](https://mui.com/material-ui/api/tab-scroll-button/#props) component.
*/
scrollButtons: SlotProps<
typeof TabScrollButton,
TabsScrollButtonsSlotPropsOverrides,
TabsOwnerState
>;
/**
* Props forwarded to the startScrollButtonIcon slot.
* By default, the available props are based on the [SvgIcon](https://mui.com/material-ui/api/svg-icon/#props) component.
*/
startScrollButtonIcon: SlotProps<
typeof SvgIcon,
TabsStartScrollButtonIconSlotPropsOverrides,
TabsOwnerState
>;
/**
* Props forwarded to the endScrollButtonIcon slot.
* By default, the available props are based on the [SvgIcon](https://mui.com/material-ui/api/svg-icon/#props) component.
*/
endScrollButtonIcon: SlotProps<
typeof SvgIcon,
TabsEndScrollButtonIconSlotPropsOverrides,
TabsOwnerState
>;
}
>;
export interface TabsOwnerState extends Omit<TabsProps, 'slots' | 'slotProps'> {
vertical: boolean;
fixed: boolean;
hideScrollbar: boolean;
scrollableX: boolean;
scrollableY: boolean;
centered: boolean;
scrollButtonsHideMobile: boolean;
}
export interface TabsOwnProps extends TabsSlotsAndSlotProps {
/**
* Callback fired when the component mounts.
* This is useful when you want to trigger an action programmatically.
* It supports two actions: `updateIndicator()` and `updateScrollButtons()`
*
* @param {object} actions This object contains all possible actions
* that can be triggered programmatically.
*/
action?: React.Ref<TabsActions> | undefined;
/**
* If `true`, the scroll buttons aren't forced hidden on mobile.
* By default the scroll buttons are hidden on mobile and takes precedence over `scrollButtons`.
* @default false
*/
allowScrollButtonsMobile?: boolean | undefined;
/**
* The label for the Tabs as a string.
*/
'aria-label'?: string | undefined;
/**
* An id or list of ids separated by a space that label the Tabs.
*/
'aria-labelledby'?: string | undefined;
/**
* If `true`, the tabs are centered.
* This prop is intended for large views.
* @default false
*/
centered?: boolean | undefined;
/**
* The content of the component.
*/
children?: React.ReactNode;
/**
* Override or extend the styles applied to the component.
*/
classes?: Partial<TabsClasses> | undefined;
/**
* Determines the color of the indicator.
* @default 'primary'
*/
indicatorColor?:
OverridableStringUnion<'secondary' | 'primary', TabsPropsIndicatorColorOverrides> | undefined;
/**
* Callback fired when the value changes.
*
* @param {React.SyntheticEvent} event The event source of the callback. **Warning**: This is a generic event not a change event.
* @param {any} value We default to the index of the child (number)
*/
onChange?: ((event: React.SyntheticEvent, value: any) => void) | undefined;
/**
* The component orientation (layout flow direction).
* @default 'horizontal'
*/
orientation?: 'horizontal' | 'vertical' | undefined;
/**
* Determine behavior of scroll buttons when tabs are set to scroll:
*
* - `auto` will only present them when not all the items are visible.
* - `true` will always present them.
* - `false` will never present them.
*
* By default the scroll buttons are hidden on mobile.
* This behavior can be disabled with `allowScrollButtonsMobile`.
* @default 'auto'
*/
scrollButtons?: 'auto' | true | false | undefined;
/**
* If `true` the selected tab changes on focus. Otherwise it only
* changes on activation.
*/
selectionFollowsFocus?: boolean | undefined;
/**
* Determines the color of the `Tab`.
* @default 'primary'
*/
textColor?: 'secondary' | 'primary' | 'inherit' | undefined;
/**
* The value of the currently selected `Tab`.
* If you don't want any selected `Tab`, you can set this prop to `false`.
*/
value?: any;
/**
* Determines additional display behavior of the tabs:
*
* - `scrollable` will invoke scrolling properties and allow for horizontally
* scrolling (or swiping) of the tab bar.
* - `fullWidth` will make the tabs grow to use all the available space,
* which should be used for small views, like on mobile.
* - `standard` will render the default state.
* @default 'standard'
*/
variant?:
| OverridableStringUnion<'standard' | 'scrollable' | 'fullWidth', TabsPropsVariantOverrides>
| undefined;
/**
* If `true`, the scrollbar is visible. It can be useful when displaying
* a long vertical list of tabs.
* @default false
*/
visibleScrollbar?: boolean | undefined;
/**
* The system prop that allows defining system overrides as well as additional CSS styles.
*/
sx?: SxProps<Theme> | undefined;
}
export interface TabsTypeMap<
AdditionalProps = {},
RootComponent extends React.ElementType = 'div',
> {
props: AdditionalProps & TabsOwnProps;
defaultComponent: RootComponent;
}
declare const Tabs: OverridableComponent<TabsTypeMap>;
export interface TabsActions {
updateIndicator(): void;
updateScrollButtons(): void;
}
export type TabsProps<
RootComponent extends React.ElementType = TabsTypeMap['defaultComponent'],
AdditionalProps = {},
> = OverrideProps<TabsTypeMap<AdditionalProps, RootComponent>, RootComponent> & {
component?: React.ElementType | undefined;
};
vendor/src/Tab/Tab.d.ts
import * as React from 'react';
import { SxProps } from '@mui/system';
import { Theme } from '../styles';
import { ExtendButtonBase, ExtendButtonBaseTypeMap } from '../ButtonBase';
import { OverrideProps } from '../OverridableComponent';
import { TabClasses } from './tabClasses';
export interface TabOwnProps {
/**
* This prop isn't supported.
* Use the `component` prop if you need to change the children structure.
*/
children?: null | undefined;
/**
* Override or extend the styles applied to the component.
*/
classes?: Partial<TabClasses> | undefined;
/**
* If `true`, the component is disabled.
* @default false
*/
disabled?: boolean | undefined;
/**
* If `true`, the keyboard focus ripple is disabled.
* @default false
*/
disableFocusRipple?: boolean | undefined;
/**
* The icon to display.
*/
icon?: string | React.ReactElement<unknown> | undefined;
/**
* The position of the icon relative to the label.
* @default 'top'
*/
iconPosition?: 'top' | 'bottom' | 'start' | 'end' | undefined;
/**
* The label element.
*/
label?: React.ReactNode;
/**
* The system prop that allows defining system overrides as well as additional CSS styles.
*/
sx?: SxProps<Theme> | undefined;
/**
* You can provide your own value. Otherwise, we fallback to the child position index.
*/
value?: any;
/**
* Tab labels appear in a single row.
* They can use a second line if needed.
* @default false
*/
wrapped?: boolean | undefined;
}
export type TabTypeMap<
AdditionalProps = {},
RootComponent extends React.ElementType = 'div',
> = ExtendButtonBaseTypeMap<{
props: AdditionalProps & TabOwnProps;
defaultComponent: RootComponent;
}>;
declare const Tab: ExtendButtonBase<TabTypeMap>;
export type TabProps<
RootComponent extends React.ElementType = TabTypeMap['defaultComponent'],
AdditionalProps = {},
> = OverrideProps<TabTypeMap<AdditionalProps, RootComponent>, RootComponent> & {
component?: React.ElementType | undefined;
};
vendor/src/TabScrollButton/TabScrollButton.d.ts
import * as React from 'react';
import { SxProps } from '@mui/system';
import { SlotComponentProps } from '../utils/types';
import { ButtonBaseProps } from '../ButtonBase';
import { Theme } from '../styles';
import SvgIcon from '../SvgIcon';
import { TabScrollButtonClasses } from './tabScrollButtonClasses';
export interface TabScrollButtonStartIconSlotPropsOverrides {}
export interface TabScrollButtonEndIconSlotPropsOverrides {}
export interface TabScrollButtonOwnerState extends TabScrollButtonProps {
isRtl: boolean;
}
export interface TabScrollButtonProps extends Omit<ButtonBaseProps, 'nativeButton'> {
/**
* The content of the component.
*/
children?: React.ReactNode;
/**
* Override or extend the styles applied to the component.
*/
classes?: Partial<TabScrollButtonClasses> | undefined;
/**
* The components used for each slot inside.
* @default {}
*/
slots?:
| {
StartScrollButtonIcon?: React.ElementType | undefined;
EndScrollButtonIcon?: React.ElementType | undefined;
}
| undefined;
/**
* The extra props for the slot components.
* You can override the existing props or add new ones.
* @default {}
*/
slotProps?:
| {
startScrollButtonIcon?:
| SlotComponentProps<
typeof SvgIcon,
TabScrollButtonStartIconSlotPropsOverrides,
TabScrollButtonOwnerState
>
| undefined;
endScrollButtonIcon?:
| SlotComponentProps<
typeof SvgIcon,
TabScrollButtonEndIconSlotPropsOverrides,
TabScrollButtonOwnerState
>
| undefined;
}
| undefined;
/**
* The direction the button should indicate.
*/
direction: 'left' | 'right';
/**
* If `true`, the component is disabled.
* @default false
*/
disabled?: boolean | undefined;
/**
* The component orientation (layout flow direction).
*/
orientation: 'horizontal' | 'vertical';
/**
* The system prop that allows defining system overrides as well as additional CSS styles.
*/
sx?: SxProps<Theme> | undefined;
}
export default function TabScrollButton(props: TabScrollButtonProps): React.JSX.Element;
Post-install acceptance
Run strict types, production build and real interactions. Check keyboard labels/focus, disabled/error/read-only semantics where natively supported, both themes, narrow screens and reduced motion. Verify callbacks against the real host data; do not declare installation complete from copying a prompt. Initialization fixtures also require server HTML and warning-free hydration.
Source and license
https://github.com/mui/material-ui/tree/809a7717b4c050ba3f69b75300689f07c050a16e
MIT · @mui/material@9.4.0. Vendor originals and license are preserved. Full original upstream prose remains in vendor/docs and is not represented as fully translated.