Skip to content
v0.2.10

ToggleGroup

Optional single or multiple selections exposed as pressed buttons.

Preview

Use ToggleGroup

ToggleGroup is a named export of @flood-md/react. Connect the package once, then import what you use.

First time here? Connect Flood
Example import style
toggle-group.tsxTSX
"use client";

import { FloodRoot, ToggleGroup } from "@flood-md/react";
import "@flood-md/react/styles.css";

export function Example() {
  return (
    <FloodRoot>
      <ToggleGroup label="Text formatting" defaultValue={["bold"]} options={[{value: "bold", label: "Bold"}, {value: "italic", label: "Italic"}]} />
    </FloodRoot>
  );
}

Design notes

  • Tab reaches each enabled action. Arrows/Home/End move focus without selecting. Single selection can be cleared.
  • Use RadioGroup for form choices and tabs for switching panels. ToggleGroup does not submit form values.

API reference

PropValuesDefault
labelstringRequired
optionsreadonly ToggleOption[]Required
selectionMode"single" | "multiple""multiple"
valuereadonly string[]—
defaultValuereadonly string[][]
onValueChange(value: string[]) => void—
orientation"horizontal" | "vertical""horizontal"
size"2xs" | "xs" | "sm" | "md" | "lg" | "xl" | "2xl""md"
variant"solid" | "subtle" | "outline" | "ghost""subtle"
disabledbooleanfalse
iconOnlybooleanfalse
Native HTML propsOmit<HTMLAttributes<HTMLDivElement>, "role" | "children" | "defaultValue" | "onChange">Forwarded
View TypeScript source