SegmentedControl
Mutually exclusive options as a radio group. Works without JS.
beta
Examples
View mode
<script lang="ts">
import SegmentedControl from '@tcpsystems/ui/foundation/SegmentedControl';
let view = $state('list');
</script>
<SegmentedControl
label="View mode"
name="view-mode"
bind:value={view}
options={[
{ value: 'list', label: 'List' },
{ value: 'grid', label: 'Grid' },
{ value: 'kanban', label: 'Kanban' },
]}
/>Notification frequency
<script lang="ts">
import SegmentedControl from '@tcpsystems/ui/foundation/SegmentedControl';
let frequency = $state('daily');
</script>
<SegmentedControl
label="Report frequency"
name="report-frequency"
bind:value={frequency}
options={[
{ value: 'instant', label: 'Instant' },
{ value: 'daily', label: 'Daily' },
{ value: 'weekly', label: 'Weekly' },
]}
/>API
import SegmentedControl from '@tcpsystems/ui/foundation/SegmentedControl';| Prop | Type | Default |
|---|---|---|
label | string | none |
name | string | none |
options | Option[] | none |
value? | string | $bindable() |
| Hook | Kind |
|---|---|
.tcp-segmented | Root class |