useTab API
Demos
For examples and details on the usage of this React hook, visit the demo pages:
Import
import useTab from '@mui/base/useTab';Parameters
| Name | Type | Default | Description |
|---|---|---|---|
| ref* | React.Ref<any> | ||
| disabled | boolean | ||
| onChange | (event: React.SyntheticEvent, value: number | string) => void | Callback invoked when new value is being set. | |
| onClick | React.MouseEventHandler | ||
| onFocus | React.FocusEventHandler | ||
| value | number | string | You can provide your own value. Otherwise, we fall back to the child position index. |
Return value
| Name | Type | Default | Description |
|---|---|---|---|
| active | boolean | false | If true, the component will be active. |
| disabled | boolean | false | If true, the component will be disabled. |
| focusVisible | boolean | If true, the tab's focus will be visible. | |
| getRootProps | <TOther extends Record<string, any> = {}>(externalProps?: TOther) => UseTabRootSlotProps<TOther> | Resolver for the root slot's props. | |
| selected | boolean | If true, the tab will be selected. | |
| setFocusVisible | React.Dispatch<React.SetStateAction<boolean>> | Callback for setting the focusVisible param. |