Components
RadioGroup

Radio Group

The Radio Group component provides you with radio button groups and selections.

Import

import { RadioGroup, RadioGroupItem } from '@nostromo/ui-core'
// or
import { RadioGroup, RadioGroupItem } from '@nostromo/ui-core/radio-group'

Usage

import { RadioGroup, RadioGroupItem, Label } from '@nostromo/ui-core'
 
export default function Example() {
  const [value, setValue] = React.useState('option1')
  
  return (
    <RadioGroup value={value} onValueChange={setValue}>
      <div className="flex items-center space-x-2">
        <RadioGroupItem value="option1" id="r1" />
        <Label htmlFor="r1">Option 1</Label>
      </div>
      <div className="flex items-center space-x-2">
        <RadioGroupItem value="option2" id="r2" />
        <Label htmlFor="r2">Option 2</Label>
      </div>
    </RadioGroup>
  )
}

Live Examples

Live Example
☀️
Copy
Storybook →
View Code
import { RadioGroup, RadioGroupItem, Label } from '@nostromo/ui-core' export default function RadioGroupExample() { return ( <RadioGroup defaultValue="option1"> <div className="flex items-center space-x-2"> <RadioGroupItem value="option1" id="r1" /> <Label htmlFor="r1">Option 1</Label> </div> <div className="flex items-center space-x-2">...

Props

RadioGroup

PropTypeDefaultRequiredDescription
valuestringundefinedNoSelected value (controlled)
defaultValuestringundefinedNoDefault selected value (uncontrolled)
onValueChange(value: string) => voidundefinedNoCallback when value changes
disabledbooleanfalseNoWhether the radio group is disabled
errorbooleanfalseNoWhether the radio group is in an error state
labelstringundefinedNoLabel text (alternative to Label component)
helperTextstringundefinedNoHelper text displayed below radio group
requiredbooleanfalseNoWhether the radio group is required
namestringundefinedNoName for form submission
orientation"horizontal" | "vertical""vertical"NoLayout orientation
classNamestringundefinedNoAdditional CSS classes
childrenReact.ReactNodeundefinedNoRadio items

RadioGroupItem

PropTypeDefaultRequiredDescription
valuestring-YesValue for this radio item
disabledbooleanfalseNoWhether the radio item is disabled
idstringundefinedNoRadio item ID (auto-generated if not provided)
namestringundefinedNoName for form submission
requiredbooleanfalseNoWhether the radio item is required
classNamestringundefinedNoAdditional CSS classes

Standard HTML Props

The RadioGroup component extends React.HTMLAttributes<HTMLDivElement>, and RadioGroupItem extends standard HTML input attributes (e.g., id, data-*, aria-*).