Overview
The toggle buttons input provides a group of buttons for selecting a single value, or multiple values, from a list of predefined options:Changing the color of option buttons
You can change the color of the option buttons using thecolors() method. Each key in the array should correspond to an option value, and the value may be either danger, gray, info, primary, success or warning:
HasColor interface to define colors instead.
Adding icons to option buttons
You can add icon to the option buttons using theicons() method. Each key in the array should correspond to an option value, and the value may be any valid Blade icon:
HasIcon interface to define icons instead.
If you want to display only icons, you can use hiddenButtonLabels() to hide the option labels.
Boolean options
If you want a simple boolean toggle button group, with “Yes” and “No” options, you can use theboolean() method:
colors() or icons().
Positioning the options inline with each other
You may wish to display the optionsinline() with each other:
Grouping option buttons
You may wish to group option buttons together so they are more compact, using thegrouped() method. This also makes them appear horizontally inline with each other:
Selecting multiple buttons
Themultiple() method on the ToggleButtons component allows you to select multiple values from the list of options:
array cast to the model property:
Splitting options into columns
You may split options into columns by using thecolumns() method:
columns() method of the grid. This allows you to responsively customize the number of columns at various breakpoints.
Setting the grid direction
By default, when you arrange buttons into columns, they will be listed in order vertically. If you’d like to list them horizontally, you may use thegridDirection('row') method:
Disabling specific options
You can disable specific options using thedisableOptionWhen() method. It accepts a closure, in which you can check if the option with a specific $value should be disabled:
getEnabledOptions():