Skip to content

Commit cdc34ac

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

File tree

11 files changed

+426
-58
lines changed

11 files changed

+426
-58
lines changed
-138 KB
Loading
-105 KB
Loading
166 KB
Loading

articles/styling/themes/aura/app-layout.adoc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,3 +65,7 @@ html {
6565
[.device]
6666
image::_images/app-layout-radius.png[]
6767
====
68+
69+
70+
71+
include::index.adoc[tag=property-list-styles]

articles/styling/themes/aura/color.adoc

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ Each palette color (excluding neutral, use the <<../base#text, base style text c
187187

188188
.Aura Does Not Use Lumo CSS Variables
189189
[TIP]
190-
Aura has its own color system and does not use Lumo CSS custom properties like `--lumo-primary-color` or `--lumo-error-color`. To change the primary/accent color in Aura, use `--aura-accent-color-light` and `--aura-accent-color-dark` as described below. If you are migrating from Lumo, replace `--lumo-primary-color` with the Aura accent color properties.
190+
Aura has its own color system and does not use Lumo CSS style properties like `--lumo-primary-color` or `--lumo-error-color`. To change the primary/accent color in Aura, use `--aura-accent-color-light` and `--aura-accent-color-dark` as described below. If you are migrating from Lumo, replace `--lumo-primary-color` with the Aura accent color properties.
191191

192192
`--aura-accent-color` **Read-only**::
193193
The accent color, used to highlight certain parts of the UI, like some interactive elements and selection states. Adapts to the color scheme. Don't override this property directly. Use the color-scheme-specific `--aura-accent-color-light` and `--aura-accent-color-dark` properties instead.
@@ -208,7 +208,8 @@ The accent contrast color for the light color scheme.
208208
The accent contrast color for the dark color scheme.
209209

210210
`--aura-accent-text-color` **Read-only**::
211-
A text color derived from the accent color, providing more contrast against the background. Adapts to the color scheme. Don't override this property directly. Use the color-scheme-specific `--aura-accent-text-color-light` and `--aura-accent-text-color-dark` properties instead.
211+
A text color derived from the accent color, providing more contrast against the background. Adapts to the color scheme.
212+
// Use the color-scheme-specific `--aura-accent-text-color-light` and `--aura-accent-text-color-dark` properties instead.
212213

213214
`--aura-accent-text-color-light` **Read-only**::
214215
The accent text color for the light color scheme.
@@ -294,7 +295,7 @@ A surface color that is tinted with the effective accent color.
294295

295296
The surface level and opacity can only change on a predefined set of elements.
296297

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]).
298+
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]).
298299

299300
.Change the surface level of an element that matches the supported list of selectors.
300301
[example]
@@ -364,3 +365,6 @@ Then, adjust the surface level and opacity on the component element, and reset i
364365
[.fill.white]
365366
image::_images/custom-surface-color.png[width=140]
366367
====
368+
369+
370+
include::index.adoc[tag=property-list-styles]
Lines changed: 307 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,321 @@
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 provides default styles and variants for all official components. It defines a consistent visual system out of the box, so you don’t need to build a theme from scratch.
1515

16-
To explicitly configure Aura, add the [annotationname]`@StyleSheet` annotation to your [interfacename]`AppShellConfigurator`:
16+
Aura is designed to work at a high level by default. Colors, contrast, and surface hierarchy are derived from a small set of base values, so you don't have to manage every detail manually. At the same time, you can override individual style properties when you need more precise control.
17+
// (see the component styling pages, for example, <</components/button/styling#style-properties,Button Style Properties>>).
1718

18-
[source,java]
19+
== Style Properties
20+
21+
Together with <<../base#,base styles>>, Aura defines a set of style properties, prefixed with `--vaadin-` and `--aura-` for visual features like color, typography, sizing, whitespace. These style properties define the look and feel of Vaadin components. You can assign new values the these properties to customize the look and feel of Aura. You can also use these properties as CSS values in your stylesheets, to style your application's custom UI features.
22+
23+
.Customizable vs Read-Only Properties
24+
[IMPORTANT.small]
25+
====
26+
Some style properties are designed to only be used in Vaadin components and custom UI compositions, not to be modified. Such properties are typically computed based on other, modifiable properties, for example, to support automatic light/dark color scheme switching. To customize these "read-only" properties, modify the corresponding non-read-only properties they are based on instead.
27+
28+
As an example, the `--aura-background-color` property is read-only. Its value is computed from `--aura-background-color-light` or `--aura-background-color-dark`, depending on which light/dark mode of Aura is currently applied. Instead of modifying `--aura-background-color` directly, modify the two other properties, or only `--aura-background-color-light` if your application is not intended to support dark mode.
29+
30+
Read-only properties are indicated on the Aura reference pages.
31+
====
32+
33+
34+
35+
== Light and Dark Color Schemes
36+
37+
Aura includes two color schemes: light and dark. By default only the light scheme is used, but you can your configure your application to use the dark scheme instead, or to switch dynamically between light and dark schemes based on user preferences. See the <<color#,Color>> reference page for more details on light and dark scheme usage.
38+
39+
40+
41+
== Customizing Aura
42+
43+
The look and feel that Aura applies to Vaadin components, and any custom UI compositions that you've styled with Aura properties, can be customized by assigning new values to Aura properties in a <</styling/stylesheets#,stylesheet>>.
44+
45+
.Use Component Variants
46+
[TIP.small]
47+
Before customizing Aura or components directly, see if the built-in component variants are enough for your needs. They cover common cases like sizing, emphasis, and states, allowing most applications to work with minimal customization. See the component styling pages for reference, for example, <</components/button/styling#style-variants,Button Style Variants>> and <</components/grid/styling#style-variants,Grid Style Variants>>.
48+
49+
[source,css]
50+
----
51+
html {
52+
/* Color */
53+
--aura-background-color-light: #FFFFFF;
54+
--aura-background-color-dark: #171717;
55+
--aura-accent-color-light: var(--aura-green);
56+
--aura-accent-color-dark: var(--aura-green);
57+
--aura-contrast-level: 2;
58+
--aura-surface-level: -1;
59+
60+
/* Typography */
61+
--aura-base-font-size: 15;
62+
--aura-font-family: var(--aura-font-family-system);
63+
64+
/* Other */
65+
--aura-base-radius: 4;
66+
--aura-base-size: 20;
67+
}
68+
----
69+
70+
The `html` root-level selector is used in the example above to apply the changes globally to the entire UI. Most Aura properties can also be customized separately for individual layouts or other elements by using other selectors. The <</styling/styling-elements#,Styling HTML Elements>> and <</styling/styling-components#,Styling Components>> pages provide more details on targeting different UI elements.
71+
72+
All Aura properties are listed on the <<color#,Color>>, <<typography#,Typography>> and <<other#,Other Properties pages>>.
73+
74+
75+
=== Aura Theme Editor
76+
77+
[.theme-editor-teaser]
78+
video::/vaadin/videos/aura-theme-editor-teaser.webm[options="autoplay,loop"]
79+
80+
++++
81+
<style>
82+
.theme-editor-teaser.videoblock .content {
83+
height: auto;
84+
padding-bottom: 0;
85+
aspect-ratio: 1340 / 852;
86+
87+
video {
88+
outline: 9px solid black;
89+
outline-offset: -1px;
90+
box-shadow: 0 10px 10px -3px black, 0 0 0 9px var(--docs-divider-color-1);
91+
}
92+
}
93+
</style>
94+
++++
95+
96+
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.
97+
98+
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.
99+
(Note, that the “Use Navbar” options isn't something that's controlled by the theme – that's part of the app's layout/content).
100+
101+
link:https://vaadin.github.io/web-components/aura.html[Try the Aura Theme Editor, role="button water primary"]
102+
103+
104+
// == Quick Reference
105+
106+
// === Input Properties
107+
108+
// The following example overrides the most common and safest Aura customization inputs. Start with these before overriding lower-level properties or component-specific styles.
109+
110+
// [source,css]
111+
// ----
112+
// html {
113+
// /* Color */
114+
// color-scheme: dark;
115+
// --aura-content-color-scheme: light dark;
116+
// --aura-notification-color-scheme: dark;
117+
// --aura-background-color-light: #FFFFFF;
118+
// --aura-background-color-dark: #171717;
119+
// --aura-app-background: var(--aura-background-color);
120+
// --aura-accent-color-light: var(--aura-green);
121+
// --aura-accent-color-dark: var(--aura-green);
122+
// --aura-contrast-level: 2;
123+
// --aura-surface-level: -1;
124+
// --aura-red: #e7000b;
125+
// --aura-orange: #f54a00;
126+
// --aura-yellow: #efb100;
127+
// --aura-green: #009966;
128+
// --aura-blue: #155dfc;
129+
// --aura-purple: #9810fa;
130+
131+
// /* Typography */
132+
// --aura-base-font-size: 15;
133+
// --aura-base-line-height: 1.5;
134+
// --aura-font-family: var(--aura-font-family-system);
135+
// --aura-font-weight-regular: 450;
136+
// --aura-font-weight-medium: 550;
137+
// --aura-font-weight-semibold: 650;
138+
139+
// /* App Layout */
140+
// --aura-app-layout-inset: 0px;
141+
// --aura-app-layout-radius: 0px;
142+
// --aura-app-layout-border-width: 2px;
143+
144+
// /* Other */
145+
// --aura-base-radius: 4;
146+
// --aura-base-size: 20;
147+
// }
148+
// ----
149+
150+
151+
// ++++
152+
// <style>
153+
// .collapsible-list details.small.small {
154+
// > .title {
155+
// font-size: var(--docs-font-size-s);
156+
// padding-inline: var(--docs-space-m);
157+
// }
158+
159+
// > .content {
160+
// margin-inline: var(--docs-space-m);
161+
// margin-bottom: var(--docs-space-s);
162+
// }
163+
// }
164+
// </style>
165+
// ++++
166+
167+
// === Output Properties
168+
169+
// Aura defines some properties as *read-only*. These are typically computed values that adapt to the effective color scheme and the inputs you override.
170+
171+
// You should generally not override these directly. Instead, override the corresponding input properties and use these properties as values in your own CSS.
172+
173+
// [source,css]
174+
// ----
175+
// /* Color */
176+
// --aura-neutral
177+
// --aura-background-color
178+
// --aura-accent-border-color
179+
// --aura-accent-color
180+
// --aura-accent-contrast-color
181+
// --aura-accent-text-color
182+
// --aura-surface-color
183+
// --aura-surface-color-solid
184+
// --aura-accent-surface
185+
// --aura-red-text
186+
// --aura-orange-text
187+
// --aura-yellow-text
188+
// --aura-green-text
189+
// --aura-blue-text
190+
// --aura-purple-text
191+
192+
// /* Typography */
193+
// --aura-font-family-system
194+
// --aura-font-family-instrument-sans
195+
// --aura-font-size-xs
196+
// --aura-font-size-s
197+
// --aura-font-size-m
198+
// --aura-font-size-l
199+
// --aura-font-size-xl
200+
// --aura-line-height-xs
201+
// --aura-line-height-s
202+
// --aura-line-height-m
203+
// --aura-line-height-l
204+
// --aura-line-height-xl
205+
206+
// /* Other */
207+
// --aura-shadow-color
208+
// --aura-shadow-xs
209+
// --aura-shadow-s
210+
// --aura-shadow-m
211+
// --aura-overlay-shadow
212+
// ----
213+
214+
215+
.Use Read-Only Values (Don't Override Them)
216+
[example]
217+
====
218+
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.
219+
[source,css]
19220
----
20-
@StyleSheet(Aura.STYLESHEET)
21-
public class Application implements AppShellConfigurator {
221+
.my-panel {
222+
background: var(--aura-surface-color);
223+
border: 1px solid var(--aura-accent-border-color);
224+
border-radius: var(--vaadin-radius-l);
225+
padding: var(--vaadin-padding-l);
226+
}
227+
228+
.my-panel-title {
229+
color: var(--aura-accent-text-color);
230+
font-weight: var(--aura-font-weight-semibold);
22231
}
23232
----
233+
====
234+
235+
236+
== Reference
237+
238+
For the full property reference and their corresponding safe override points, see the following sections.
24239

25-
Explicit configuration is recommended for production applications so the theme choice is clearly documented in code.
240+
section_outline::[]
241+
242+
243+
tag::property-list-styles[]
244+
++++
245+
<style>
246+
.dlist dl {
247+
xbackground: var(--docs-surface-color-2);
248+
border-radius: var(--docs-border-radius-l);
249+
border: 1px solid var(--docs-divider-color-2);
250+
gap: 0;
251+
margin-block: 2em;
252+
253+
@media screen and (min-width: 40rem) {
254+
dt, dd {
255+
padding: 0.75em 0.9em;
256+
align-self: stretch;
257+
258+
&:not(:first-of-type) {
259+
border-top: 1px solid var(--docs-divider-color-1);
260+
}
261+
}
262+
263+
dt::before {
264+
display: none;
265+
}
266+
267+
dd {
268+
border-left: 1px solid var(--docs-divider-color-1);
269+
}
270+
}
271+
272+
@media screen and (max-width: 40rem) {
273+
padding: 1em;
274+
275+
dt {
276+
margin-bottom: 0.5em;
277+
}
278+
279+
dt::before {
280+
width: calc(100% - 2em) !important;
281+
}
282+
}
283+
284+
dt code {
285+
padding-inline-start: 0;
286+
border: 0;
287+
background: transparent;
288+
font-weight: 600;
289+
display: inline;
290+
}
291+
292+
dt strong {
293+
font-size: var(--docs-font-size-2xs);
294+
border: 1px solid var(--docs-divider-color-2);
295+
border-radius: var(--docs-border-radius-m);
296+
padding-inline: 0.2em;
297+
font-weight: 500;
298+
color: var(--docs-secondary-text-color);
299+
white-space: nowrap;
300+
}
301+
}
302+
303+
.exampleblock.exampleblock {
304+
margin-block: 2em;
305+
}
306+
307+
.exampleblock .content .code-example {
308+
margin-inline: calc(var(--docs-space-m) * -1);
309+
border-radius: 0;
310+
311+
&:first-child {
312+
margin-top: calc(var(--docs-space-m) * -1);
313+
}
314+
315+
&:last-child {
316+
margin-bottom: calc(var(--docs-space-m) * -1);
317+
}
318+
}
319+
</style>
320+
++++
321+
end::property-list-styles[]

0 commit comments

Comments
 (0)