Base Radio
animate-ui/components-base-radioFreeComponent
An easily stylable radio button component.
Install it
npx shadcn@latest add https://animate-ui.com/r/components-base-radio.jsonSource
1import * as React from 'react';2import { CircleIcon } from 'lucide-react';34import {5 RadioGroup as RadioGroupPrimitive,6 Radio as RadioPrimitive,7 RadioIndicator as RadioIndicatorPrimitive,8 type RadioGroupProps as RadioGroupPrimitiveProps,9 type RadioProps as RadioPrimitiveProps,10} from '@/components/animate-ui/primitives/base/radio';11import { cn } from '@/lib/utils';1213type RadioGroupProps = RadioGroupPrimitiveProps;1415function RadioGroup({ className, ...props }: RadioGroupProps) {16 return (17 <RadioGroupPrimitive className={cn('grid gap-3', className)} {...props} />18 );19}2021type RadioProps = RadioPrimitiveProps;2223function Radio({ className, ...props }: RadioProps) {24 return (25 <RadioPrimitive26 className={cn(27 'border-input text-primary focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 aspect-square size-4 shrink-0 rounded-full border shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50',28 className,29 )}30 {...props}31 >32 <RadioIndicatorPrimitive className="relative flex items-center justify-center">33 <CircleIcon className="fill-primary absolute top-1/2 left-1/2 size-2 -translate-x-1/2 -translate-y-1/2" />34 </RadioIndicatorPrimitive>35 </RadioPrimitive>36 );37}3839export { RadioGroup, Radio, type RadioGroupProps, type RadioProps };
What it pulls in
npm packages
Other registry items
Files it writes
More from Animate UI
All 580 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| Avatar Groupcomponents-animate-avatar-group | Animate UI | Components | Free | 1 dep | |
| Codecomponents-animate-code | Animate UI | Components | Free | 1 dep | |
| Code Tabscomponents-animate-code-tabs | Animate UI | Components | Free | 1 dep | |
| Cursorcomponents-animate-cursor | Animate UI | Components | Free | no deps | |
| GitHub Stars Wheelcomponents-animate-github-stars-wheel | Animate UI | Components | Free | 1 dep | |
| Tabscomponents-animate-tabs | Animate UI | Components | Free | no deps | |
| Tooltipcomponents-animate-tooltip | Animate UI | Components | Free | 1 dep | |
| Bubble Backgroundcomponents-backgrounds-bubble | Animate UI | Components | Free | 1 dep |
