# Select

- **Section:** Components
- **URL:** https://refast.fastapicloud.dev/docs/components/select
- **Markdown:** https://refast.fastapicloud.dev/docs/components/select.md
- **Source:** https://github.com/idling-mind/refast-docs/blob/main/docs/pages/components/form_inputs/select.py
- **Live examples:** the widgets on this page need a browser; open the URL above to try them.
- **Applies to:** refast 0.12.2

A native dropdown select component. Options are plain dicts with `value` and `label` keys.
Add `"disabled": True` to an option to make it unselectable.

```python
from refast.components import Select

Select(
    name="country",
    label="Country",
    description="Select your country of residence.",
    options=[
        {"value": "us", "label": "United States"},
        {"value": "gb", "label": "United Kingdom"},
        {"value": "de", "label": "Germany", "disabled": True},
    ],
    placeholder="Choose a country…",
    required=True,
    on_change=ctx.callback(handle_change),
)
```

```python
Select(
    name="fruit",
    label="Favourite Fruit",
    options=[
        {"value": "apple", "label": "Apple"},
        ...
    ],
    placeholder="Choose a fruit…",
    disabled=False,
    required=False,
    error=None,
    on_change=ctx.callback(handle_change),
)
```

## Props

| Prop | Type | Default | Description |
|------|------|---------|-------------|
| `options` | `list[dict]` | required | List of `{"value": str, "label": str}` dicts. Add `"disabled": True` to disable an option |
| `name` | `str \| None` | `None` | HTML name attribute |
| `label` | `str \| None` | `None` | Label text |
| `description` | `str \| None` | `None` | Help text below label |
| `value` | `str \| None` | `None` | Controlled selected value |
| `default_value` | `str \| None` | `None` | Uncontrolled initial value |
| `placeholder` | `str` | `"Select..."` | Placeholder option shown when nothing is selected |
| `required` | `bool` | `False` | Shows required asterisk |
| `disabled` | `bool` | `False` | Disables the select |
| `error` | `str \| None` | `None` | Error message |
| `on_change` | `Callback \| None` | `None` | Fired when the selection changes |
| `class_name` | `str` | `""` | Extra Tailwind classes |

---

Part of the Refast documentation: [all pages](https://refast.fastapicloud.dev/llms.txt), [everything on one page](https://refast.fastapicloud.dev/llms-full.txt), [search](https://refast.fastapicloud.dev/api/search?q=save_prop).
