DocsComponentsTemplatesThemesGitHub

Radio

Single radio input. Prefer RadioGroup.

Code

import * as React from 'react';
import { Radio } from '@fruit-labs/design';

export default function Demo() {
  return (
    <div
      style={{
        display: 'flex',
        gap: 20,
      }}
    >
      <Radio name="r" defaultChecked>
        Monthly
      </Radio>
      <Radio name="r">Yearly</Radio>
    </div>
  );
}

Install

From npm:

npm install @fruit-labs/design

import { Radio } from '@fruit-labs/design';

Or copy the TypeScript source into your project:

npx shadcn@latest add https://design.fruitlabs.online/r/radio.json

Guidelines

  • Use only when composing a custom radio layout.

Props

PropTypeRequired
invalidbooleanNo
namestringNo
valuestringNo
checkedbooleanNo
defaultCheckedbooleanNo
disabledbooleanNo
onChange(e: React.ChangeEvent<HTMLInputElement>) => voidNo
classNamestringNo
childrenReact.ReactNodeNo

Edit this example on GitHub