Documentation Upgrade
Start here
CwRadio is the library radio input for single-choice selections. Group radios by sharing the same `name` and `bind:group`, then keep the labels specific enough that each option stands on its own.
Copy-paste examples
These snippets intentionally show the full public API surface the live demo relies on.
Single-choice settings group
This is the normal form pattern for mutually exclusive options.
<script lang="ts">
let irrigationMode = $state('automatic');
</script>
<CwRadio
name="irrigation-mode"
value="automatic"
label="Automatic"
description="Follow the scheduled automation rules."
bind:group={irrigationMode}
/>
<CwRadio
name="irrigation-mode"
value="manual"
label="Manual"
description="Only run when an operator starts a cycle."
bind:group={irrigationMode}
/>
Immediate side effects on selection
Use callbacks when changing the selected option should trigger follow-up work.
<CwRadio
name="notification-channel"
value="sms"
label="SMS"
oninput={(value) => console.log('input', value)}
onchange={(value) => savePreference('notificationChannel', value)}
/>