Toggle Group

A set of two-state buttons that can be toggled on or off.

Examples

Installation

Install the package, then import only the components a route uses. Exports are tree-shakable.

Install
pnpm add fractalsvelte
Import
<script lang="ts">
	import { ToggleGroup } from 'fractalsvelte';
</script>

Usage

Usage
<script lang="ts">
	import { ToggleGroup } from 'fractalsvelte';
</script>

<ToggleGroup type="multiple" items={items} />

Props

PropTypeDefaultDescription
itemsItem[]-The list of items to render.
valuestring[][]The selected value. Supports bind:.
type'single' | 'multiple''single'Whether one or several items can be pressed.
variant'default' | 'outline''default'The visual treatment.
size'sm' | 'md' | 'lg''md'The control size.
disabledbooleanfalseDisables every item in the group.
spacing0 | 4 | 8 | 160Gap between items in px. 0 joins them into one control.