Skip to content

Switch

Conditionally render blocks of content based on the when prop of nested Match components.

import { Switch } from "@alloy-js/core";
<Switch >
{children}
</Switch>

Props

childrenChildren

Example

<Switch>
<Match when={someCondition}>
<div>Condition met!</div>
</Match>
<Match else>
<div>Condition not met!</div>
</Match>
</Switch>