Button
For click events
Introduction
We have 3 variants of buttons in Bifrost, with 5 different states. Buttons are one of the most essential UI components and is typically labeled with text, icon or just an icon. They are used to trigger actions and navigate users through an application. Because of this, it's important to use them consistently. Bifrost buttons support color themes and color mode.
Hierarchy
Our buttons have a visual hierarchy to help users understand the importance of each action. The hierarchy is based on the button variant and state.
Primary button with solid background color with contrasting text color. Use it for primary actions or call-to-actions, as the filled button variant stand out and signals importance.
Themed or neutral?
In general, use themed filled buttons. We know there are some issues that neutral is "more neutral" in some themes, but more "emphasized" in other themes. We are looking into a better explaination of when neutral filled is OK to use.
Button variants
Filled
Primary button with solid background color with contrasting text color. Use it for primary actions or call-to-actions, as the filled button variant stand out and signals importance.
Avoid using the primary button more than once on a page or area
Basic (default)
Secondary button with no fill, just a border and text. Use it for secondary or less prominent actions. They're great for when you want to offer an alternative without drawing too much attention.
Flat
Tertiary button with no fill, only a label. Use it for less prominent actions. They're great for when you want to offer an alternative to basic button without drawing too much attention.
Button states
Default
The default button state uses theme colors, and indicate that the button is enabled and can be interacted with.
Alert
Alert state buttons should be used for actions that are potentially destructive or irreversible, such as deleting an item or revoking access.
Flat
Use for less destructive actions, where the user can easily revert or undo, or when the action won't happen instantly after the button has been pressed by the user.
Example: A confirmation dialog appears before deleting, or the user has to view a summary before the destructive action is completed.
Basic
Much alike the flat alert button, this button should be used for less destructive actions. Use it for destructive actions that require more caution than flat alert button, or it is the first step in order to perform a major destructive action.
Example: Use to trigger a confirmation dialog before deleting a user, revoking access to resources or discarding an article draft.
Filled
Use for the most critical, destructive actions, where the desctructive action will happen instantly. This button should always stand out and be used sparingly.
Example: Use it for user/account deletion, delete all data or similar actions that are irreversible and/or have major consequences.
Examples
To clarify the different alert button states and variants here are some examples:
Use clear, descriptive labels and/or icons that clearly communicate destructive actions. When using only an icon, you can use a tooltip to confirm for the user what the button will do when it has been pressed.
Don't use any alert button with only an icon, where the icons don't communicate destructive actions in a clear matter.
Inactive
Use in flows where the user have to do something before the button becomes enabled. It's muted and gray design signals that the button is currently inactive. Inactive buttons should not be confused with disabled buttons, as inactive can be interacted with and be read by screen readers, while disabled buttons cannot.
Example: A form must be filled out before the user can send a request.
Examples
Inactive buttons should be paired with the variant they will be used as when enabled.
Use filled inactive variant when paired with filled buttons. Give the user some indication of why the button is inactive, for example with a tooltip, or with a message.
Don't mix pairings of inactive and enabled button variants, as buttons should maintain their visual hierarchy.
Neutral
Neutral buttons is an alternative to default themed buttons. For UIs with a lot of color, neutral buttons can help reduce visual noise and make the interface feel more balanced.
Filled
Neutral filled button can be used when the UI is either oversaturated with color, or when the button is not the primary action on the page, but still important enough to be a filled button. It should not act as a replacement for filled theme buttons.
Example: A page where you already have a filled theme button on top of the page, but you still want to use a filled button for a secondary action further down the page.
When you have a primary action button, but want to offer an alternative action that is still important, use the filled neutral button variant.
Don't use neutral filled button variant mixed with themed flat or basic button variants, as buttons should maintain their visual hierarchy.
Basic
Neutral basic button can be used when you don't want the button to stand out as much as a themed basic button, but still want it to be prominent.
Example: An edit button in a table, where the button should be visible in every row.
Flat
Neutral flat button can be used when you want a button with less visual weight than a themed flat button, and when the action i neutral or less important.
Example: Can be used as an icon-only button in toolbars/action menus
Inverted
Inverted buttons is an alternative to default themed or neutral buttons, where the button is placed on a high contrasting background, like bfc-neutral.
Filled
Inverted button is an alternative to default themed filled button, where the button is placed on a high contrasting background, like bfc-neutral or bfc-theme.
Example: An emphasized area with high contrasting background, where themed button wouldn't have enough contrast.
Basic
Inverted basic button is an alternative to default themed basic button, where the button is placed on a high contrasting background, like bfc-neutral or bfc-theme.
Example: An emphasized area with high contrasting background, where themed button wouldn't have enough contrast.
Flat
Inverted flat button is an alternative to default themed basic button, where the button is placed on a high contrasting background, like bfc-neutral or bfc-theme.
Example: An emphasized area with high contrasting background, where themed button wouldn't have enough contrast.
Disabled
Disabled buttons should be used when an action is not available to the user. Disabled buttons cannot be interacted with and are not read by screen readers. You should in general avoid using disabled buttons because of accessibility issues, and instead use inactive buttons when possible.
Loading state
When a button is clicked, and an action is being performed, the button can be set to inactive state to prevent multiple clicks. You can also show a spinner to indicate that something is happening. Only use if you excpect the action to use more than 2-3 seconds.
Example: Themed buttons with icon, swaps to inactive state when clicked/pressed.
Spinner and tooltip
When a button only has an icon, you should use a tooltip to label the button. You should exchange the icon with a spinner icon. You can change the tooltip text for when the button has been pressed.
Example: Icon-only themed buttons, swaps to inactive state when clicked/pressed and offers tooltip with different content for inactive/enabled button.
Spinner and custom inactive label
You can also change the button label when the button is in inactive state and showing a spinner. Be aware that changing the label might cause layout shifts if the new label is longer or shorter than the original label.
Example: Buttons that changes label when clicked/pressed, and shows a spinner.
Mixing themes
In general you should avoid mixing buttons from different themes, as it can create confusion and inconsistency in the user interface. However, there are some exceptions where it can be acceptable to mix buttons from different themes, as long as you follow some guidelines.
Mix themes with intent, for example when linking to different applications or services. You can then match the button to app theme.
Don't mix buttons from different themes, unless there is a clear intent.