Skip to content
tcpsystemsui

Theme

Colour scheme
Accent
Density
Radius
Esc

SegmentedControl

Mutually exclusive options as a radio group. Works without JS.

beta

Examples

View mode

View mode
View mode.svelte
<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

Report frequency
Notification frequency.svelte
<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
import SegmentedControl from '@tcpsystems/ui/foundation/SegmentedControl';
PropTypeDefault
labelstringnone
namestringnone
optionsOption[]none
value?string$bindable()
HookKind
.tcp-segmentedRoot class