UIElement Docs Version 0.13.3

🔗 Function: toggleAttribute()

toggleAttribute<P, E>(name, reactive): Effect<P, E>

Defined in: src/lib/effects.ts:525

Effect for toggling a boolean attribute on an element.
When the reactive value is true, the attribute is present; when false, it's absent.

🔗 Type Parameters

🔗 P

P extends ComponentProps

🔗 E

E extends Element = HTMLElement

🔗 Parameters

🔗 name

string

Name of the attribute to toggle

🔗 reactive

Reactive<boolean, P, E> = name

Reactive value bound to the attribute presence (defaults to attribute name)

🔗 Returns

Effect<P, E>

Effect function that toggles the attribute on the element

🔗 Since

0.8.0