fun-button

Buttons trigger actions in the application by being clicked or tapped by the user.

Lorem ipsum
Do

Do use buttons for actions like ‘Edit’, ‘Save’, ‘Run’.

Don't

Do not use links for actions. Links are only for navigation.

Button types

Primary buttons

A “Primary” button should be used for the primary action on a page or dialog.

Secondary buttons

A “Secondary” button should be used for other major actions.

Flat buttons

“Flat” buttons can be used for minor actions instead of “Secondary” buttons, where a secondary button would be too ‘noisy’ or repetitive.

Flat buttons must follow the same rules as secondary buttons.

Quiet buttons

“Quiet” buttons can be used for minor actions instead of “Flat” buttons, for situtations where many buttons would be too noisy, even with flat buttons. Quiet buttons are suitable as icon buttons in lists, for instance.

Quiet buttons must follow the same rules as secondary buttons.

Danger buttons

“Danger” buttons may only be used for confirming a desctructive action.

Read more about confirming destructive actions in the Modals pattern.

Icon buttons

We have no specific type for icon buttons, but they are easy to make with the existing variants. Icons buttons should be used sparingly as they can be difficult for users to understand. A common use is for repetitive actions in lists and tables.

Icon only buttons:

Tooltips

To add a tooltip to a button, add content in the tooltip slot:

Busy and disabled

To prevent clicks on a button use the disabled property.

When a button is clicked, to prevent multiple clicks and indicate that the button action is happening, use the busy property. This also disables the button.

Examples

Specifications

Properties

PropertyAttributeRequiredDescriptionTypeDefault
busybusyfalseIf true disable the button and show that work is being doneboolean
disableddisabledfalseIf true the button cannot be clicked.boolean
hrefhreffalseIf set, the button will render using an ‘a’ element and this hrefstring
sizesizefalseSize of the button"lg" | "md" | "sm"'md'
targettargetfalseOnly relevant if an href is setstring
typetypefalsePassed down to the internal button element. Not relevant if ‘href’ is setstring'button'
variantvariantfalseThe button style variant"danger" | "flat" | "primary" | "quiet" | "secondary"'secondary'

Slots

NameDescription
defaultthe content of the button.
iconWhere the icon should live.
tooltipIf added the button will have a tooltip with this content.

Parts

NameDescription
buttonallows custom styling of the button.
iconallows extra styling of the icon.

Dependencies

Depends on

Used by

This documentation page generated from the source at fun-button.tsx

Search Gunnel

Powered byAlgolia