ui/toggle-group.tsx

lipi · components/ui/toggle-group.tsx · typescript · MIT
ui, UI / Frontend

Group toggle buttons with shared size and variant styles.

// Source: https://github.com/rajput-hemant/lipi | License: MIT | Copyright 2023 Hemant Rajput
// Provided via justclaw.it.com; keep this notice with the code.
"use client";

import * as React from "react";
import * as ToggleGroupPrimitive from "@radix-ui/react-toggle-group";

import type { VariantProps } from "class-variance-authority";

import { toggleVariants } from "@/components/ui/toggle";
import { cn } from "@/lib/utils";

const ToggleGroupContext = React.createContext<
  VariantProps<typeof toggleVariants>
>({
  size: "default",
  variant: "default",
});

const ToggleGroup = React.forwardRef<
  React.ElementRef<typeof ToggleGroupPrimitive.Root>,
  React.ComponentPropsWithoutRef<typeof ToggleGroupPrimitive.Root> &
    VariantProps<typeof toggleVariants>
>(({ className, variant, size,

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key