Skip to content

ButtonBase API

The API documentation of the ButtonBase React component. Learn more about the properties and the CSS customization points.

import ButtonBase from '@material-ui/core/ButtonBase';

ButtonBase contains as few styles as possible. It aims to be a simple building block for creating a button. It contains a load of style reset and some focus/ripple logic.

Props

Name Type Default Description
action union: func |
 object
A ref for imperative actions. It currently only supports focusVisible() action.
buttonRef union: func |
 object
Use that property to pass a ref callback to the native button component.
centerRipple bool false If true, the ripples will be centered. They won't start at the cursor interaction position.
children node The content of the component.
classes object Override or extend the styles applied to the component. See CSS API below for more details.
component element type 'button' The component used for the root node. Either a string to use a DOM element or a component.
⚠️ Needs to be able to hold a ref.
disabled bool If true, the base button will be disabled.
disableRipple bool false If true, the ripple effect will be 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 focusVisibleClassName.
disableTouchRipple bool false If true, the touch ripple effect will be disabled.
focusRipple bool false If true, the base button will have a keyboard focus ripple. disableRipple must also be false.
focusVisibleClassName string This property can help a person know which element has the keyboard focus. The class name will be applied when the element gain the focus through a 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.
onFocusVisible func Callback fired when the component is focused with a keyboard. We trigger a onFocus callback too.
TouchRippleProps object Properties applied to the TouchRipple element.
type enum: 'submit' |
 'reset' |
 'button'
'button' Used to control the button's purpose. This property passes the value to the type attribute of the native button component.

The ref is forwarded to the root element.

Any other properties supplied will be provided to the root element (native element).

CSS

You can override all the class names injected by Material-UI thanks to the classes property. This property accepts the following keys:

Name Description
root Styles applied to the root element.
disabled Pseudo-class applied to the root element if disabled={true}.
focusVisible Pseudo-class applied to the root element if keyboard focused.

Have a look at the overriding styles with classes section and the implementation of the component for more detail.

If using the overrides key of the theme, you need to use the following style sheet name: MuiButtonBase.

Notes

The component is fully StrictMode compatible.

Demos