Skip to content

useTab API

API reference docs for the useTab hook. Learn about the input parameters and other APIs of this exported module.

Demos

For examples and details on the usage of this React hook, visit the demo pages:

Import

import { useTab } from '@mui/base/TabUnstyled';

Parameters

NameTypeDefaultDescription
ref*React.Ref<any>
disabledboolean
onChange(event: React.SyntheticEvent, value: number | string) => void
Callback invoked when new value is being set.
onClickReact.MouseEventHandler
onFocusReact.FocusEventHandler
valuenumber | string
You can provide your own value. Otherwise, we fall back to the child position index.

Return value

NameTypeDefaultDescription
activebooleanfalse
If true, the component will be active.
disabledbooleanfalse
If true, the component will be disabled.
focusVisibleboolean
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.
selectedboolean
If true, the tab will be selected.
setFocusVisibleReact.Dispatch<React.SetStateAction<boolean>>
Callback for setting the focusVisible param.