Docs

Documentation versions (currently viewingVaadin 25 (prerelease))

Button Styling

Styling API reference for the Button components.

Style Variants

The following variants can be used to distinguish between actions of different importance in the UI:

Variant Description Supported by

primary

Recommended for the most important action in a view

Aura, Lumo

tertiary

Recommended for lower-importance actions

Aura, Lumo

tertiary-inline

Recommended for embedding a Button as part of text content

Lumo

icon

Used to reduce the white space on either side of the icon

Lumo

small

Reduces the button size

Lumo

large

Increases the button size

Lumo

contrast

Recommended as an additional color option

Lumo

success

Recommended as an additional color option

Aura, Lumo

error

Recommended for dangerous or irreversible actions

Aura, Lumo

warning

Recommended for actions related to warnings

Aura, Lumo

Note
Aura uses CSS class names instead of theme attribute for certain style variants: vaadin-button.aura-accent-green (success variant), vaadin-button.aura-accent-red (error variant), vaadin-button.aura-accent-yellow (warning variant)
Source code
ButtonStyles.java
button-styles.tsx
button-styles.ts
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.

Source code
ButtonError.java
button-error.tsx
button-error.ts

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.

Source code
ButtonWarning.java
button-warning.tsx
button-warning.ts

Size Variants

The following size variants are available for Button instances whose size needs to be different from the default:

Source code
ButtonSizes.java
button-sizes.tsx
button-sizes.ts
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.

Source code
ButtonSuccess.java
button-success.tsx
button-success.ts
Source code
ButtonContrast.java
button-contrast.tsx
button-contrast.ts

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

--vaadin-button-background

Aura, Lumo

--vaadin-button-border

Lumo

--vaadin-button-border-color

Aura

--vaadin-button-border-radius

Aura, Lumo

--vaadin-button-border-width

Aura

--vaadin-button-font-size

Aura, Lumo

--vaadin-button-font-weight

Aura, Lumo

--vaadin-button-gap

Aura

--vaadin-button-height

Aura, Lumo

--vaadin-button-line-height

Aura

--vaadin-button-margin

Aura, Lumo

--vaadin-button-min-width

Lumo

--vaadin-button-padding

Aura, Lumo

--vaadin-button-text-color

Aura, Lumo

Primary Button

Feature Property Supported by

Background

--vaadin-button-primary-background

Lumo

Text Color

--vaadin-button-primary-text-color

Lumo

Font Weight

--vaadin-button-primary-font-weight

Lumo

Border

--vaadin-button-primary-border

Lumo

Tertiary Button

Feature Property Supported by

Background

--vaadin-button-tertiary-background

Lumo

Text Color

--vaadin-button-tertiary-text-color

Lumo

Font Weight

--vaadin-button-tertiary-font-weight

Lumo

Border

--vaadin-button-tertiary-border

Lumo

Padding

--vaadin-button-tertiary-padding

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

States

Disabled

vaadin-button[disabled]

Focused

vaadin-button[focused]

Keyboard Focused

vaadin-button[focus-ring]

Hovered

vaadin-button:hover

Hover Highlight

vaadin-button:hover::before

Parts

Label

vaadin-button::part(label)

Prefix (e.g., icon) Wrapper

vaadin-button::part(prefix)

Suffix (e.g., icon) Wrapper

vaadin-button::part(suffix)

Icon

vaadin-button > vaadin-icon