G
Tokens
TypographySpacingColorRadiusShadowMotion

Button

Variants


    <Arrange gap="s">
      <Button variant="accent">Accent</Button>
      <Button variant="danger">Danger</Button>
      <Button variant="neutral">Neutral</Button>
    </Arrange>
  

Icon


    <Arrange gap="s">
      <Button icon={<IconDuplicate />} variant="accent">Button</Button>
      <Button icon={<IconDuplicate />} variant="danger">Button</Button>
      <Button icon={<IconDuplicate />}>Button</Button>
    </Arrange>
  

Icon position


    <Arrange gap="s">
      <Button icon={<IconArrowLeft />} iconPosition="left">Button</Button>
      <Button icon={<IconArrowRight />} iconPosition="right">Button</Button>
    </Arrange>
  

Click


    <Button onClick={() => alert('Nice')}>Click me</Button>
  

Full width


    <Box maxWidth={40}>
      <Button hasFullWidth>Button</Button>
    </Box>
  

Disabled


    <Arrange gap="s">
      <Button icon={<IconArrowLeft />} iconPosition="left" isDisabled>Button</Button>
      <Button icon={<IconArrowRight />} iconPosition="right">Button</Button>
    </Arrange>
  

With spinner

Disable the Button when it has a spinner.


    () => {
      const [hasSpinner, setHasSpinner] = React.useState(false)
      return (
        <>
          <Button
            icon={<IconDownload />}
            hasSpinner={hasSpinner}
            isDisabled={hasSpinner}
            onClick={() => {
              setHasSpinner(true)
              setTimeout(() => setHasSpinner(false), 2000)
            }}
          >
            Download
          </Button>
        </>
      )
    }
  

Tag


    <Stack gap="s">
      <Button onClick={() => console.log('clicked')}>render "button"</Button>
      <Button tag="a" href="https://flodesk.com" target="_blank">render "a"</Button>
      <Button tag="span">render "span"</Button>
    </Stack>
  

Props

Name
Type
Default
variant
oneOf
'neutral' 'accent' 'danger'
'neutral'
iconPosition
oneOf
'left' 'right'
'left'
type
oneOf
'button' 'submit' 'reset'
'button'
tag
oneOf
'button' 'a' 'span'
'button'
children
node
icon
node
onClick
func
isDisabled
bool
hasFullWidth
bool
hasSpinner
bool