Waffle Design System

Button

The Button component is used for any action or to trigger something. Ideally a button would fire a function or complete an action, rather than be used as a link.

Import

Usage

Editable Example

Button Sizes

Use the size prop to change the size of the button. You can set the value to sm, md, or lg. Default value is lg.

Editable Example

Button Variant

Use the variant prop to change the visual style of the Button. You can set the value to solid, link, or unstyled.

Editable Example

Button loading state

Pass isLoading prop to the Button component to show it's loading state. You can optionally pass loadingText prop, if you do, the button will show a spinner and the loading text. Otherwise, the button will take the width of the text label and show only the spinner

Editable Example

Accessibility

  • Button has role button.
  • When Button has focus, Space and Enter activates it.

Composition

Button composes PseudoBox and all props you pass (variant, bg, color, etc.) are converted to style props. This means you can override any style of the Button via props.

Editable Example

Custom Button

In event you need to make your own custom button, you can leverage the PseudoBox component. It provides the hover, focus, active and disabled style props to style the button.

Editable Example

Props

The Button composes the PseudoBox component so you can pass props for PseudoBox. These are props related to the Button component.

NameTypeDefaultDescription
aria-labelstringThe label of the button
variantunstyled , link , solidsolidThe variant of the button style to use.
isDisabledbooleanIf true, the button will be disabled.
isLoadingbooleanIf true, the button will show a spinner.
loadingTextstringThe label to show in the button when isLoading is true. If no text is passed, it only shows the spinner
sizesm, md, lgmdThe size of the button.
Waffle Design SystemBlockstack PBC