Docs

Documentation versions (currently viewingVaadin 25 (prerelease))

Dashboard Styling

Styling API reference for the Dashboard component.

Style Variants

The following style variants can be applied to the Dashboard to change its appearance:

Variant Description Supported by

shaded-background

Applies shading to the dashboard background.

Lumo

elevated-widgets

Makes the widgets appear elevated above the dashboard surface.

Lumo

flat-widgets

A flat, borderless widget style.

Lumo

Source code
dashboard-variants.ts
import '@vaadin/dashboard/vaadin-dashboard-layout.js'; import '@vaadin/dashboard/vaadin-dashboard-widget.js'; import '@vaadin/select'; import '@vaadin/checkbox'; import { html, LitElement } from 'lit'; import { customElement, state } from 'lit/decorators.js'; import { applyTheme } from 'Frontend/demo/theme'; import { SelectChangeEvent } from '@vaadin/select'; import { CheckboxChangeEvent } from '@vaadin/checkbox'; @customElement('dashboard-variants') export class Example extends LitElement { protected override createRenderRoot() { const root = super.createRenderRoot(); applyTheme(root); return root; } @state() items = [ { label: 'Outlined (default)', value: ' ' }, { label: 'Flat', value: 'flat-widgets' }, { label: 'Elevated', value: 'elevated-widgets' }, ]; @state() widgetVariant: string = ' '; @state() shadedBoard: string = ''; onWidgetVariantChange(event: SelectChangeEvent) { this.widgetVariant = event.target.value; } onShadedBgChange(event: CheckboxChangeEvent) { this.shadedBoard = event.target.checked ? 'shaded-background' : ''; } render() { return html` <div style="display:flex; align-items:baseline; gap:1rem; padding-inline:var(--lumo-space-m);"> <vaadin-select label="Widget variant" .items="${this.items}" value=" " @change="${this.onWidgetVariantChange}" ></vaadin-select> <vaadin-checkbox label="Shaded board background" @change="${this.onShadedBgChange}" ></vaadin-checkbox> </div> <vaadin-dashboard-layout theme="${this.widgetVariant} ${this.shadedBoard}" style=" width:100%; --vaadin-dashboard-row-min-height:200px; --vaadin-dashboard-col-min-width: 100px; --vaadin-dashboard-col-max-count: 3;" > <vaadin-dashboard-widget widget-title="Visitors"> </vaadin-dashboard-widget> <vaadin-dashboard-widget widget-title="Downloads"> </vaadin-dashboard-widget> <vaadin-dashboard-widget widget-title="Conversions"> </vaadin-dashboard-widget> </vaadin-dashboard-layout> `; } }
dashboard-variants.ts

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.

Layout Properties

Property Supported by

--vaadin-dashboard-col-min-width

Aura, Lumo

--vaadin-dashboard-col-max-width

Aura, Lumo

--vaadin-dashboard-col-max-count

Aura, Lumo

--vaadin-dashboard-row-min-height

Aura, Lumo

--vaadin-dashboard-widget-rowspan

Aura, Lumo

--vaadin-dashboard-widget-colspan

Aura, Lumo

--vaadin-dashboard-padding

Aura, Lumo

--vaadin-dashboard-gap

Aura, Lumo

Widget Properties

Property Supported by

--vaadin-dashboard-widget-background

Aura, Lumo

--vaadin-dashboard-widget-border-radius

Aura, Lumo

--vaadin-dashboard-widget-border-width

Aura, Lumo

--vaadin-dashboard-widget-border-color

Aura, Lumo

--vaadin-dashboard-widget-shadow

Aura, Lumo

--vaadin-dashboard-widget-padding

Lumo

--vaadin-dashboard-widget-header-padding

Aura

--vaadin-dashboard-widget-header-gap

Aura

--vaadin-dashboard-widget-title-color

Aura

--vaadin-dashboard-widget-title-font-size

Aura

--vaadin-dashboard-widget-title-font-weight

Aura

--vaadin-dashboard-widget-title-line-height

Aura

--vaadin-dashboard-widget-title-wrap

Aura, Lumo

--vaadin-dashboard-drop-target-background-color

Lumo

--vaadin-dashboard-drop-target-border

Lumo

Section Properties

Property Supported by

--vaadin-dashboard-section-border-radius

Aura

--vaadin-dashboard-widget-header-gap

Aura

--vaadin-dashboard-widget-title-color

Aura

--vaadin-dashboard-widget-title-font-size

Aura

--vaadin-dashboard-widget-title-font-weight

Aura

--vaadin-dashboard-widget-title-line-height

Aura

--vaadin-dashboard-widget-title-wrap

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.

Dashboard root element

vaadin-dashboard

Static Dashboard Layout (React & Lit)

vaadin-dashboard-layout

Widgets

Root element

vaadin-dashboard-widget

Widget States

Editable

vaadin-dashboard-widget[editable]

Focused

vaadin-dashboard-widget[focused]

Selected

vaadin-dashboard-widget[selected]

Being dragged

vaadin-dashboard-widget[dragging]

Being resized

vaadin-dashboard-widget[resizing]

Accessible move mode

vaadin-dashboard-widget[move-mode]

Accessible resize mode

vaadin-dashboard-widget[resize-mode]

Widget Parts

Header

vaadin-dashboard-widget::part(header)

Title

vaadin-dashboard-widget::part(title)

Content area

vaadin-dashboard-widget::part(content)

Drag handle / Move button

vaadin-dashboard-widget::part(move-button)

Remove button

vaadin-dashboard-widget::part(remove-button)

Resize handle / button

vaadin-dashboard-widget::part(resize-button)

Sections

Root element

vaadin-dashboard-section

Section States

Editable

vaadin-dashboard-section[editable]

Focused

vaadin-dashboard-section[focused]

Selected

vaadin-dashboard-section[selected]

Being dragged

vaadin-dashboard-section[dragging]

Accessible move mode

vaadin-dashboard-section[move-mode]

Section Parts

Header

vaadin-dashboard-section::part(header)

Title

vaadin-dashboard-section::part(title)

Drag handle / Move button

vaadin-dashboard-section::part(move-button)

Remove button

vaadin-dashboard-section::part(remove-button)

Accessible Move & Resize Modes

To target move-mode buttons on Sections, replace vaadin-dashboard-widget with vaadin-dashboard-section in the selectors below.

Move backward button

vaadin-dashboard-widget::part(move-backward-button)

Move forward button

vaadin-dashboard-widget::part(move-forward-button)

Move apply button

vaadin-dashboard-widget::part(move-apply-button)

Shrink width button

vaadin-dashboard-widget::part(resize-shrink-width-button)

Grow width button

vaadin-dashboard-widget::part(resize-grow-width-button)

Shrink height button

vaadin-dashboard-widget::part(resize-shrink-width-button)

Grow height button

vaadin-dashboard-widget::part(resize-grow-width-button)

Resize apply button

vaadin-dashboard-widget::part(resize-apply-button)