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. Think of the contacts in your phone. When you use your contact list to dial someone, you are selecting from a list of options, and your phone uses the selected value (the phone number) to dial the person.
- Code list: A list of codes and their corresponding value and texts. Think of
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 list of options, configure that option list to be used in a component, as well as common functionality supported across these components.
- Sources
The different sources for options in Altinn Studio
- Functionality
Common functionality for all option sources