Skip to content

Change styles, variants and themes in runtime #5009

@mshabarov

Description

@mshabarov

Tell us about your request

In Vaadin 25.0 the themes are just stylesheets that are added with @StyleSheet or page.addStyleSheet(), thus the "theme selection" feature becomes easy doable with a standard API. We should mention this on the high level as a concept. Here is an example (but can be polished/improved):

var remover = page.addStyleSheet(Lumo.STYLESHEET);
page.setColorScheme(ColorScheme.Value.DARK);
new Button("Change to Aura and light", click -> {
   remover.remove();
   page.setColorScheme(ColorScheme.Value.LIGHT);
   page.addStyleSheet(Aura.STYLESHEET);
});

Could go under https://vaadin.com/docs/latest/styling/advanced/dynamic-stylesheets.


If you think this issue is important, add a 👍 reaction to help the community and maintainers prioritize this issue.

Metadata

Metadata

Assignees

Labels

Projects

Status

🔎Iteration reviews

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions