> ## Documentation Index
> Fetch the complete documentation index at: https://filament-34a8cf01.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Radio

> [!WARNING]
>
> You are currently viewing the documentation for Filament 4.x, which is a previous version of Filament.
>
> Looking for the current stable version? Visit the [5.x documentation](https://filament-34a8cf01.mintlify.site/5.x/forms/radio.md).

## Introduction

The radio input provides a radio button group for selecting a single value from a list of predefined options:

```php theme={"theme":"gruvbox-dark-hard"}
use Filament\Forms\Components\Radio;

Radio::make('status')
    ->options([
        'draft' => 'Draft',
        'scheduled' => 'Scheduled',
        'published' => 'Published'
    ])
```

<details>
  <summary />

  [Learn more about utility injection.](https://filament-34a8cf01.mintlify.site/4.x/forms/overview.md#field-utility-injection)
</details>

Loading preview

![Radio](https://filament-34a8cf01.mintlify.site/docs/images/4.x/light/forms/fields/radio/simple.jpg)

## Setting option descriptions

You can optionally provide descriptions to each option using the `descriptions()` method:

```php theme={"theme":"gruvbox-dark-hard"}
use Filament\Forms\Components\Radio;

Radio::make('status')
    ->options([
        'draft' => 'Draft',
        'scheduled' => 'Scheduled',
        'published' => 'Published'
    ])
    ->descriptions([
        'draft' => 'Is not visible.',
        'scheduled' => 'Will be visible.',
        'published' => 'Is visible.'
    ])
```

<details>
  <summary />

  [Learn more about utility injection.](https://filament-34a8cf01.mintlify.site/4.x/forms/overview.md#field-utility-injection)
</details>

Loading preview

![Radio with option descriptions](https://filament-34a8cf01.mintlify.site/docs/images/4.x/light/forms/fields/radio/option-descriptions.jpg)

> [!NOTE]
>
> Be sure to use the same `key` in the descriptions array as the `key` in the option array so the right description matches the right option.

## Positioning the options inline with each other

You may wish to display the options `inline()` with each other:

```php theme={"theme":"gruvbox-dark-hard"}
use Filament\Forms\Components\Radio;

Radio::make('feedback')
    ->label('Like this post?')
    ->boolean()
    ->inline()
```

Loading preview

![Inline toggle buttons](https://filament-34a8cf01.mintlify.site/docs/images/4.x/light/forms/fields/radio/inline.jpg)

Optionally, you may pass a boolean value to control if the options should be inline or not:

```php theme={"theme":"gruvbox-dark-hard"}
use Filament\Forms\Components\Radio;

Radio::make('feedback')
    ->label('Like this post?')
    ->boolean()
    ->inline(FeatureFlag::active())
```

<details>
  <summary />

  [Learn more about utility injection.](https://filament-34a8cf01.mintlify.site/4.x/forms/overview.md#field-utility-injection)
</details>

## Disabling specific options

You can disable specific options using the `disableOptionWhen()` method. It accepts a closure, in which you can check if the option with a specific `$value` should be disabled:

```php theme={"theme":"gruvbox-dark-hard"}
use Filament\Forms\Components\Radio;

Radio::make('status')
    ->options([
        'draft' => 'Draft',
        'scheduled' => 'Scheduled',
        'published' => 'Published',
    ])
    ->disableOptionWhen(fn (string $value): bool => $value === 'published')
```

<details>
  <summary />

  [Learn more about utility injection.](https://filament-34a8cf01.mintlify.site/4.x/forms/overview.md#field-utility-injection)
</details>

Loading preview

![Radio with disabled option](https://filament-34a8cf01.mintlify.site/docs/images/4.x/light/forms/fields/radio/disabled-option.jpg)

If you want to retrieve the options that have not been disabled, e.g. for validation purposes, you can do so using `getEnabledOptions()`:

```php theme={"theme":"gruvbox-dark-hard"}
use Filament\Forms\Components\Radio;

Radio::make('status')
    ->options([
        'draft' => 'Draft',
        'scheduled' => 'Scheduled',
        'published' => 'Published',
    ])
    ->disableOptionWhen(fn (string $value): bool => $value === 'published')
    ->in(fn (Radio $component): array => array_keys($component->getEnabledOptions()))
```

For more information about the `in()` function, please see the [Validation documentation](https://filament-34a8cf01.mintlify.site/4.x/forms/validation.md#in).

## Boolean options

If you want a simple boolean radio button group, with "Yes" and "No" options, you can use the `boolean()` method:

```php theme={"theme":"gruvbox-dark-hard"}
use Filament\Forms\Components\Radio;

Radio::make('feedback')
    ->label('Like this post?')
    ->boolean()
```

Loading preview

![Boolean radio](https://filament-34a8cf01.mintlify.site/docs/images/4.x/light/forms/fields/radio/boolean.jpg)

To customize the "Yes" label, you can use the `trueLabel` argument on the `boolean()` method:

```php theme={"theme":"gruvbox-dark-hard"}
use Filament\Forms\Components\Radio;

Radio::make('feedback')
    ->label('Like this post?')
    ->boolean(trueLabel: 'Absolutely!')
```

To customize the "No" label, you can use the `falseLabel` argument on the `boolean()` method:

```php theme={"theme":"gruvbox-dark-hard"}
use Filament\Forms\Components\Radio;

Radio::make('feedback')
    ->label('Like this post?')
    ->boolean(falseLabel: 'Not at all!')
```

Loading preview

![Boolean radio with custom labels](https://filament-34a8cf01.mintlify.site/docs/images/4.x/light/forms/fields/radio/boolean-custom-labels.jpg)

[Edit this page on GitHub](https://github.com/filamentphp/filament/edit/4.x/packages/forms/docs/07-radio.md)

## Sponsored by

[Your logo here](https://github.com/sponsors/danharrin)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.