ebnsina

Toggle Group

Buttons

About

A multi-select group of toggle buttons for a toolbar (like text-style controls) with roving-tabindex arrow-key navigation and automatic tooltips on icon-only buttons; ported to React from the Sina UI Svelte component library by ebnsina.

Built with React and Tailwind. Copy the prompt and paste it into Claude Code, Cursor or Lovable: your agent adds Toggle Group to your project and fits it to your theme.

Code

How Toggle Group is used: the demo's code. The component's own source comes with a free account.

Usage.tsx

"use client";

import ToggleGroup from "@/components/ui/toggle-group";
import { useState } from "react";

export default function ToggleGroupLabelsDemo() {
  const [columns, setColumns] = useState<string[]>(["arabic", "latin"]);

  return (
    <div style={{ display: "grid", gap: "1rem", justifyItems: "start" }}>
      <ToggleGroup
        label="Columns to show"
        size="sm"
        value={columns}
        onValueChange={setColumns}
        items={[
          { value: "arabic", label: "Arabic" },
          { value: "latin", label: "Latin" },
          { value: "commentary", label: "Commentary" },
          { value: "facsimile", label: "Facsimile", disabled: true },
        ]}
      />
      <p style={{ margin: 0, color: "var(--ui-muted)", fontSize: "0.875rem" }}>
        Showing: {columns.length ? columns.join(", ") : "nothing"}
      </p>
    </div>
  );
}

Dependencies

More by ebnsina

View all
  • Countdown Timer

    Countdown Timer

    30
  • Video Player

    Video Player

    22
  • Alarm Clock

    Alarm Clock

    21
  • Voice Note

    Voice Note

    16
  • Hourglass Timer

    Hourglass Timer

    14
  • Sortable List

    Sortable List

    13
  • Split Button

    Split Button

    12
  • Sign In Auth Card

    Sign In Auth Card

    10

More in Buttons

View all
  • Button

    Button

    4
  • Button Group

    Button Group

    38
  • Button

    Button

    10
  • Native Button

    Native Button

    12
  • Texture Button

    Texture Button

    102
  • HeroUI Button Group

    HeroUI Button Group

    11
  • Button

    Button

    76
  • Split Button

    Split Button

    36