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

    33
  • Video Player

    Video Player

    24
  • Alarm Clock

    Alarm Clock

    22
  • Voice Note

    Voice Note

    18
  • Hourglass Timer

    Hourglass Timer

    16
  • Sortable List

    Sortable List

    16
  • Split Button

    Split Button

    13
  • Sign In Auth Card

    Sign In Auth Card

    11

More in Buttons

View all
  • Texture Button

    Texture Button

    108
  • Button

    Button

    14
  • Notification Button

    Notification Button

    117
  • HeroUI Button Group

    HeroUI Button Group

    2
  • Eclipse Button

    Eclipse Button

    44
  • Button Save

    Button Save

    50
  • App Store Button

    App Store Button

    484
  • Base Button

    Base Button

    1