radio-group
shadcn-zhcndoc/radio-groupFreeComponent
shadcn-zhcndoc publishes no description for this item.
Live preview
live · rendered by the registry
Rendered by shadcn-zhcndoc on their own page — this is the component running, not a screenshot of it.Install it
npx shadcn@latest add https://shadcn.zhcndoc.com/r/styles/new-york/radio-group.jsonSource
1"use client"23import * as React from "react"4import * as RadioGroupPrimitive from "@radix-ui/react-radio-group"5import { Circle } from "lucide-react"67import { cn } from "@/lib/utils"89const RadioGroup = React.forwardRef<10 React.ElementRef<typeof RadioGroupPrimitive.Root>,11 React.ComponentPropsWithoutRef<typeof RadioGroupPrimitive.Root>12>(({ className, ...props }, ref) => {13 return (14 <RadioGroupPrimitive.Root15 className={cn("grid gap-2", className)}16 {...props}17 ref={ref}18 />19 )20})21RadioGroup.displayName = RadioGroupPrimitive.Root.displayName2223const RadioGroupItem = React.forwardRef<24 React.ElementRef<typeof RadioGroupPrimitive.Item>,25 React.ComponentPropsWithoutRef<typeof RadioGroupPrimitive.Item>26>(({ className, ...props }, ref) => {27 return (28 <RadioGroupPrimitive.Item29 ref={ref}30 className={cn(31 "aspect-square h-4 w-4 rounded-full border border-primary text-primary shadow focus:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50",32 className33 )}34 {...props}35 >36 <RadioGroupPrimitive.Indicator className="flex items-center justify-center">37 <Circle className="h-3.5 w-3.5 fill-primary" />38 </RadioGroupPrimitive.Indicator>39 </RadioGroupPrimitive.Item>40 )41})42RadioGroupItem.displayName = RadioGroupPrimitive.Item.displayName4344export { RadioGroup, RadioGroupItem }
Files it writes
More from shadcn-zhcndoc
All 61 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| accordionaccordion | shadcn-zhcndoc | Components | Free | no deps | |
| alertalert | shadcn-zhcndoc | Components | Free | no deps | |
| alert-dialogalert-dialog | shadcn-zhcndoc | Components | Free | no deps | |
| aspect-ratioaspect-ratio | shadcn-zhcndoc | Components | Free | no deps | |
| attachmentattachment | shadcn-zhcndoc | Components | Free | no deps | |
| avataravatar | shadcn-zhcndoc | Components | Free | no deps | |
| badgebadge | shadcn-zhcndoc | Components | Free | no deps | |
| breadcrumbbreadcrumb | shadcn-zhcndoc | Components | Free | no deps |
