Radio Group
weekendsuperhero-io-sistine/radio-groupUnverifiedComponent
A set of checkable buttons—known as radio buttons—where no more than one of the buttons can be checked at a time with optional glass material.
Install it
npx shadcn@latest add https://raw.githubusercontent.com/Weekendsuperhero-io/sistine/main/radio-group.jsonSource
1"use client";23import { Circle } from "@phosphor-icons/react";4import { RadioGroup as RadioGroupPrimitive } from "radix-ui";5import * as React from "react";67import { type MaterialAxisProps, materialSurface, splitAxisProps } from "@/lib/material";8import { cn } from "@/lib/utils";910const RadioGroup = React.forwardRef<11 React.ElementRef<typeof RadioGroupPrimitive.Root>,12 React.ComponentPropsWithoutRef<typeof RadioGroupPrimitive.Root>13>(({ className, ...props }, ref) => {14 return <RadioGroupPrimitive.Root data-slot="radio-group" className={cn("grid gap-2", className)} {...props} ref={ref} />;15});16RadioGroup.displayName = RadioGroupPrimitive.Root.displayName;1718/* Role: bordered adaptive glass. */19const ROLE = {20 border: true,21};2223const RadioGroupItem = React.forwardRef<24 React.ElementRef<typeof RadioGroupPrimitive.Item>,25 React.ComponentPropsWithoutRef<typeof RadioGroupPrimitive.Item> &26 MaterialAxisProps & {27 variant?: "default" | "glass";28 }29>(({ className, variant = "glass", ...props }, ref) => {30 const [axes, rest] = splitAxisProps(props);31 /* `glow` rides the CHECKED state on toggles — kept out of the materialSurface forward below. */32 const m = materialSurface(variant === "default" ? null : ROLE, {33 ...axes,34 glow: undefined,35 });3637 return (38 <RadioGroupPrimitive.Item39 ref={ref}40 data-slot="radio-group-item"41 data-material={m?.["data-material"]}42 className={cn(43 m?.className,44 "aspect-square h-4 w-4 shrink-0 rounded-full border shadow transition-[color,box-shadow] focus:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40",45 m === null && "border-primary",46 axes.glow && "data-[state=checked]:glass-glow transition duration-200",47 className,48 )}49 {...rest}50 >51 <RadioGroupPrimitive.Indicator data-slot="radio-group-indicator" className="flex items-center justify-center">52 <Circle className="h-2.5 w-2.5 fill-primary text-primary" />53 </RadioGroupPrimitive.Indicator>54 </RadioGroupPrimitive.Item>55 );56});57RadioGroupItem.displayName = RadioGroupPrimitive.Item.displayName;5859export { RadioGroup, RadioGroupItem };
What it pulls in
npm packages
Other registry items
Files it writes
More from weekendsuperhero-io/sistine
All 71 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| Accordionaccordion | weekendsuperhero-io/sistine | Components | Unverified | 5 deps · 4 files | |
| Alertalert | weekendsuperhero-io/sistine | Components | Unverified | 3 deps · 4 files | |
| Alert Dialogalert-dialog | weekendsuperhero-io/sistine | Components | Unverified | 4 deps · 4 files | |
| Auto Foregroundauto-foreground | weekendsuperhero-io/sistine | Components | Unverified | no deps | |
| Avataravatar | weekendsuperhero-io/sistine | Components | Unverified | 4 deps · 4 files | |
| Badgebadge | weekendsuperhero-io/sistine | Components | Unverified | 4 deps · 4 files | |
| Breadcrumbbreadcrumb | weekendsuperhero-io/sistine | Components | Unverified | 5 deps · 4 files | |
| Buttonbutton | weekendsuperhero-io/sistine | Components | Unverified | 4 deps · 4 files |
