useBadge API
Demos
For examples and details on the usage of this React hook, visit the demo pages:
Import
import useBadge from '@mui/base/useBadge';
Parameters
Name | Type | Default | Description |
---|---|---|---|
badgeContent | React.ReactNode | The content rendered within the badge. | |
invisible | boolean | false | If true , the badge is invisible. |
max | number | 99 | Max count to show. |
showZero | boolean | false | Controls whether the badge is hidden when badgeContent is zero. |
Return value
Name | Type | Default | Description |
---|---|---|---|
badgeContent | React.ReactNode | Defines the content that's displayed inside the badge. | |
displayValue | React.ReactNode | badgeContent | Value to be displayed in the badge. If badgeContent is greater than max , it will return max+ . |
invisible | boolean | false | If true , the component will not be visible. |
max | number | 99 | Maximum number to be displayed in the badge. |