# Optgroup

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

## Parameters

This component can take various optional configuration params and yields a block.

### Disabled (optional)

Expects a boolean to specify if the `<optgroup>` should be disabled. Defaults to `false`, so if not specified otherwise optgroups are **not disabled**.

### Label (optional)

Expects a string which will be displayed as the label inside the `<optgroup>` tag.

### HMTL attributes (optional)

This component accepts all the canonical [HTML global attributes](https://www.w3schools.com/tags/ref_standardattributes.asp) like `id` or `class`.

## Examples

### Example 1: Yield a given block

```ruby
optgroup label: 'Swedish Cars' do
  option text: 'Volvo', value: 'volvo'
  option text: 'Saab', value: 'saab'
end
```

returns

```markup
<optgroup label="Swedish Cars">
  <option value="volvo">Volvo</option>
  <option value="saab">Saab</option>
</optgroup>
```

### Example 2: Using disabled configuration

```ruby
optgroup label: 'Disabled Group', disabled: true, id: 'disabled-group' do
  option text: 'Option J'
  option text: 'Option K'
  option text: 'Option L'
end
```

returns

```markup
<optgroup disabled="disabled" id="disabled-group" label="Disabled Group">
  <option>Option J</option>
  <option>Option K</option>
  <option>Option L</option>
</optgroup>
```


---

# Agent Instructions: 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/optgroup.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.
