Skip to main content

Button

Buttons are used primarily for actions, such as "add", "close", "cancel" or "save". They always have a label and optionally contain one icon, before or after the label.

Example

Live Editor
Result
Loading...

Usage Rules

Do:

  • Label the button to explain what it does
  • Keep lables as concise as possible
  • Keep button sequence consistent, for example keeping Cancel/OK in the same order product wide

Don’t:

  • Use multiple Primary buttons in the same segment

Variants

Disabled

Live Editor
Result
Loading...

Feedback

We have 4 feeback variant: info, positive, warning and negative.

Live Editor
Result
Loading...

Every feedback variant has a primary and secondary variants.

Live Editor
Result
Loading...

Highlighted Button

We have a tertiary button variant which can be accessed through isHighlighted prop.

Live Editor
Result
Loading...

Icon

Every button can be rendered with an icon to emphasize an action. All available icons can be found here.

Live Editor
Result
Loading...

Kind

Buttons come in four semantic variants: primary, secondary, tertiary , negative and dark.

Use the Primary Button for the main action option the user will take. Avoid using more than one Primary Button in the same segment. Remember to use buttons in their proper hierarchy of importance. Use the Floating Button for when you need the button to be floating above other elements. Floating Button has a fixed position by default and it's been overwritten in example to relative to be visible in the related section.

Live Editor
Result
Loading...

Loader

Every button can be rendered with a loader to emphasize loading state.

Loader supports all sizes and can be placed on left or right of the Button using iconAlignment prop.

Live Editor
Result
Loading...

Sizes

The Button component is available in three sizes: small, medium and large. Use multiple sizes sparingly to avoid visual clutter.

Live Editor
Result
Loading...

URL Navigation

This can be done by injecting the Link component from react-router-dom to the Button component and passing the required to prop for navigating to a route.

info

The Button is not rendered here because the react-router-dom package is needed for URL naviagtion. This is just an example for how it will be used for URL naviagtion.

import { Link } from 'react-router-dom';

<>
<Button to="/hello-world" as={Link} label="Link button" kind="primary" />
</>;

Props

NameTypeDefault
label *
The label for the button
string
id
Native HTML attribute: Link .
string
type
Native HTML attribute: Link
"button" | "submit" | "reset"
isHighlighted
isHighlighted boolean for Highlighted tertiary button
boolean
size
Size of the button
"small" | "medium" | "large"
onMouseLeave
Native HTML callback: Link
MouseEventHandler<HTMLButtonElement>
onMouseEnter
Native HTML callback: Link
MouseEventHandler<HTMLButtonElement>
onFocus
Native HTML callback: Link
FocusEventHandler<HTMLButtonElement>
onClick
Native HTML callback: Link
MouseEventHandler<HTMLButtonElement>
onBlur
Native HTML callback: Link
FocusEventHandler<HTMLButtonElement>
onKeyDown
Native HTML callback: Link
KeyboardEventHandler<HTMLButtonElement>
kind
Kind of the button
"negative" | "primary" | "secondary" | "tertiary" | "dark" | "floating" | "feedback-info-primary" | ...
iconName
Name of the Icon that is shown next to the label. Refer to the full list here: Link
"AddValue" | "AppGrid" | "ArrowCircleLeft" | "ArrowCircleRight" | "ArrowDown" | "ArrowDownLeft" | "A...
iconAlignment
Whether the icon should appear after or before the label
"left" | "right"
disabled
Use this prop if the component should not be interactive
boolean
aria-pressed
Optional aria-pressed prop for accessibility
AriaPressed
isLoading
Boolean prop to add a loader to the component
boolean
css
Add custom styles to this component. Use with caution. Learn more here: Link
SupportedStyleAttributes
inputFieldCss
SupportedStyleAttributes
as
Root node to use for Button component
ElementType<any>
data-{foo}
Data attributes can be used by testing libraries to retrieve components or assert their existence
string
* - the prop is required.