ButtonBase

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 func 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 union: string |
 func
The component used for the root node. Either a string to use a DOM element or a component. The default value is a button.
disabled bool If true, the base button will be disabled.
disableRipple bool false If true, the 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 throught a keyboard interaction. It's a polyfill for the CSS :focus-visible feature. The rational for using this feature is explain here.
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.

Any other properties supplied will be spread to the root element.

CSS API

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

  • root
  • disabled
  • focusVisible

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 as documented here, you need to use the following style sheet name: MuiButtonBase.

Demos