ToolbarButton API
API reference docs for the React ToolbarButton component. Learn about the props, CSS, and other APIs of this exported module.
Demos
Import
import { ToolbarButton } from '@mui/x-data-grid/components';
// or
import { ToolbarButton } from '@mui/x-data-grid';
// or
import { ToolbarButton } from '@mui/x-data-grid-pro';
// or
import { ToolbarButton } from '@mui/x-data-grid-premium';
Learn about the difference by reading this guide on minimizing bundle size.
A button for performing actions from the toolbar.
It renders the baseIconButton
slot.
A ref for imperative actions. It currently only supports focusVisible()
action.
Type:func
| { current?: { focusVisible: func } }
If true
, the ripples are centered. They won't start at the cursor interaction position.
Type:bool
Default:false
The color of the component. It supports both default and custom theme colors, which can be added as shown in the palette customization guide.
Type:'default'
| 'inherit'
| 'primary'
If true
, the ripple effect is disabled.
⚠️ Without a ripple there is no styling for :focus-visible by default. Be sure to highlight the element by applying separate styles with the .Mui-focusVisible
class.
Type:bool
Default:false
If given, uses a negative margin to counteract the padding on one side (this is often helpful for aligning the left or right side of the icon with content above or below, without ruining the border size and shape).
Type:'end'
| 'start'
| false
This prop can help identify which element has keyboard focus. The class name will be applied when the element gains the focus through keyboard interaction. It's a polyfill for the CSS :focus-visible selector. The rationale for using this feature is explained here. A polyfill can be used to apply a focus-visible
class to other components if needed.
Type:string
The component used to render a link when the href
prop is provided.
Type:elementType
Default:'a'
Callback fired when the component is focused with a keyboard. We trigger a onFocus
callback too.
Type:func
The size of the component. small
is equivalent to the dense button styling.
Type:'large'
| 'medium'
| 'small'
The system prop that allows defining system overrides as well as additional CSS styles.
See the `sx` page for more details.
Type:Array<func
| object
| bool>
| func
| object
ref
is forwarded to the root element.These class names are useful for styling with CSS. They are applied to the component's slots when specific states are triggered.
Styles applied to the root element if color="error"
.
Rule name:colorError
Styles applied to the root element if color="inherit"
.
Rule name:colorInherit
Styles applied to the root element if color="primary"
.
Rule name:colorPrimary
Styles applied to the root element if color="secondary"
.
Rule name:colorSecondary
Styles applied to the root element if color="success"
.
Rule name:colorSuccess
Styles applied to the root element if color="warning"
.
Rule name:colorWarning
Styles applied to the root element if size="medium"
.
Rule name:sizeMedium
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.