Skip to content

Add bindThemeVariants helper method #8890

@Legioth

Description

@Legioth

Describe your motivation

HasTheme has a recently added bindThemeNames with a signal that returns a list of theme names to apply.

Usage example, show the button as either primary or warning depending on some condition :

button.bindThemeNames(() -> List.of(conditionSignal.get() ? "primary" : "warning"));

Describe the solution you'd like

Make the same structure available also for the typed theme variants, e.g.

button.bindThemeVariants(() -> List.of(conditionSignal.get() ? ButtonVariant.LUMO_PRIMARY : ButtonVariant.LUMO_WARNING));

Describe alternatives you've considered

No response

Additional context

No response

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions