Switch
Die Übersetzung dieser Seite fehlt oder ist veraltet, daher wird sie auf Englisch angezeigt. Auf Englisch lesen
Render the first matching state. Use it for mutually exclusive loading, empty and ready views.
Display a playback state
import { Match, Switch, Text, signal } from 'kuito';
export default function Status() {
const state = signal<'idle' | 'playing' | 'paused'>('idle');
return (
<Switch fallback={<Text>Nothing playing</Text>}>
<Match when={state.value === 'playing'}>
<Text>Playing</Text>
</Match>
<Match when={state.value === 'paused'}>
<Text>Paused</Text>
</Match>
</Switch>
);
}Behavior
Use Match as direct children. Only the first truthy condition renders; fallback handles no match. Use Toggle for an on/off input.
Continue
Read Control flow for a complete workflow. See the complete prop reference for types and documented defaults.
Referenz
Signaturen
(props: SwitchProps): KuitoElementParameter
| Name | Typ | Erforderlich | Beschreibung |
|---|---|---|---|
props | SwitchProps | Ja | — |
Rückgabe
Props: SwitchProps
Props (einschließlich geerbter Props) 3
Generiert aus den öffentlichen TypeScript-Deklarationen: Signaturen, Props und Standardwerte stammen aus der geprüften Quelle, Beschreibungen aus deren JSDoc. Kein Standardwert ist erfunden.