Select

The HTML <select> tag, implemented in Ruby.

If you want to use the select in context of a matestack form, please use form_select documented here

Parameters

This component can take various optional configuration params and yield content

HMTL attributes (optional)

This component accepts all the canonical HTML global attributes like id or class.

Examples

Example 1: Basic usage along with option components

select id: "foo", class: "bar" do
  option label: 'Option 1', value: '1', selected: true
  option label: 'Option 2', value: '2'
  option label: 'Option 3', value: '3'
end

returns

<select id="foo" class="bar">
  <option  label="Option 1" selected="selected" value="1"></option>
  <option  label="Option 2" value="2"></option>
  <option  label="Option 3" value="3"></option>
</select>

Last updated