Select

Example of of result of the Select Component

The SelectComponent allows users to choose from a list of options. This component will be displayed as a dropdown menu in the admin panel. You can customize the options and set a default value. Here's how to use the SelectComponent in your Blade view:

{{ $feature->select('value')->options(['First', 'Second', 'Third']) }}

Methods

Options

options(array $options)

This method sets the list of options that users can choose from.

$feature->select('value')->options(['First', 'Second', 'Third']);

Default

default(string $default)

This method sets the default value for the dropdown menu.

$feature->select('value')->options(['First', 'Second', 'Third'])->default('Second');

Required

required()

This method makes it mandatory for users to select an option.

$feature->select('value')->options(['First', 'Second', 'Third'])->required();

Label

label(string $label)

This method sets the title for the dropdown menu in the admin panel.

$feature->select('value')->options(['First', 'Second', 'Third'])->label('Select an option');

Example

{{ $feature->select('value')->options(['First', 'Second', 'Third'])->label('Choose a value')->default('Second') }}
No more than once a month
Newsletter