ReScript Shadcn
Get started
  • Installation
Components
  • Accordion
  • Alert
  • AlertDialog
  • AspectRatio
  • Attachment
  • Avatar
  • Badge
  • Breadcrumb
  • Bubble
  • Button
  • ButtonGroup
  • Calendar
  • Card
  • Carousel
  • Chart
  • Checkbox
  • Collapsible
  • Combobox
  • Command
  • ContextMenu
  • DataTable
  • DatePicker
  • Dialog
  • Direction
  • Drawer
  • DropdownMenu
  • Empty
  • Field
  • HoverCard
  • Input
  • InputGroup
  • InputOtp
  • Item
  • Kbd
  • Label
  • Marker
  • Menubar
  • Message
  • MessageScroller
  • NativeSelect
  • NavigationMenu
  • Pagination
  • Popover
  • Progress
  • RadioGroup
  • Resizable
  • ScrollArea
  • Select
  • Separator
  • Sheet
  • Sidebar
  • Skeleton
  • Slider
  • Sonner
  • Spinner
  • Switch
  • Table
  • Tabs
  • Textarea
  • Toast
  • Toggle
  • ToggleGroup
  • Tooltip
  • Typography

Radio Group

A set of checkable buttons—known as radio buttons—where no more than one of the buttons can be checked at a time.

Installation#

npx shadcn@latest add @rescript-shadcn/RadioGroup

Usage#

<RadioGroup defaultValue="option-one">
  <div className="flex items-center gap-3">
    <RadioGroup.Item value="option-one" id="option-one" />
    <Label htmlFor="option-one"> {"Option One"->React.string} </Label>
  </div>
  <div className="flex items-center gap-3">
    <RadioGroup.Item value="option-two" id="option-two" />
    <Label htmlFor="option-two"> {"Option Two"->React.string} </Label>
  </div>
</RadioGroup>

Examples#

Description#

Radio group items with a description using the Field component.

Standard spacing for most use cases.

More space between elements.

Minimal spacing for dense layouts.

Choice Card#

Use FieldLabel to wrap the entire Field for a clickable card-style selection.

Fieldset#

Use FieldSet and FieldLegend to group radio items with a label and description.

Subscription Plan

Yearly and lifetime plans offer significant savings.

Disabled#

Use the disabled prop on RadioGroup to disable all items.

Invalid#

Use aria-invalid on RadioGroupItem and data-invalid on Field to show validation errors.

Notification Preferences

Choose how you want to receive notifications.

API Reference#

See the Base UI Radio Group documentation.

@react.component
let make = () =>
  <RadioGroup defaultValue="comfortable" className="w-fit">
@react.component
let make = () =>
  <RadioGroup defaultValue="plus" className="max-w-sm">
@react.component
let make = () =>
  <RadioGroup defaultValue="option2" className="w-fit">
@react.component
let make = () =>
  <Field.Set className="w-full max-w-xs">
@react.component
let make = () =>
  <RadioGroup defaultValue="comfortable" className="w-fit">
@react.component
let make = () =>
  <Field.Set className="w-full max-w-xs">