# Radio Group

> A native radio group with vertical and horizontal orientations.

- Tier: free, MIT
- Category: Forms
- Docs: https://ui.mlola.com/docs/components/radio-group

## Install

```bash
npx mlola-ui add radio-group
```

```tsx
import { RadioGroup } from "@/components/ui/radio-group";
```

## Props with fixed values

| Component | Prop | Values | Default | Description |
| --- | --- | --- | --- | --- |
| RadioGroup | `orientation` | `horizontal`, `vertical` | `vertical` |  |

## Example

```tsx
import { RadioGroup, RadioGroupItem } from "@/components/ui/radio-group";

export default function Example() {
  return (
    <RadioGroup label="Billing" defaultValue="yearly" name="billing">
      <RadioGroupItem value="monthly" label="Monthly" />
      <RadioGroupItem value="yearly" label="Yearly" description="Two months free." />
    </RadioGroup>
  );
}
```

## The same markup without React

```html
<div class="ml-radio-group" role="radiogroup" aria-labelledby="billing-label" aria-orientation="vertical" data-orientation="vertical">
  <div class="ml-radio-group-label" id="billing-label">Billing</div>
  <div class="ml-radio-group-items">
    <label class="ml-radio-item" for="billing-1" data-state="unchecked"><span class="ml-radio-control"><input class="ml-radio-input" id="billing-1" type="radio" name="billing" value="monthly"/><span class="ml-radio-indicator" aria-hidden="true"></span></span><span class="ml-radio-copy"><span class="ml-radio-label">Monthly</span></span></label>
    <label class="ml-radio-item" for="billing-2" data-state="checked"><span class="ml-radio-control"><input class="ml-radio-input" id="billing-2" type="radio" aria-describedby="billing-2-description" name="billing" checked="" value="yearly"/><span class="ml-radio-indicator" aria-hidden="true"></span></span><span class="ml-radio-copy"><span class="ml-radio-label">Yearly</span><span class="ml-radio-description" id="billing-2-description">Two months free.</span></span></label>
  </div>
</div>
```
