Skip to content

Commit 69c425e

Browse files
committed
aura theme docs update
1 parent 5087d4b commit 69c425e

File tree

8 files changed

+265
-35
lines changed

8 files changed

+265
-35
lines changed
-138 KB
Loading
-105 KB
Loading
166 KB
Loading

articles/styling/themes/aura/color.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,7 @@ A surface color that is tinted with the effective accent color.
294294

295295
The surface level and opacity can only change on a predefined set of elements.
296296

297-
While you might expect to be able to set the `--aura-surface-level` and `--aura-surface-opacity` property values at any level of the DOM hierarchy, that doesn't work. You can only change the level and opacity on elements that match the hard-coded list of selectors in Aura (https://github.com/vaadin/web-components/blob/4004d14275e2727147bcd085308f7f92481a9cf8/packages/aura/src/color.css#L49-L73[see full list]).
297+
While you might expect to be able to set the `--aura-surface-level` and `--aura-surface-opacity` property values at any level of the DOM hierarchy, that doesn't work. You can only change the level and opacity on elements that match the hard-coded list of selectors in Aura (https://github.com/vaadin/web-components/blob/391552e3b4e59f1aa7bc4f63aeef2a06d6ae0f9d/packages/aura/src/surface.css#L7-L41[see full list]).
298298

299299
.Change the surface level of an element that matches the supported list of selectors.
300300
[example]
Lines changed: 202 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,216 @@
11
---
22
title: Aura
3-
page-title: Aura Theme Reference
4-
description: Aura Theme Reference
5-
meta-description: aura Theme Reference
3+
page-title: Aura theme documentation for Vaadin
4+
description: Learn how to use and customize the Aura theme to build modern, consistent Vaadin applications with minimal effort.
5+
meta-description: Learn how to use and customize the Aura theme to build modern, consistent Vaadin applications with minimal effort.
66
order: 20
77
---
88

99

10-
= Aura Theme
10+
= Aura
1111

12-
== Auto-Loading
12+
image::_images/aura-teaser.png[]
1313

14-
When no [interfacename]`AppShellConfigurator` is defined in your application, the Aura theme CSS is automatically loaded as the default theme. In development mode, a log message suggests how to explicitly configure the theme.
14+
Aura is a theme for Vaadin applications that gives all official components a modern, cohesive look out of the box. Built as a collection of CSS styles and variants, it lets you get started quickly without designing or implementing a theme from scratch.
1515

16-
To explicitly configure Aura, add the [annotationname]`@StyleSheet` annotation to your [interfacename]`AppShellConfigurator`:
16+
For many applications, Aura works as-is, with built-in variants covering common needs like sizing, emphasis, and component states (see <</components#,component documentation>> and the styling sub-pages for details on each component). When customization is needed, high-level CSS custom properties allow you to adjust the look and feel without dealing with complex CSS.
1717

18-
[source,java]
18+
Aura is designed so you don't have to manage every detail manually. Colors, contrast, and surface hierarchy are computed automatically from a small set of base values, helping you stay consistent across different contexts. At the same time, you can go deeper and fine-tune individual properties when needed—moving fast by default, with full control available when required.
19+
20+
21+
== Aura Theme Editor
22+
23+
[.theme-editor-teaser]
24+
video::/vaadin/videos/aura-theme-editor-teaser.webm[options="autoplay,loop"]
25+
26+
++++
27+
<style>
28+
.theme-editor-teaser.videoblock .content {
29+
height: auto;
30+
padding-bottom: 0;
31+
aspect-ratio: 1340 / 852;
32+
33+
video {
34+
outline: 9px solid black;
35+
outline-offset: -1px;
36+
box-shadow: 0 10px 10px -3px black, 0 0 0 9px var(--docs-divider-color-1);
37+
}
38+
}
39+
</style>
40+
++++
41+
42+
The Aura theme editor allows you to visually explore the customization possibilities offered by the input properties. Use the *Shuffle* button to easily go through random combinations. If you see something you like, you can lock some options and continue exploring by shuffling the remaining unlocked options.
43+
44+
Once you're satisfied with the end result, click the *Export CSS* button to get a CSS snippet that you can paste into your styles.css.
45+
(Note, that the “Use Navbar” options isn't something that's controlled by the theme – that's part of the app's layout/content).
46+
47+
link:https://vaadin.github.io/web-components/aura.html[Try the Aura Theme Editor, role="button water primary"]
48+
49+
50+
== Custom Properties: Inputs vs Outputs
51+
52+
Aura exposes many CSS custom properties (`--aura-*`). Some are meant to be overridden (inputs), while others are meant to be used as values (outputs).
53+
54+
55+
=== Properties You Can Override (“Inputs”)
56+
57+
These are the properties you set to customize Aura. Aura uses them to compute consistent text, border, and surface colors (including light/dark handling).
58+
59+
Examples include color-scheme-specific properties such as `--aura-background-color-light` / `--aura-background-color-dark` and `--aura-accent-color-light` / `--aura-accent-color-dark`, as well as sizing and typography inputs like `--aura-base-size` and `--aura-base-font-size`.
60+
61+
You can still apply these properties as values in your own CSS, for example, the <<color#palette,palette colors>>.
62+
63+
64+
=== Read-Only “Output” Properties
65+
66+
These are computed by Aura and are designed to be applied as values in your own CSS (for example, as `background`, `color`, or `border-color` values).
67+
68+
They aren't technically read-only, but overriding them bypasses Aura's computation and makes it easier to accidentally break contrast or dark mode.
69+
70+
The most common case is color-scheme-dependent properties:
71+
72+
- Instead of overriding `--aura-background-color` (read-only), override `--aura-background-color-light` and `--aura-background-color-dark`.
73+
- Instead of overriding `--aura-accent-color` (read-only), override `--aura-accent-color-light` and `--aura-accent-color-dark`.
74+
75+
When you override colors, test both color schemes (or restrict the app to one scheme) to avoid inconsistencies.
76+
77+
See <<color#,Aura Color>> for the full color model, safe override points, and computed values.
78+
79+
80+
== Quick Reference
81+
82+
=== Input Properties
83+
84+
The following example overrides the most common and safest Aura customization inputs. Start with these before overriding lower-level properties or component-specific styles.
85+
86+
[source,css]
1987
----
20-
@StyleSheet(Aura.STYLESHEET)
21-
public class Application implements AppShellConfigurator {
88+
html {
89+
/* Color */
90+
color-scheme: dark;
91+
--aura-content-color-scheme: light dark;
92+
--aura-notification-color-scheme: dark;
93+
--aura-background-color-light: #FFFFFF;
94+
--aura-background-color-dark: #171717;
95+
--aura-app-background: var(--aura-background-color);
96+
--aura-accent-color-light: var(--aura-green);
97+
--aura-accent-color-dark: var(--aura-green);
98+
--aura-contrast-level: 2;
99+
--aura-surface-level: -1;
100+
--aura-red: #e7000b;
101+
--aura-orange: #f54a00;
102+
--aura-yellow: #efb100;
103+
--aura-green: #009966;
104+
--aura-blue: #155dfc;
105+
--aura-purple: #9810fa;
106+
107+
/* Typography */
108+
--aura-base-font-size: 15;
109+
--aura-base-line-height: 1.5;
110+
--aura-font-family: var(--aura-font-family-system);
111+
--aura-font-weight-regular: 450;
112+
--aura-font-weight-medium: 550;
113+
--aura-font-weight-semibold: 650;
114+
115+
/* App Layout */
116+
--aura-app-layout-inset: 0px;
117+
--aura-app-layout-radius: 0px;
118+
--aura-app-layout-border-width: 2px;
119+
120+
/* Other */
121+
--aura-base-radius: 4;
122+
--aura-base-size: 20;
22123
}
23124
----
24125

25-
Explicit configuration is recommended for production applications so the theme choice is clearly documented in code.
126+
127+
// ++++
128+
// <style>
129+
// .collapsible-list details.small.small {
130+
// > .title {
131+
// font-size: var(--docs-font-size-s);
132+
// padding-inline: var(--docs-space-m);
133+
// }
134+
135+
// > .content {
136+
// margin-inline: var(--docs-space-m);
137+
// margin-bottom: var(--docs-space-s);
138+
// }
139+
// }
140+
// </style>
141+
// ++++
142+
143+
=== Output Properties
144+
145+
Aura defines some properties as *read-only*. These are typically computed values that adapt to the effective color scheme and the inputs you override.
146+
147+
You should generally not override these directly. Instead, override the corresponding input properties and use these properties as values in your own CSS.
148+
149+
[source,css]
150+
----
151+
/* Color */
152+
--aura-neutral
153+
--aura-background-color
154+
--aura-accent-border-color
155+
--aura-accent-color
156+
--aura-accent-contrast-color
157+
--aura-accent-text-color
158+
--aura-surface-color
159+
--aura-surface-color-solid
160+
--aura-accent-surface
161+
--aura-red-text
162+
--aura-orange-text
163+
--aura-yellow-text
164+
--aura-green-text
165+
--aura-blue-text
166+
--aura-purple-text
167+
168+
/* Typography */
169+
--aura-font-family-system
170+
--aura-font-family-instrument-sans
171+
--aura-font-size-xs
172+
--aura-font-size-s
173+
--aura-font-size-m
174+
--aura-font-size-l
175+
--aura-font-size-xl
176+
--aura-line-height-xs
177+
--aura-line-height-s
178+
--aura-line-height-m
179+
--aura-line-height-l
180+
--aura-line-height-xl
181+
182+
/* Other */
183+
--aura-shadow-color
184+
--aura-shadow-xs
185+
--aura-shadow-s
186+
--aura-shadow-m
187+
--aura-overlay-shadow
188+
----
189+
190+
191+
.Use Read-Only Values (Don't Override Them)
192+
[example]
193+
====
194+
This example shows the intended pattern: use computed Aura values to style your own container, while keeping the theme consistent across light and dark schemes.
195+
[source,css]
196+
----
197+
.my-panel {
198+
background: var(--aura-surface-color);
199+
border: 1px solid var(--aura-accent-border-color);
200+
border-radius: var(--vaadin-radius-l);
201+
padding: var(--vaadin-padding-l);
202+
}
203+
204+
.my-panel-title {
205+
color: var(--aura-accent-text-color);
206+
font-weight: var(--aura-font-weight-semibold);
207+
}
208+
----
209+
====
210+
211+
212+
== Reference
213+
214+
For the full property reference and their corresponding safe override points, see the following sections.
215+
216+
section_outline::[]

articles/styling/themes/aura/other.adoc

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,42 @@ order: 40
88

99
= Aura: Other Properties
1010

11+
== Density & Sizing
12+
1113
`--aura-base-size`::
12-
Aura redefines the base style <<../base#gap,gap>> and <<../base#padding,padding>> properties, and those values are computed based on this property. The property value is a number without a unit (i.e., _not_ a CSS length value). Suitable values range from 12 to 24. The resulting `--vaadin-gap` and `--vaadin-padding` values are defined with the `px` unit and are rounded to nearest 1px.
14+
Defines the density of the UI. Aura redefines the base style <<../base#gap,gap>> and <<../base#padding,padding>> properties, and those values are computed based on this property. The property value is a number without a unit (i.e., _not_ a CSS length value). Suitable values range from 12 to 24. The resulting `--vaadin-gap` and `--vaadin-padding` values are defined with the `px` unit and are rounded to nearest 1px. Prefer values divisible by 4 (i.e., 12, 16, 20, 24).
1315

1416
`--aura-base-radius`::
1517
Aura redefines the base style <<../base#radius,radius>> properties, and those values are computed based on this property. The property is a number without a unit (i.e., _not_ a CSS length value). Suitable values range from 0 to 10, depending on the `--aura-base-size` value.
1618
+
1719
Setting the base radius to zero doesn't make all corners square. If you wish to remove all rounded corners, override the <<../base#radius,base style radius properties>> directly.
1820

19-
`--aura-shadow-m`::
21+
22+
== Shadows
23+
2024
`--aura-shadow-color`::
25+
The color of shadows. Computed based on the `--aura-background-color` (color-scheme dependant).
26+
27+
`--aura-shadow-xs`::
28+
Subtle shadow. Used for buttons and form inputs.
29+
30+
`--aura-shadow-s`::
31+
Small shadow. Used for small overlays like tooltips, cards, and filled component variants like primary buttons and checked checkboxes.
32+
33+
`--aura-shadow-m`::
34+
Prominent shadow. Used for most overlays like popovers, dialogs and notifications.
35+
36+
37+
== Overlays
2138

2239
`--aura-overlay-shadow`::
40+
The default shadow for all overlays. Defaults to `--aura-shadow-m`.
41+
2342
`--aura-overlay-outline-color`::
43+
The outer border color of overlays. Mostly visible with a light color scheme.
44+
2445
`--aura-overlay-inner-outline-color`::
46+
The inner border color of overlays. Mostly visible with a dark color scheme.
47+
2548
`--aura-overlay-backdrop-filter`::
49+
The backdrop filter for all overlays. By default, it lightens and blurs the content behind overlays. Only visible if <<color#surface-color,`--aura-overlay-surface-opacity`>> is less than 1.

articles/styling/themes/index.adoc

Lines changed: 36 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,41 @@
11
---
2-
title: Themes and Base Styles
2+
title: Themes & Base Styles
33
page-title: Vaadin themes and base styles
44
description: An overview of Vaadin themes and base styles.
55
meta-description: Discover Vaadin's themes and base styles to enhance your application's appearance.
66
order: 60
77
---
88

99

10-
= Themes and Base Styles
10+
= Themes & Base Styles
1111

12-
By default, Vaadin components are rendered with their minimal _base styles_. These can be a good starting point for creating a custom theme that should look significantly different than either of the two built-in themes.
12+
By default, Vaadin components are rendered with their minimal <<base#,_base styles_>>. These can be a good starting point for creating a custom theme that should look significantly different than either of the two built-in themes.
1313

1414
.Login form using base styles
15-
image::../_images/base-styles.png[Login form using base styles, width=50%]
15+
image::../_images/base-styles.png[Login form using base styles, width=360]
16+
17+
18+
== Default Theme
19+
20+
When no [interfacename]`AppShellConfigurator` is defined in your application, the Aura theme CSS is automatically loaded as the default theme. In development mode, a log message suggests how to explicitly configure the theme.
21+
22+
To explicitly configure Aura, add the [annotationname]`@StyleSheet` annotation to your [interfacename]`AppShellConfigurator`:
23+
24+
[source,java]
25+
----
26+
@StyleSheet(Aura.STYLESHEET)
27+
public class Application implements AppShellConfigurator {
28+
}
29+
----
30+
31+
Explicit configuration is recommended for production applications so the theme choice is clearly documented in code.
1632

1733
== Aura Theme
1834

19-
Aura is one of the two built-in themes for Vaadin applications. It provides a modern, polished look and feel for all Vaadin components.
35+
<<aura#,Aura>> is the default theme for Vaadin applications, offering a modern and cohesive design for all official components. It works out of the box with built-in variants for common use cases, while also providing high-level CSS custom properties for easy customization. By computing colors, contrast, and surface hierarchy automatically, Aura lets you focus on your application while still achieving consistent, high-quality results.
2036

2137
.Login form using the Aura theme
22-
image::../_images/aura-theme.png[[Login form using the Aura theme, width=50%]
38+
image::../_images/aura-theme.png[[Login form using the Aura theme, width=360]
2339

2440
To load the Aura theme in your application, add it with a [annotationname]`@StyleSheet` annotation on your main application class. The [classname]`Aura` class provides a constant for the path to the Aura stylesheet that can be used with the [annotationname]`@StyleSheet` annotation.
2541

@@ -32,33 +48,32 @@ public class Application implements AppShellConfigurator {
3248
}
3349
----
3450

35-
Note that themes should always be loaded _before_ any other styles in your application.
51+
Themes should always be loaded _before_ any other styles in your application.
3652

37-
Aura includes a comprehensive set of style properties (custom CSS properties) that can be used to customize it without writing complicated CSS selectors. See the <<aura#,Aura style property reference>> for a complete list.
53+
Aura includes a comprehensive set of style properties (custom CSS properties) that can be used to customize it without writing complicated CSS selectors.
3854

3955
.Login form using customized Aura theme
40-
image::../_images/aura-theme-customized.png[[Login form using customized Aura theme, width=50%]
56+
image::../_images/aura-theme-customized.png[[Login form using customized Aura theme, width=360]
4157

4258
[source,css]
4359
----
4460
html {
45-
--aura-background-color-light: #e3ffe8;
46-
--aura-font-family: Verdana;
47-
--aura-base-font-size: 16;
48-
--aura-base-radius: 10;
49-
}
50-
51-
vaadin-button {
52-
--aura-accent-color: #42C556;
61+
--aura-accent-color-light: #009966;
62+
--aura-background-color-light: #f3f1f1;
63+
--aura-base-font-size: 15;
64+
--aura-base-radius: 0;
65+
--aura-base-size: 20;
66+
--aura-contrast-level: 2;
67+
--aura-font-family: var(--aura-font-family-system);
5368
}
5469
----
5570

5671
== Lumo Theme
5772

58-
Lumo is the original Vaadin theme.
73+
<<lumo#,Lumo>> is a theme for Vaadin applications that offers a clean and consistent design for all official components. While Aura is the default theme, Lumo remains a dependable alternative with a strong focus on clarity, accessibility, and predictability. It provides a solid foundation for building applications or creating custom themes on top.
5974

6075
.Login form using the Lumo theme
61-
image::../_images/lumo-theme.png[Login form using the Lumo theme, width=50%]
76+
image::../_images/lumo-theme.png[Login form using the Lumo theme, width=360]
6277

6378
To load the Lumo theme in your application, add it with a [annotationname]`@StyleSheet` annotation on your main application class. The [classname]`Lumo` class provides a constant for the path to the Lumo stylesheet that can be used with the [annotationname]`@StyleSheet` annotation.
6479

@@ -71,12 +86,12 @@ public class Application implements AppShellConfigurator {
7186
}
7287
----
7388

74-
Note that themes should always be loaded _before_ any other styles in your application.
89+
Themes should always be loaded _before_ any other styles in your application.
7590

7691
Lumo includes a comprehensive set of style properties (custom CSS properties) that can be used to customize it without writing complicated CSS selectors. See the <<lumo/lumo-style-properties#,Lumo style property reference>> for a complete list.
7792

7893
.Login form using customized Lumo theme
79-
image::../_images/lumo-theme-customized.png[Login form using customized Lumo theme, width=50%]
94+
image::../_images/lumo-theme-customized.png[Login form using customized Lumo theme, width=360]
8095

8196
[source,css]
8297
----
Binary file not shown.

0 commit comments

Comments
 (0)