Choice
Choice presents a small set of options inline, so every option is visible at once. Use it instead of
a Select when there are only a handful of choices. Create one with
Choice::make() and pass the options with ->options().
Choice::make('plan', 'Plan') ->options([ Choice::option('Free', 'free'), Choice::option('Pro', 'pro'), Choice::option('Enterprise', 'enterprise'), ])- autoFocus:false
- columnWidth:"md"
- conditions:null
- dependsOnAny:false
- dependsOnKeys:null
- disabled:false
- editablePrefill:false
- helperText:null
- hidden:false
- label:"Plan"
- name:"plan"
- options:[{"label":"Free","value":"free"},{"label":"Pro","value":"pro"},{"label":"Enterprise","value":"enterprise"}]
- prefillRefreshOn:null
- prefillResetOn:null
- readOnly:false
- required:false
- tabIndex:null
- tooltip:null
- value:null
Options from an enum
Section titled “Options from an enum”->enum() builds the options from a backed enum. Pass the enum class for every case, or an array of
cases for a subset. Labels come from the enum’s HasLabel contract when it implements one, otherwise
the case name is humanized.
Choice::make('plan', 'Plan')->enum(Plan::class);Common options
Section titled “Common options”Choice shares label, default value, required, disabled, read-only, and visibility options with
every field — see Fields. For validation and conditional behavior, see
Validation and Conditional fields.