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 | func | Callback fired when the component mounts. This is useful when you want to trigger an action programmatically. It currently only supports focusVisible() action.Signature: function(actions: object) => void actions: This object contains all possible actions that can be triggered programmatically. |
|
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 | Component | 'button' | The component used for the root node. Either a string to use a DOM element or a component. |
disabled | bool | If true , the base button will be disabled. |
|
disableRipple | bool | false | If true , the ripple effect will be disabled. |
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 | string | 'button' | Used to control the button's purpose. This property passes the value to the type attribute of the native button component. Valid property values include button , submit , and reset . |
Any other properties supplied will be spread 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 | Styles applied to the root element if disabled={true} . |
focusVisible | Styles applied to the root element if keyboard focused. |
Have a look at overriding 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
.