Tabs API
API reference docs for the React Tabs component. Learn about the props, CSS, and other APIs of this exported module.
Demos
Import
import Tabs from '@mui/material/Tabs';
// or
import { Tabs } from '@mui/material';
Learn about the difference by reading this guide on minimizing bundle size.
Props of the native component are also available.
Name | Type | Default | Description |
---|---|---|---|
action | ref | - | Callback fired when the component mounts. This is useful when you want to trigger an action programmatically. It supports two actions: |
allowScrollButtonsMobile | bool | false | If |
aria-label | string | - | The label for the Tabs as a string. |
aria-labelledby | string | - | An id or list of ids separated by a space that label the Tabs. |
centered | bool | false | If |
children | node | - | The content of the component. |
classes | object | - | Override or extend the styles applied to the component. See CSS classes API below for more details. |
component | elementType | - | The component used for the root node. Either a string to use a HTML element or a component. |
indicatorColor | 'primary' | 'secondary' | string | 'primary' | Determines the color of the indicator. |
onChange | func | - | Callback fired when the value changes. Signature: function(event: React.SyntheticEvent, value: any) => void
|
orientation | 'horizontal' | 'vertical' | 'horizontal' | The component orientation (layout flow direction). |
ScrollButtonComponent | elementType | TabScrollButton | The component used to render the scroll buttons. |
scrollButtons | 'auto' | false | true | 'auto' | Determine behavior of scroll buttons when tabs are set to scroll:
By default the scroll buttons are hidden on mobile.
This behavior can be disabled with |
selectionFollowsFocus | bool | - | If |
slotProps | { endScrollButtonIcon?: func | object, startScrollButtonIcon?: func | object } | {} | The extra props for the slot components. You can override the existing props or add new ones. |
slots | { EndScrollButtonIcon?: elementType, StartScrollButtonIcon?: elementType } | {} | The components used for each slot inside. |
sx | Array<func | object | bool> | func | object | - | The system prop that allows defining system overrides as well as additional CSS styles. See the `sx` page for more details. |
TabIndicatorProps | object | {} | Props applied to the tab indicator element. |
TabScrollButtonProps | object | {} | Props applied to the |
textColor | 'inherit' | 'primary' | 'secondary' | 'primary' | Determines the color of the |
value | any | - | The value of the currently selected |
variant | 'fullWidth' | 'scrollable' | 'standard' | 'standard' | Determines additional display behavior of the tabs:
|
visibleScrollbar | bool | false | If |
ref
is forwarded to the root element.Theme default props
You can use MuiTabs
to change the default props of this component with the theme.
These class names are useful for styling with CSS. They are applied to the component's slots when specific states are triggered.
Class name | Rule name | Description |
---|---|---|
.MuiTabs-centered | centered | Styles applied to the flex container element if centered={true} & !variant="scrollable" . |
.MuiTabs-fixed | fixed | Styles applied to the tablist element if !variant="scrollable" . |
.MuiTabs-flexContainer | flexContainer | Styles applied to the flex container element. |
.MuiTabs-flexContainerVertical | flexContainerVertical | Styles applied to the flex container element if orientation="vertical" . |
.MuiTabs-hideScrollbar | hideScrollbar | Styles applied to the tablist element if variant="scrollable" and visibleScrollbar={false} . |
.MuiTabs-indicator | indicator | Styles applied to the TabIndicator component. |
.MuiTabs-root | root | Styles applied to the root element. |
.MuiTabs-scrollableX | scrollableX | Styles applied to the tablist element if variant="scrollable" and orientation="horizontal" . |
.MuiTabs-scrollableY | scrollableY | Styles applied to the tablist element if variant="scrollable" and orientation="vertical" . |
.MuiTabs-scrollButtons | scrollButtons | Styles applied to the ScrollButtonComponent component. |
.MuiTabs-scrollButtonsHideMobile | scrollButtonsHideMobile | Styles applied to the ScrollButtonComponent component if allowScrollButtonsMobile={true} . |
.MuiTabs-scroller | scroller | Styles applied to the tablist element. |
.MuiTabs-vertical | vertical | Styles applied to the root element if orientation="vertical" . |
You can override the style of the component using one of these customization options:
- With a global class name.
- With a rule name as part of the component's
styleOverrides
property in a custom theme.
Source code
If you did not find the information in this page, consider having a look at the implementation of the component for more detail.