Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 22 additions & 1 deletion guides/ingredients.md
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ Stores a `Boolean` value in the database. Renders a checkbox in the editor parti

## Select

Renders a select box in the editor partial and stores the value as `String`.
Renders a select box in the editor partial and stores the value as `String`. When configured for multiple selection, it stores the values as an `Array`.

Useful for letting your user select from a limited set of choices.

Expand All @@ -235,13 +235,34 @@ Useful for letting your user select from a limited set of choices.

A list of values your users can select from. Use [a two dimensional array](https://guides.rubyonrails.org/form_helpers.html#the-select-and-option-tags) for having value and text pairs.

* **multiple** `Boolean` (default: false)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need a note about the minor version this was introduced. 8.1 in this case


If set to `true`, the user can select multiple values from the list. The selected values will be stored as an `Array` instead of a single `String`.

* **default** `String` (optional)

A default value to prefill newly created elements. The value must be one of the values from `select_values`.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The value must be one of the values from select_values.

No, the value must not be one of the select_values. It can be any value.


### Example

Single selection (default):

~~~ yaml
- name: width
type: Select
settings:
select_values: ['200', '300', '400']
default: '300'
~~~

Multiple selection:

~~~ yaml
- name: categories
type: Select
settings:
select_values: ['Technology', 'Design', 'Marketing', 'Sales']
multiple: true
~~~

::: tip
Expand Down