JSX attributes

bool:*

Edit this page

Migration

In Solid 1.x, you needed bool: to control attribute presence based on a boolean value. In Solid 2.0, this is the standard behavior for boolean-valued attributes.

// Solid 1.x
<my-element bool:muted={isMuted()} />
// Solid 2.0
<my-element muted={isMuted()} />

When isMuted() is true, the rendered output is:

<my-element muted></my-element>

When isMuted() is false, the attribute is removed:

<my-element></my-element>

This works for all boolean attributes on both native HTML elements and Web Components.

Report an issue with this page