> For the complete documentation index, see [llms.txt](https://docs.matestack.io/matestack-ui-core/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.matestack.io/matestack-ui-core/1.5.0/components-api/core-components/option.md).

# Option

The HTML `<option>` tag, implemented in Ruby.

## Parameters

This component can take 7 optional configuration params and either yield content or display what gets passed to the `text` configuration param.

### id (optional)

Expects a string with all ids the `<option>` should have.

### class (optional)

Expects a string with all classes the `<option>` should have.

### disabled (optional)

Specifies that the `<option>` should be disabled.

### label (optional)

Specifies a shorter label for the `<option>`.

### text (optional)

Specifies the text the `<option>` should contain.

### selected (optional)

Specifies that the `<option>` should be pre-selected when the page loads.

### value (optional)

Specifies the value to be sent to a server.

## Example 1: Render `options[:text]` param

```ruby
option text: 'Option 1'
```

returns

```markup
<option>Option 1</option>
```

## Example 2: Render `options[:label]` param

```ruby
option label: 'Option 2'
```

returns

```markup
<option label="Option 2"></option>
```

## Example 3: Render with more attributes

```ruby
option disabled: true, label: 'Option 3', selected: true, value: '3'
```

returns

```markup
<option disabled="disabled" label="Option 3" selected="selected" value="3"></option>
```

## Example 4: Yield a given block

```ruby
option id: 'foo', class: 'bar' do
  plain 'Option 4'
end
```

returns

```markup
<option id="foo" class="bar">
  Option 4
</option>
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.matestack.io/matestack-ui-core/1.5.0/components-api/core-components/option.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
