mirror of
https://github.com/filamentphp/filament.git
synced 2026-10-24 23:35:30 +08:00
radio docs
This commit is contained in:
@@ -336,7 +336,7 @@ Select::make('status')
|
||||
'published' => 'Published',
|
||||
])
|
||||
->default('draft')
|
||||
->disableOptionWhen(fn ($value) => $value === 'published')
|
||||
->disableOptionWhen(fn (string $value): bool => $value === 'published')
|
||||
```
|
||||
|
||||
## Adding affix text aside the field
|
||||
|
||||
@@ -55,7 +55,7 @@ Radio::make('feedback')
|
||||
|
||||
## Positioning the options inline with the label
|
||||
|
||||
You may wish to display the options `inline()` with the label:
|
||||
You may wish to display the options `inline()` with the label instead of below it:
|
||||
|
||||
```php
|
||||
Radio::make('feedback')
|
||||
@@ -65,3 +65,19 @@ Radio::make('feedback')
|
||||
```
|
||||
|
||||

|
||||
|
||||
## 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
|
||||
use Filament\Forms\Components\Radio;
|
||||
|
||||
Radio::make('status')
|
||||
->options([
|
||||
'draft' => 'Draft',
|
||||
'scheduled' => 'Scheduled',
|
||||
'published' => 'Published'
|
||||
])
|
||||
->disableOptionWhen(fn (string $value): bool => $value === 'published')
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user