ToggleGroup
A row of toggles with single or multiple selection.
Import
import { ToggleGroup } from "@tarve/core";Usage
import { ToggleGroup } from "@tarve/core";
let alignment: string | string[] = "left";
<ToggleGroup
type="single"
value={alignment}
items={[
{ value: "left", label: "Left" },
{ value: "center", label: "Center" },
{ value: "right", label: "Right" },
]}
onValueChange={(value) => {
alignment = value;
}}
/>Props
| Prop | Type | Default |
|---|---|---|
items required | readonly ToggleGroupItem[] | — |
value required | string | string[] | — |
disabled | boolean | — |
onValueChange | (value: string | string[]) => void | — |
type | "single" | "multiple" | "single" |
Common props
Shared by every component. See descriptions →
childrenhighlightidkeymotionFromonHighlightonPasteonTransitionEndrovingGroupstyleTypes
interface ToggleGroupItem {
value: string;
label: string;
content?: Child;
disabled?: boolean;
}