Button Styling
Style Variants
The following variants can be used to distinguish between actions of different importance in the UI:
| Variant | Description | Supported by |
|---|---|---|
| Recommended for the most important action in a view | Aura, Lumo |
| Recommended for lower-importance actions | Aura, Lumo |
| Recommended for embedding a Button as part of text content | Lumo |
| Used to reduce the white space on either side of the icon | Lumo |
| Reduces the button size | Lumo |
| Increases the button size | Lumo |
| Recommended as an additional color option | Lumo |
| Recommended as an additional color option | Aura, Lumo |
| Recommended for dangerous or irreversible actions | Aura, Lumo |
| Recommended for actions related to warnings | Aura, Lumo |
|
Note
|
Aura uses CSS class names instead of theme attribute for certain style variants: vaadin-button (success variant), vaadin-button (error variant), vaadin-button (warning variant)
|
| Variant | Usage Recommendation |
|---|---|
Primary | This is the most important action in a view or in part of one. It’s the main closure or continuation action (e.g., Save) in a form or dialog. Avoid presenting the user with more than one at any time. |
Secondary | This is the default style recommended for most actions. It can be the alternate or negative closure actions (e.g., Cancel) in a form or dialog. |
Tertiary | These are lower-importance actions — especially in parts of the UI with less space, such as cards, or repeated actions for items in lists, tables, etc. Caution: this can be mistaken for non-interactive text. |
Danger & Error Variants
This is a style for distinguishing actions related to dangers, warnings, or errors. Dangerous actions would be those that lose or destroy data.
Primary danger buttons should only be used when a dangerous action is the most likely action. An example of this would be the affirmative Delete action in a deletion confirmation dialog. Secondary and Tertiary variants can be used for actions related to current errors, such as resolving them or viewing their details.
Warning Variant
This is a style for distinguishing actions related to warnings: for example, in dialogs that are intended to warn the user, or to provide information that requires extra attention.
Size Variants
The following size variants are available for Button instances whose size needs to be different from the default:
| Variant | Usage Recommendation |
|---|---|
Large | For important call-to-action buttons — where more emphasis is needed. |
Normal | Default size. |
Small | Compact option for cramped parts of the UI — where a Tertiary variant isn’t deemed appropriate. |
|
Tip
|
Customize Default Button Size
Size variants should only be used in special cases. See Size and Space for details on how to change the default button size.
|
Miscellaneous Style Variants
The Tertiary Inline variant omits all white space around the label. This can be useful for embedding a Button as part of text content or another component. It shouldn’t be confused with a link.
Source code
ButtonTertiaryInline.java
button-tertiary-inline.tsx
button-tertiary-inline.ts
The Success and Contrast variants should provide additional color options for buttons.
The Tertiary + Contrast combination should be avoided because of similarity to non-interactive text elements.
|
Tip
|
Customize Default Button Colors
The standard Button colors can be adjusted using the Lumo color properties. Therefore, these variants shouldn’t be used to replace standard buttons only to achieve a different color.
|
Style Properties
The following style properties can be used in CSS stylesheets to customize the appearance of this component.
To apply values to these properties globally in your application UI, place them in a CSS block using the html {…} selector.
See Component Style Properties for more information on style properties.
Common Properties
| Property | Supported by |
|---|---|
| Aura, Lumo |
| Lumo |
| Aura |
| Aura, Lumo |
| Aura |
| Aura, Lumo |
| Aura, Lumo |
| Aura |
| Aura, Lumo |
| Aura |
| Aura, Lumo |
| Lumo |
| Aura, Lumo |
| Aura, Lumo |
CSS Selectors
The following CSS selectors can be used in stylesheets to target the various parts and states of the component. See the Styling documentation for more details on how to style components.
- Root element
-
vaadin-button