Buttons

Buttons allow users to take action and make choices with a single click

Usage

import Button, { ButtonGroup } from '../../../ui/button'

Types

Other than the standard solid, a button may have the type outline or transparent. They may also be included as children of the <ButtonGroup />. You will typically give the <Button /> children of a <ButtonGroup /> the outline prop, though it is not required.

  • Solid buttons are high emphasis, they have a color fill and shadow.
  • Outline buttons are medium emphasis, they have a 1px stroke.
  • Transparent buttons are low emphasis, they are typically used for tertiary actions.
  • Button groups are typically used to group a set of related actions.

Sizes

Other than the standard size, buttons may be small or large.

  • Use small buttons in tables and when space is at a premium.
  • Use large buttons when the typography and white space in the layout requires greater button emphasis.

Colors

Colors aren't well-supported yet. For now you'll need to override the styles as explained below. Make sure to override the colors for the normal, :hover, and :disabled states.

Overriding Styles + Additional Props

The <Button /> component is a styled-component underneath. This means that any props you pass in will be forwarded to the underlying DOM <button/>. You can override styles either by using the style or className prop, or wrapping it with styled from styled-components.

<Button style={{ padding: 50 }}>Button</Button>
<Button className="p-50">Button</Button>
import styled from 'styled-components'
const MyButton = styled(Button)`
padding: 50px;
`

Testing

Because this component outputs a single <button /> element to the DOM, you can treat this component as if it were just a native DOM button when running tests.