-
Notifications
You must be signed in to change notification settings - Fork 251
Priority labels
See https://github.com/adaptlearning/adapt-contrib-core/pull/817 for more information.
Priority labels allow you to visually indicate which content is required or optional throughout your course. Labels can be displayed on menu items, pages, articles, blocks, and components.
By default, all content in Adapt is required for course completion unless marked as optional via the _isOptional setting. Priority labels make this distinction visible to learners by displaying "Required" or "Optional" labels alongside content headings.
Key features:
- Configure labels globally in course.json with per-content-type control
- Override global settings on individual elements
- Add custom icons to labels
- Style required and optional content differently via CSS classes
Common use cases:
- Compliance training where certain modules must be completed
- Learning paths with mandatory core content and optional enrichment
- Courses where learners need clear guidance on what they can skip
Priority labels require the following minimum plugin versions:
-
adapt-contrib-core:
[VERSION_PLACEHOLDER] -
adapt-contrib-vanilla:
[VERSION_PLACEHOLDER](for default styling) -
adapt-contrib-boxMenu:
[VERSION_PLACEHOLDER](if using Box Menu)
Other menu plugins will need updates to support priority labels on menu items.
Add the _priorityLabels object to _globals in your course.json. This controls the display of labels across all content types.
"_globals": {
"_priorityLabels": {
"_iconClassOptional": "",
"_iconClassRequired": "icon-exclamation",
"_menuItem": {
"_showWhenOptional": true,
"_showWhenRequired": false
},
"_page": {
"_showWhenOptional": true,
"_showWhenRequired": false
},
"_article": {
"_showWhenOptional": false,
"_showWhenRequired": false
},
"_block": {
"_showWhenOptional": false,
"_showWhenRequired": false
},
"_component": {
"_showWhenOptional": false,
"_showWhenRequired": false
}
}
}_iconClassOptional (string)
CSS class for the icon shown on optional content (e.g., "icon-info"). Leave empty for no icon.
_iconClassRequired (string)
CSS class for the icon shown on required content (e.g., "icon-exclamation"). Leave empty for no icon.
_menuItem, _page, _article, _block, _component (object)
Configuration for each content type with the following properties:
-
_showWhenOptional(boolean): Display the "Optional" label when_isOptional: true -
_showWhenRequired(boolean): Display the "Required" label when_isOptional: false
You can override global settings on any individual element (content objects, articles, blocks, or components):
"_priorityLabels": {
"_isOverride": true,
"_showWhenRequired": true,
"_showWhenOptional": false
}This is useful when you want different behavior for specific items. For example, you might disable labels globally for blocks but show them for one important block.
To mark content as optional, set _isOptional: true on the element:
"_isOptional": trueThis property is available on content objects (menus/pages), articles, blocks, and components.
Priority labels only appear when:
- A displayed title (
displayTitle) is present on the element - The content type has labels enabled in configuration
- The element meets the optional/required criteria for display
The framework automatically:
- Reads the global configuration from
_globals._priorityLabels - Checks if the element has a local override via
_priorityLabels._isOverride - Determines if the element is optional via
_isOptional - Sets appropriate CSS classes:
is-priority-requiredoris-priority-optional - Passes label data to templates for rendering
The label text comes from the accessibility labels defined in _globals._accessibility._ariaLabels:
"_accessibility": {
"_ariaLabels": {
"required": "Required",
"optional": "Optional"
}
}These labels are translatable and can be customized for your course.
The framework adds the following classes to elements with priority labels:
-
is-priority-required- Added when the element is required -
is-priority-optional- Added when the element is optional
These classes allow you to style required and optional content differently (e.g., different colors, borders, or backgrounds).

Priority labels displayed on Box Menu items

Priority label on a page header
Priority label on a block

Priority label on a component
This configuration displays "Optional" labels on menu items and pages, making it clear to learners which sections they can skip:
"_priorityLabels": {
"_iconClassOptional": "icon-info",
"_iconClassRequired": "",
"_menuItem": {
"_showWhenOptional": true,
"_showWhenRequired": false
},
"_page": {
"_showWhenOptional": true,
"_showWhenRequired": false
},
"_article": {
"_showWhenOptional": false,
"_showWhenRequired": false
},
"_block": {
"_showWhenOptional": false,
"_showWhenRequired": false
},
"_component": {
"_showWhenOptional": false,
"_showWhenRequired": false
}
}This configuration emphasizes required content throughout the course:
"_priorityLabels": {
"_iconClassOptional": "",
"_iconClassRequired": "icon-exclamation",
"_menuItem": {
"_showWhenOptional": false,
"_showWhenRequired": true
},
"_page": {
"_showWhenOptional": false,
"_showWhenRequired": true
},
"_article": {
"_showWhenOptional": false,
"_showWhenRequired": true
},
"_block": {
"_showWhenOptional": false,
"_showWhenRequired": true
},
"_component": {
"_showWhenOptional": false,
"_showWhenRequired": true
}
}This configuration displays labels on components to highlight which activities must be completed:
"_priorityLabels": {
"_iconClassOptional": "icon-info",
"_iconClassRequired": "icon-exclamation",
"_menuItem": {
"_showWhenOptional": false,
"_showWhenRequired": false
},
"_page": {
"_showWhenOptional": false,
"_showWhenRequired": false
},
"_article": {
"_showWhenOptional": false,
"_showWhenRequired": false
},
"_block": {
"_showWhenOptional": false,
"_showWhenRequired": false
},
"_component": {
"_showWhenOptional": true,
"_showWhenRequired": true
}
}- Priority labels respect the content hierarchy. If a parent element is optional, all its children are automatically optional, regardless of their individual settings.
- Labels only appear when a
displayTitleis present. Hidden titles will not show priority labels. - The default behavior (without any configuration) is to show no labels. You must explicitly enable them for each content type.
- When using the per-element override, you must set
"_isOverride": truefor the local settings to take effect.
- Framework in Five Minutes
- Setting up Your Development Environment
- Manual Installation of the Adapt Framework
- Adapt Command Line Interface
- Common Issues
- Reporting Bugs
- Requesting Features
- Creating Your First Course
- Styling Your Course
- Configuring Your Project with config.json
- Content starts with course.json
- Course Localisation
- Compiling, testing and deploying your Adapt course
- Core Plugins in the Adapt Learning Framework
- Converting a Course from Framework Version 1 to Version 2
- Contributing to the Adapt Project
- Git Flow
- Adapt API
- Adapt Command Line Interface
- Core Events
- Core Model Attributes
- Core Modules
- Web Security Audit
- Peer Code Review
- Plugins
- Developing Plugins
- Developer's Guide: Components
- Developer's Guide: Theme
- Making a theme editable
- Developer's Guide: Menu
- Registering a Plugin
- Semantic Version Numbers
- Core Model Attributes
- Adapt Command Line Interface
- Adapt Framework Right to Left (RTL) Support
