Code lists and options
How to set up code lists for components that use options
Several of the form components in Altinn 3 use options. By options, we mean a list of choices that can be selected by the user. In the most basic use cases you might set up a list of options directly in the component configuration, but often you’ll want to fetch the options from a code list.
Terms
There are subtle differences between the terms options and code lists:
- Options: A list of choices that can be selected by the user. As an example, think of the contacts in your phone. When you use your contact list to call someone, you are selecting from a list of options, and your phone uses the selected value (the phone number) to call the person.
- Code list: A list of codes and their corresponding value and texts. This can for example be
the ISO 3166-1 country codes. This list contains codes (like
NO
orSE
) and their corresponding labels (likeNorway
orSweden
).
When selecting a value from (for example) a Dropdown component, you are selecting from a list of options, which might be sourced from a code list. In that case, options is what they are, and a code list is where they came from.
Supported components
The following components support options:
Component | Type | Use case |
---|---|---|
Dropdown | Single choice | Used to select a single option from a dropdown list. |
RadioButtons | Single choice | Used to select a single option from a list of radio buttons. |
List | Single choice | Used to select a single option from a list/table (with one radio button per row). |
Likert | Single choice per row | Used to select a single option per row in a table, displayed as a scale. Commonly used in surveys. |
Checkboxes | Multiple choice | Used to select one or more options from a list of checkboxes. |
MultipleSelect | Multiple choice | Used to select one or more options from a dropdown list. |
FileUploadWithTag | Single choice | Used to upload a file and tag it with an option. |
In the categories below, you can learn more about how to produce a code list, configure that list to be used in a component in order to provide options in that component, as well as common functionality across the previously mentioned components that support options.
- Sources
The different sources for options in Altinn Studio
- Functionality
Common functionality for all option sources