MultiSelect component | Genius
The MultiSelect lets end users pick several related records at once, such as time slots for a booking, departments for an asset or roles for a user. It writes the IDs of the selected records to a has-many or has-and-belongs-to-many (HABTM) relation.
What the MultiSelect is
The MultiSelect is a container, not a dropdown. You give it a Collection page variable, and it repeats its children once for every record in that collection. The children can be any component: a Checkbox, a Switch, a clickable Box that works as a tile, or a chip. That's what makes it flexible. You decide what every option looks like.
The MultiSelect keeps the selection in its own state, MultiSelect.Value: a list of the selected record IDs. The children read that list to show whether they're selected, and they change it through an interaction. Inside a Form, the list is saved to the relation on submit.
MultiSelect or MultiAutocomplete?
Both save to a to-many relation. Pick the one that fits the number of options and the look you need.
|
MultiSelect |
Multi Autocomplete |
|
|---|---|---|
|
Looks like |
Your own components: checkboxes, switches, tiles, chips |
A dropdown with search |
|
Best for |
A short list users can see at a glance |
Long lists where users search for an option |
|
Layout |
Vertical, horizontal or grid |
Fixed dropdown |
|
Extra content per option |
Yes, anything you place inside |
No, only the option label |
|
Setup effort |
More: you wire the children yourself (or let Genius do it) |
Less: bind the property and pick the options source |
See Form inputs and controls for the Multi Autocomplete and the other Genius input components.
Options
The MultiSelect has the baseline input options plus a few of its own. The data source and the property are the two you always set.
|
Option |
What it does |
|---|---|
|
Property |
The has-many or HABTM relation the selection is saved to inside a Form. Other kinds can't be selected. |
|
Page variable |
The Collection page variable that holds the options. The MultiSelect repeats its children for every record in it. |
|
Placeholder rows |
How many example rows the canvas shows while you design. Has no effect at runtime. |
|
Options layout |
Vertical, Horizontal or Grid. With Grid you also set the number of Columns. |
|
Label |
The label above the options. |
|
Default value |
The records that are selected when the page loads, for example the relational ID of the record you're editing. |
|
Helper text |
A short hint under the options. |
|
Required |
Makes at least one selection mandatory. Comes with a Value required message. |
|
Minimum selections / Maximum selections |
Limits the number of selected options, each with its own message. |
|
Disabled |
Makes the whole MultiSelect read-only. |
|
Display logic |
Shows or hides the MultiSelect based on a condition. |
The MultiSelect also exposes an On change event in its interactions.
Components you drop inside the MultiSelect don't get a Property of their own. Their Property option tells you the parent MultiSelect saves the value.
How it works
Every option inside the MultiSelect needs two settings: one to show whether it's selected, and one to change the selection. Together they keep the option and MultiSelect.Value in sync.

The children read MultiSelect.Value to show their state and change it with Toggle item in collection; a Form saves the list to the relation.
1. Show the selection: a data condition on the child's Default value. Set the Default value of the Checkbox or Switch to On data condition with the rule MultiSelect.Value includes Iterator.Id. Iterator is the record of the current row in the page variable. Component options such as MultiSelect.Value are new on the left-hand side of a condition. You find them under the Components tab of the picker.
2. Change the selection: Toggle item in collection. Add an interaction to the child: On change for a Checkbox or Switch, On click for a Box used as a tile. Pick the function Toggle item in collection and set:
- Custom collection:
MultiSelect.Value(Components tab) - Item to toggle:
Iterator.Id
Each toggle adds the ID to the list or removes it. The same two rules work for any other component you use as an option. A Text that says "Selected" next to the option, for example, gets display logic with the same MultiSelect.Value includes Iterator.Id rule.
On page load, the MultiSelect applies its Default value and the children reflect it. On change doesn't fire on load.
Build it step by step
This example lets a user pick departments for an asset, shown as switches. It assumes an Asset model with a HABTM relation Departments to a Department model.
- Add a Collection page variable on Department, for example
Departments. Add a filter if users should only see part of the records. - Drag a MultiSelect onto the page (inside a Form if the selection must be saved, see the next section).
- Set Property to
Asset.Departmentsand Page variable toDepartments. - Choose an Options layout, for example Grid with 3 columns.
- Drag a Switch inside the MultiSelect. Set its label to the department name,
Department.Name. - Set the Switch's Default value to On data condition:
MultiSelect.ValueincludesDepartment.Id. - On the Switch, add the interaction On change → Toggle item in collection, with Custom collection
MultiSelect.Valueand Item to toggleDepartment.Id. - Compile the page and test it: every click adds or removes a department.
Want tiles instead of switches? Drop a Box inside the MultiSelect, put the content of the tile in it and use On click in step 7. Use display logic with the same rule to show a selected state, for example a check icon.
Using it inside a Form
Inside a Form, the selected IDs are saved to the has-many or HABTM relation on submit. The action receives them as a list of IDs, and the create or update step maps the relation straight from that list (for example departments → payload.departments). You don't need a separate collection or filter in the action.
On an edit form, always set the Default value. Point the MultiSelect's Default value at the relation of the record you're editing, for example asset.Departments. Then the records that are already linked show as selected when the page loads.
Saving replaces the relation with what's selected at that moment. If the Default value is empty, the form starts with nothing selected, and saving without ticking anything unlinks every existing record.
You can also use the MultiSelect outside a Form. Then nothing is saved automatically: run an action from a button and pass MultiSelect.Value to it. The MultiSelect's On change event doesn't fire yet when an option is toggled (see Known limitations), so don't rely on it to save.
Generating it with Genius
Genius knows the MultiSelect. Ask for a multi-select and describe how the options should look. Genius places the children, adds the condition and the Toggle item in collection interaction, and inside a Form it binds the relation and maps it in the action. A "clear selection" button uses Set values to set MultiSelect.Value to an empty list.
Prompts that work well:
- Tiles: "Make a page that shows one event. Below the event details, show the questions of this event as clickable tiles in a multi-select, so I can select several questions. A selected tile gets a primary-colored border, an unselected tile a light gray border. Clicking anywhere on the tile selects or deselects it."
- Checkboxes with a clear button: "Make a page that shows one event. Below the event details, show a multi-select with a checkbox for each question of this event, so I can tick several questions. Show the question text as the checkbox label. Add a 'Clear selection' button above the list that unticks all questions."
- Form on a has-many relation: "Make an edit page for an event with a form. Besides the title, description, start date and location, the form has a multi-select with a checkbox for each question, so I can choose which questions belong to this event. Saving the form stores the event together with its selected questions."
- Form on a HABTM relation: "Make an edit page for a user with a form. Besides the user's name and email, the form has a multi-select with a checkbox for each role, so I can choose which roles the user has. Saving the form stores the user together with the selected roles."
Genius doesn't always configure everything. After generating, check these in the page builder:
- Default value of the MultiSelect on edit pages points at the record's relation, so saved selections are pre-filled.
- Filter on the options page variable, if users should only see part of the records.
- Each child's Default value uses
MultiSelect.ValueincludesIterator.Id. - Each child has the Toggle item in collection interaction.
- The action sets the relation, not only the other fields.
A MultiSelect in every row of a list
You can place a MultiSelect inside a Collection, so every row gets its own selection. A typical case is a dynamic questionnaire: an admin maintains the questions and their options as data, and every question shows its options as checkboxes. Each row keeps its own state, and one Save button can send all rows to one action.
The setup is the same as before, with two differences:
- Filter the options per row. The options page variable of the MultiSelect gets a filter on the row, for example
Option.Question.Id=Answer.Question.Id. Without it, every row shows every option. - Pick the MultiSelect of the same row. In the condition and in Toggle item in collection, the Components tab lists the MultiSelect of the current row. Components outside the list don't offer it.
An example prompt for Genius:
Create a page "Bulk edit answers" where the visitor edits every answer of the questionnaire inline in one list and saves all rows at once with ONE Save button that sends all edited rows to one action. Questions have a label; a question has many options (label). An answer belongs to a question, has a text value and a many-to-many relation "selected options" to Option. Each row shows the question label, a text input for the answer's text value, and a multi-select for the answer's selected options, pre-filled with the answer's saved options, whose options are ONLY the options of that row's question, shown as switches.
Afterwards, check the per-row filter and that the save action updates the selected options, not only the text value.
Known limitations and workarounds
The MultiSelect is new, and a few things don't work as expected yet. These are known and reported.
|
What happens |
Workaround |
|---|---|
|
On change doesn't fire when an option is toggled. Toggle item in collection updates |
Run the action from a button, or save through a Form. |
|
|
Place a second MultiSelect with the same Default value that users don't touch, and use its |
|
Default value and Value use different types. Default value holds a list of numbers, Value a list of strings. |
Keep this in mind when you compare the two in a condition or an action. |
|
Reset values doesn't clear a MultiSelect in a create modal. |
Use Set values to set |
|
No conditional styling option. |
Show a different component for the selected state with display logic on |
Run into something that isn't on this list? Post it in the Betty Blocks Community with the page and the steps to reproduce it.