Skip to content

Commit 97291c8

Browse files
authored
docs: improve upgrade guide theming section (#5052)
* docs: improve upgrade guide theming section * address review comments
1 parent 5cb4150 commit 97291c8

File tree

1 file changed

+8
-19
lines changed

1 file changed

+8
-19
lines changed

articles/upgrading/index.adoc

Lines changed: 8 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -233,28 +233,17 @@ Below are the main highlights of the changes and more detailed instructions are
233233

234234
The special `frontend/themes` folder, and the `components` sub-folder for CSS shadow-DOM injection, is deprecated (but still supported).
235235

236-
Injecting CSS into Vaadin components’ shadow DOM through the components sub-folder in your `frontend/themes/<mytheme>` folder is disabled by default. Shadow DOM styling is no longer recommended (as of V24), but if you still need to use it, it can be enabled with the feature flag `themeComponentStyles`.
236+
Injecting CSS into Vaadin components’ shadow DOM through the `components` sub-folder in your `frontend/themes/<mytheme>` folder is disabled by default. Shadow DOM styling is no longer recommended (as of V24), but if you still need to use it, it can be enabled with the <<{articles}/flow/configuration/feature-flags#,`themeComponentStyles`>> feature flag.
237237

238-
The [classname]`@Theme` annotation is deprecated. Instead, [classname]`StyleSheet` annotation to be used for loading one or more stylesheets from public static resources locations (e.g. `META-INF/resources/`), whereas [classname]`CssImport` loads one or more stylesheets from the `src/main/frontend/` folder and use mechanisms native to HTML, CSS, and React (e.g. `@import url("morestyles.css")` in CSS).
239-
240-
`StyleSheet` annotation is now a recommended way to load Vaadin theme for the application — to be placed on the application class implementing [classname]`AppShellConfigurator`. Below are some examples of how to use it:
238+
The [annotationname]`@Theme` annotation is deprecated. Instead, the [annotationname]`@StyleSheet` annotation is now the recommended way to load Vaadin themes and custom application styles. The annotation should be placed on the application class implementing [classname]`AppShellConfigurator`:
241239

242240
[source,java]
243241
----
244-
// theme selection
242+
// Load Vaadin theme
245243
@StyleSheet(Aura.STYLESHEET) // or Lumo.STYLESHEET
244+
// Load application styles
245+
@StyleSheet("styles.css") // references src/main/resources/META-INF/resources/styles.css
246246
public class Application implements AppShellConfigurator {}
247-
248-
// or loading custom styles and theme:
249-
250-
@StyleSheet("styles.css")
251-
public class Application implements AppShellConfigurator {}
252-
253-
// then using @import in the src/main/resources/META-INF/resources/styles.css:
254-
255-
@import 'aura/aura.css'; /* or 'lumo/lumo.css' */
256-
// your custom styles go here ...
257-
258247
----
259248

260249
Stylesheets referenced by [annotationname]`@StyleSheet` annotation are loaded by the servlet container. If the application is configured to use a custom URL mapping for the [classname]`VaadinServlet` (e.g. `vaadin.url-mapping` setting in Spring applications), the referenced stylesheet must be prefixed by the `context://` protocol.
@@ -315,16 +304,16 @@ The Lumo theme is no longer loaded by default, except if you’re using the [cla
315304

316305
[source,java]
317306
----
318-
@StyleSheet(Lumo.STYLESHEET);
307+
@StyleSheet(Lumo.STYLESHEET)
319308
public class Application implements AppShellConfigurator {}
320309
----
321310

322311
All Lumo styles, including badges, but excluding Lumo Utility Classes are included by default when the Lumo theme is loaded. To load the utility classes, add a separate [classname]`@StyleSheet` annotation:
323312

324313
[source,java]
325314
----
326-
@StyleSheet(Lumo.STYLESHEET);
327-
@StyleSheet(Lumo.UTILITY_STYLESHEET);
315+
@StyleSheet(Lumo.STYLESHEET)
316+
@StyleSheet(Lumo.UTILITY_STYLESHEET)
328317
public class Application implements AppShellConfigurator {}
329318
----
330319

0 commit comments

Comments
 (0)