|
1 | 1 | --- |
2 | 2 | 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. |
6 | 6 | order: 20 |
7 | 7 | --- |
8 | 8 |
|
9 | 9 |
|
10 | | -= Aura Theme |
| 10 | += Aura |
11 | 11 |
|
12 | | -== Auto-Loading |
| 12 | +image::_images/aura-teaser.png[] |
13 | 13 |
|
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. |
15 | 15 |
|
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. |
17 | 17 |
|
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] |
19 | 87 | ---- |
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; |
22 | 123 | } |
23 | 124 | ---- |
24 | 125 |
|
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::[] |
0 commit comments