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>
childrenChildren
<Switch>
  <Match when={someCondition}>
    <div>Condition met!</div>
  </Match>
  <Match else>
    <div>Condition not met!</div>
  </Match>
</Switch>