Skip to content

Commit

Permalink
Merge pull request #9860 from filamentphp/add-radio-button-group-api
Browse files Browse the repository at this point in the history
Support radio buttons and button group
  • Loading branch information
danharrin committed Dec 5, 2023
2 parents 900abd1 + 38e21fb commit e361051
Show file tree
Hide file tree
Showing 51 changed files with 952 additions and 564 deletions.
97 changes: 97 additions & 0 deletions docs-assets/app/app/Livewire/Forms/FieldsDemo.php
Original file line number Diff line number Diff line change
Expand Up @@ -575,6 +575,103 @@ public function form(Form $form): Form
->default('draft')
->disableOptionWhen(fn (string $value): bool => $value === 'published'),
]),
Group::make()
->id('buttonsRadio')
->extraAttributes([
'class' => 'p-16 max-w-xl',
])
->schema([
Radio::make('buttonsRadio')
->label('Status')
->buttons()
->options([
'draft' => 'Draft',
'scheduled' => 'Scheduled',
'published' => 'Published',
])
->default('draft'),
]),
Group::make()
->id('buttonsRadioInlineUnderLabel')
->extraAttributes([
'class' => 'p-16 max-w-xl',
])
->schema([
Radio::make('buttonsRadioInlineUnderLabel')
->label('Status')
->buttons()
->inline()
->inlineLabel(false)
->options([
'draft' => 'Draft',
'scheduled' => 'Scheduled',
'published' => 'Published',
])
->default('draft'),
]),
Group::make()
->id('buttonGroupRadio')
->extraAttributes([
'class' => 'p-16 max-w-xl',
])
->schema([
Radio::make('buttonGroupRadio')
->label('Status')
->buttonGroup()
->options([
'draft' => 'Draft',
'scheduled' => 'Scheduled',
'published' => 'Published',
])
->default('draft'),
]),
Group::make()
->id('radioOptionColors')
->extraAttributes([
'class' => 'p-16 max-w-xl',
])
->schema([
Radio::make('radioOptionColors')
->label('Status')
->buttonGroup()
->options([
'draft' => 'Draft',
'scheduled' => 'Scheduled',
'published' => 'Published',
])
->colors([
'draft' => 'warning',
'scheduled' => 'info',
'published' => 'success',
])
->default('draft'),
]),
Group::make()
->id('radioOptionIcons')
->extraAttributes([
'class' => 'p-16 max-w-xl',
])
->schema([
Radio::make('radioOptionIcons')
->label('Status')
->buttonGroup()
->options([
'draft' => 'Draft',
'scheduled' => 'Scheduled',
'published' => 'Published',
])
->colors([
'draft' => 'warning',
'scheduled' => 'info',
'published' => 'success',
])
->icons([
'draft' => 'heroicon-m-pencil-square',
'scheduled' => 'heroicon-m-clock',
'published' => 'heroicon-m-check-circle',
])
->default('draft'),
]),
Group::make()
->id('dateTimePickers')
->extraAttributes([
Expand Down

0 comments on commit e361051

Please sign in to comment.