Skip to main content

Button

Examples

Rendered as a <button> by default.


Code
<Button>
A button
</Button>

Secondary Button

View standalone

A button but with secondary styling.


Code
<Button variant="textSecondary">
A button
</Button>

Disabled Button

View standalone

Code
<Button disabled>
A button
</Button>

onClick Handler

View standalone

Code
<Button onClick={function noRefCheck() {}}>
Button with onClick
</Button>

An <a> is rendered if a href is specified.


Code
<Button href="/">
Button as anchor
</Button>

The button will take up all available space if block is passed as true.


Code
<Button block>
Block button
</Button>

Code
<Button icon={<ChatIcon />}>
Chat
</Button>

With Icon at End

View standalone

Show an icon at the end after the button contents


Code
<Button
icon={<ChatIcon />}
iconPosition="end"
>
Chat
</Button>

Only show an icon, only use when the icon is very clear by itself and always combine with a label for assistive devices.


Code
<Button
icon={<ChatIcon />}
variant="icon"
>
Chat
</Button>

The button will take up all available space in place of the content if loading is passed as true and disables interaction.


Code
<Flex gap="4px">
<Button
onClick={function noRefCheck() {}}
>
Click me to load something!
</Button>
<Button onClick={function noRefCheck() {}}>
Reset
</Button>
</Flex>

Props

block

boolean

If set to `false` component renders with `width : auto`, otherwise `width : full`.

loading

boolean

If set to `true`, disables the button and shows a `Spinner` component in place of the child content.

variant

"icon" | "text" | "textSecondary"

Default: "text"

icon

ReactNode

iconPosition

"end" | "start"

Default: "start"