API
Usage and API reference
CwCheckbox is the library checkbox for independent yes or no selections. Use one checkbox per independent option, and rely on `name`, `value`, and `checked` when the control needs to participate in native form submission.
Copy-paste examples
Each snippet is a complete, working example you can paste into a Svelte 5 component.
Bound checkbox field
This is the normal pattern for filters, export toggles, and settings forms.
<script lang="ts">
let includeOffline = $state(true);
</script>
<CwCheckbox
name="includeOffline"
label="Include offline devices"
description="Keep stale or disconnected devices in the table."
bind:checked={includeOffline}
/>
Immediate side effects on selection
Use callbacks when checking the box should trigger follow-up work immediately.
<CwCheckbox
name="emailDigest"
label="Email digest"
oninput={(checked) => console.log('input', checked)}
onchange={(checked) => savePreference('emailDigest', checked)}
/>