Class FlashClassAction
java.lang.Object
com.vaadin.flow.component.trigger.internal.Action
com.vaadin.flow.component.trigger.internal.FlashClassAction
- All Implemented Interfaces:
Serializable
Briefly adds a CSS class to a target element when the bound trigger fires,
removing it again when the associated CSS animation ends. Pure client-side —
no server round-trip.
Trigger-driven counterpart to
Element.flashClass(String): the Element method is
the server-initiated entry point (e.g. flashing a highlight when a signal
value changes); this action is for wiring the same flash to a client-side
trigger so the gesture-to-animation path stays in the browser.
The class name to flash can be either a literal (constant, serialised at
build time) or an Action.Input that produces the name on the client
when the trigger fires — for example, sourcing the name from a property on
the host element.
Common idioms:
- Flash a fixed class on click:
new FlashClassAction(panel, "highlight") - Flash a class whose name comes from a property:
new FlashClassAction(panel, new PropertyInput<>(other, "flashClassName", String.class))
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class com.vaadin.flow.component.trigger.internal.Action
Action.Input<T> -
Constructor Summary
ConstructorsConstructorDescriptionFlashClassAction(Component target, Action.Input<? extends String> source) Creates an action that flashes the CSS class produced bysourceontargetwhen the trigger fires.FlashClassAction(Component target, String className) Creates an action that flashes the given literal CSS class ontargetwhen the trigger fires. -
Method Summary
Modifier and TypeMethodDescriptionprotected JsFunctionBuilds theJsFunctionthat runs this action when the surrounding trigger fires.Methods inherited from class com.vaadin.flow.component.trigger.internal.Action
applyTemporarily, warnIfNotVisible
-
Constructor Details
-
FlashClassAction
Creates an action that flashes the given literal CSS class ontargetwhen the trigger fires.- Parameters:
target- the component whose root element to flash on, notnullclassName- the CSS class name to flash, notnull
-
FlashClassAction
Creates an action that flashes the CSS class produced bysourceontargetwhen the trigger fires.- Parameters:
target- the component whose root element to flash on, notnullsource- input that produces the CSS class name on the client when the trigger fires, notnull
-
-
Method Details
-
toJs
Description copied from class:ActionBuilds theJsFunctionthat runs this action when the surrounding trigger fires. The returned function takes one runtime argument namedevent(declared by the framework when it composes the trigger handler); subclasses do not declare argument names themselves.The body is one statement. To embed a value produced on the client, capture an
Action.Input'sJsFunctionas a capture and invoke it inside the body as$N(event).
-