Last modified: Dec 19, 2024

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 or SE) and their corresponding labels (like Norway or Sweden).

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:

ComponentTypeUse case
DropdownSingle choiceUsed to select a single option from a dropdown list
RadioButtonsSingle choiceUsed to select a single option from a list of radio buttons
ListSingle choiceUsed to select a single option from a list/table (with one radio button per row)
LikertSingle choice per rowUsed to select a single option per row in a table, displayed as a scale. Commonly used in surveys.
CheckboxesMultiple choiceUsed to select one or more options from a list of checkboxes
MultipleSelectMultiple choiceUsed to select one or more options from a dropdown list
FileUploadWithTagSingle choiceUsed 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