Components
Radio Component
Components
- 3DCard Component
- AirpodsProLeft Component
- AirpodsProRight Component
- Alert Component
- Audio Component
- Button Component
- Card Component
- ChargingIconRight Component
- ChargingTextLeft Component
- Checkbox Component
- Collapse Component
- EmptyState Component
- ErrorMessage Component
- Form Component
- GridLayout Component
- HelpTooltip Component
- Image Component
- Input Component
- Lamp Component
- LightBox Component
- Modal Component
- MovingBorder Component
- PageLoading Component
- Popover Component
- PropertyDefault Component
- Radio Component
- RangeSlider Component
- Select
- SilentIconLeft Component
- SongThumbnail Component
- SilentTextRight Component
- Spinner Component
- TabButton Component
- TextArea Component
- Toggle Component
- Toggle2 Component
- Tooltip Component
- WarningMessage Component
Components
Radio Component
Radio
This component provides Radio functionality.
Props
prop1
: Description of prop1.prop2
: Description of prop2.
Usage
import { Radio } from './Radio';
const props = {};
<Radio prop1="value1" prop2="value2" />;
import type { InputHTMLAttributes, ReactNode } from 'react';
import { forwardRef, useId } from 'react';
import cn from '../cn';
interface RadioProps extends InputHTMLAttributes<HTMLInputElement> {
heading: ReactNode;
description?: ReactNode;
className?: string;
}
export const Radio = forwardRef<HTMLInputElement, RadioProps>(function Radio({
heading,
description,
className = '',
...rest
}) {
const id = useId();
return (
<div className={cn('flex items-center space-x-3', className)}>
<input
id={id}
type="radio"
className="text-brand dark:text-brand h-4 w-4 border focus:ring-0 focus:ring-offset-0"
{...rest}
/>
<label htmlFor={id}>
<div>{heading}</div>
{description ? <div className="text-sm">{description}</div> : null}
</label>
</div>
);
});