Lumo Variants
Lumo has global variants that you can use to quickly customize all components and built-in component variants that can be used to style individual component instances quickly.
Dark Mode
Dark mode is commonly used in low-light environments or during night-time.
Caution | The dark variant is not supported in Internet Explorer 11. See the issue in GitHub. |
JavaJavaScriptHTML
In server-side views, use the variant
attribute of the @Theme annotation. See Using Themes for more information.
UsingComponentThemes.java
Expand code
@Theme(value = Lumo.class, variant = Lumo.DARK)
You can also use the same attribute on any element which is in the global style scope (see Style Scopes).
For server-side components, you can use the Element API to set the attribute value. Some components offer specific API for setting theme variants.
Java
VerticalLayout dark = new VerticalLayout();
dark.getElement().setAttribute("theme", Lumo.DARK);
For client-side components/templates you can add the attribute directly to the HTML element.
HTML
<vaadin-vertical-layout theme="dark"></vaadin-vertical-layout>
Compact
The compact variant reduces the font size and the sizing and spacing of all components, allowing you to place more components on the screen.
The compact variant is applied by importing an additional style sheet, which sets new values for the Typography and Sizing and Spacing CSS properties. You can view the values from the source code.
Java
@JsModule("@vaadin/vaadin-lumo-styles/presets/compact.js")
@Theme(Lumo.class)
public class CompactApp extends Div {
}
JavaScript
import '@vaadin/vaadin-lumo-styles/presets/compact.js';
Component Variants
You can find a component’s Lumo variants from its HTML examples online, from the “Theme Variants” section.
Combo Box Variants (all Text Field variants apply)
CRUD Variants (all Grid Variants apply)
Date Picker Variants (all Text Field variants apply)
Email Field Variants (all Text Field variants apply)
Grid Variants (including Grid Pro)
Number Field Variants (all Text Field variants apply)
Password Field Variants (all Text Field variants apply)
Select Variants (all Text Field variants apply)
Text Area Variants (all Text Field variants apply)
Tree Grid Variants (all Grid variants apply)