# [Usage](../../../usage.md) > [Components](../basics.md) > [Form](form.md) > Select

Choice field for picking one or more values from a fixed option list inside a [Form](form.md) schema. Use it instead of [Input](input.md) when free text would cause invalid data, and instead of [TextArea](text_area.md) when the answer must be constrained; switch `type` to `radio` for an always-visible single-pick presentation.

![image](img/select_1.png)

```php
@php
    $options = [
      1 => 'Option 1',
      2 => 'Option 2'
    ];
@endphp

{!! 
  \KFramework\Components\Forms\Select::make()
    ->setLabel('label')
    ->setRequired()
    ->setPostIcon('account-badge')
    ->setPlaceholder()
    ->setOptions($options) 
!!}

// Radio version

{!! 
  \KFramework\Components\Forms\Select::make()
    ->setLabel('label')
    ->setRequired()
    ->setPostIcon('account-badge')
    ->setType('radio')
    ->setOptions($options) 
!!}
```

**End-to-end example:** role picker fed from the controller.
```php
// Blade:
{!!
  \KFramework\Components\Forms\Select::make('role')
    ->setLabel('Role')
    ->setRequired()
    ->setPlaceholder('Choose a role')
    ->setOptions($options)
    ->setValue($user->role ?? null)
!!}

// Controller:
use KFramework\Components\Forms\Select;

$options = ['user' => 'User', 'admin' => 'Admin', 'editor' => 'Editor'];
$select = Select::make('role')->setLabel('Role')->setOptions($options)->setRequired();

return view('users.edit', compact('select', 'options'));
```
---
## Usage

- Blade:
```php
{!! \KFramework\Components\Forms\Select::make() !!}
```
- Controller:
```php
Select::make()
```

---
## Standard attributes

- `uuid`
- `id`
- `classes`
- `extraAttributes`
- `name`
- `label`
- `multiple` — when set, allows selecting several options at once.
- `type`
    - If not specified, it will be a standard select, if option is `radio` it will transform it in a radio buttons select, the radio accepts the `multiple` selection.
- `value` — selected key (or array of keys with `multiple`); must match an `options` key.
- `default`
- `placeholder`
- `hidden`
- `required`
- `disabled`
- `preIcon`
- `postIcon`
- `columnSpan`
- `updateOnChange` — when true, changing the selection refreshes dependent fields.

See their usage and description [here](../basics.md).

---
## Component-specific attributes

### `options` | `->setOptions()`  
  Options for the select, in form of array (key => value).  

| Types   | Default |
|---------|---------|
| `array` | `[]`    |

## See also
- [Components basics](../basics.md)
- [Form](form.md), [Input](input.md), [TextArea](text_area.md), [Checkbox](checkbox.md)
- [schema](../shared_attributes/schema.md), [value](../shared_attributes/value.md), [update_on_change](../shared_attributes/update_on_change.md)
