Radio

screenshot

1Radios::make()
2 ->name('sectors')
3 ->inline()
4 ->border()
5 ->options(
6 Options::make([
7 Option::make('value', 'label'),
8 ...
9 ])
10 );
1@php
2 $options = [
3 [
4 'value' => 'arts',
5 'label' => 'Arts & Culture'
6 ],
7 [
8 'value' => 'finance',
9 'label' => 'Banking & Finance'
10 ],
11 [
12 'value' => 'civic',
13 'label' => 'Civic & Public'
14 ],
15 ];
16@endphp
17 
18<x-twill::radios
19 name="discipline"
20 label="Discipline"
21 default="civic"
22 :inline="true"
23 :options="$options"
24/>
1@formField('radios', [
2 'name' => 'discipline',
3 'label' => 'Discipline',
4 'default' => 'civic',
5 'inline' => true,
6 'options' => [
7 [
8 'value' => 'arts',
9 'label' => 'Arts & Culture'
10 ],
11 [
12 'value' => 'finance',
13 'label' => 'Banking & Finance'
14 ],
15 [
16 'value' => 'civic',
17 'label' => 'Civic & Public'
18 ],
19 ]
20])
Option Description Type Default value
name Name of the field string
label Label of the field string
note Hint message displayed above the field string
options Array of options for the dropdown, must include value and label array
inline Defines if the options are displayed on one or multiple lines boolean false
default Sets a default value string
requireConfirmation Displays a confirmation dialog when modifying the field boolean false
confirmTitleText The title of the confirmation dialog string 'Confirm selection'
confirmMessageText The text of the confirmation dialog string 'Are you sure you want to change this option ?'
required Displays an indicator that this field is required
A backend validation rule is required to prevent users from saving
boolean false
border Draws a border around the field boolean false
columns Aligns the options on a grid with a given number of columns integer 0 (off)
disabled Disables the field boolean false