1Checkbox::make()2 ->name('featured')
1<x-twill::checkbox2 name="featured"3 label="Featured"4/>
1@formField('checkbox', [2 'name' => 'featured',3 'label' => 'Featured'4])
Option | Description | Type | Default value |
---|---|---|---|
name | Name of the field | string | |
label | Label of the field | string | |
note | Hint message displayed below the label | string | |
default | Sets a default value | boolean | false |
disabled | Disables the field | boolean | false |
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 ?' |
border | Draws a border around the field | boolean | false |
1Checkboxes::make()2 ->name('sectors')3 ->options(4 Options::make([5 Option::make('value', 'label'),6 ...7 ])8 );
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@endphp17 18<x-twill::checkboxes19 name="sectors"20 label="Sectors"21 note="3 sectors max"22 :min="1"23 :max="3"24 :inline="true"25 :options="$options"26/>
1@formField('checkboxes', [ 2 'name' => 'sectors', 3 'label' => 'Sectors', 4 'note' => '3 sectors max & at least 1 sector', 5 'min' => 1, 6 'max' => 3, 7 'inline' => true, 8 'options' => [ 9 [10 'value' => 'arts',11 'label' => 'Arts & Culture'12 ],13 [14 'value' => 'finance',15 'label' => 'Banking & Finance'16 ],17 [18 'value' => 'civic',19 'label' => 'Civic & Public'20 ],21 ]22])
Option | Description | Type | Default value |
---|---|---|---|
name | Name of the field | string | |
label | Label of the field | string | |
min | Minimum number of selectable options | integer | |
max | Maximum number of selectable options | integer | |
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 |
note | Hint message displayed above the field | string | |
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) |