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 like id or class.

Examples

Example 1: Yield a given block

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

returns

Example 2: Using disabled configuration

returns

Last updated

Was this helpful?