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

returns

Example 2: Render options[:label] param

returns

Example 3: Render with more attributes

returns

Example 4: Yield a given block

returns

Last updated

Was this helpful?