@canonical/design-system 0.44.0 → 0.47.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/data/apps/component/file_tree.ttl +1 -1
- package/data/apps/component/inline_panel.ttl +17 -0
- package/data/apps/{subcomponent → component}/log.ttl +1 -1
- package/data/apps/component/navigation.ttl +1 -1
- package/data/apps/component/notification.ttl +1 -1
- package/data/apps/component/side_navigation.ttl +50 -6
- package/data/apps/group/notifications.ttl +1 -1
- package/data/apps/layout/application_layout.ttl +1 -1
- package/data/apps/layout/content_layout.ttl +2 -3
- package/data/apps/layout/empty_layout.ttl +1 -1
- package/data/apps/layout/empty_state.ttl +1 -1
- package/data/apps/layout/login_layout.ttl +12 -0
- package/data/apps/layout/side_panel_form_layout.ttl +13 -0
- package/data/apps/pattern/action_bar.ttl +2 -2
- package/data/apps/pattern/code_diff.ttl +1 -1
- package/data/apps/pattern/data_views.ttl +85 -0
- package/data/apps/pattern/datatable.ttl +20 -91
- package/data/apps/pattern/destructive_modal.ttl +1 -1
- package/data/apps/pattern/drawer.ttl +1 -1
- package/data/apps/pattern/notification_center.ttl +2 -2
- package/data/apps/pattern/page_header.ttl +58 -0
- package/data/apps/pattern/side_panel.ttl +258 -10
- package/data/apps/subcomponent/data_table-action_bar.ttl +8 -8
- package/data/apps/subcomponent/data_table-body_cell.ttl +26 -26
- package/data/apps/subcomponent/data_table-group_header_row.ttl +8 -8
- package/data/apps/subcomponent/data_table-header_cell.ttl +13 -13
- package/data/apps/subcomponent/data_table-pagination_bar.ttl +11 -11
- package/data/apps/subcomponent/data_table-persistent_selection.ttl +10 -10
- package/data/apps/subcomponent/data_table-settings_menu.ttl +15 -15
- package/data/apps/subcomponent/data_views-filters.ttl +13 -0
- package/data/apps/subcomponent/data_views-saved_views.ttl +13 -0
- package/data/apps/subcomponent/data_views-sort_panel.ttl +13 -0
- package/data/apps/subcomponent/drawer-content.ttl +1 -1
- package/data/apps/subcomponent/drawer-footer.ttl +1 -1
- package/data/apps/subcomponent/drawer-header.ttl +1 -1
- package/data/apps/subcomponent/side_navigation-content.ttl +13 -0
- package/data/apps/subcomponent/side_navigation-context_switcher.ttl +53 -0
- package/data/apps/subcomponent/side_navigation-item.ttl +80 -0
- package/data/apps/subcomponent/side_navigation-item_group.ttl +13 -0
- package/data/apps/subcomponent/side_panel-content.ttl +2 -2
- package/data/apps/subcomponent/side_panel-footer.ttl +196 -3
- package/data/apps/subcomponent/side_panel-header.ttl +212 -3
- package/data/apps_anbox/component/theme_switcher.ttl +1 -1
- package/data/apps_anbox/pattern/side_menu.ttl +0 -1
- package/data/{tagcategory/lpupstream.ttl → apps_identity.ttl} +2 -2
- package/data/apps_landscape/component/checkbox_group.ttl +24 -24
- package/data/apps_landscape/component/code_editor.ttl +35 -35
- package/data/apps_landscape/component/cron_schedule.ttl +4 -4
- package/data/apps_landscape/component/expandable_radio_group.ttl +47 -47
- package/data/apps_landscape/component/expandable_truncation.ttl +20 -20
- package/data/apps_landscape/component/form_section.ttl +4 -4
- package/data/apps_landscape/component/gpg_key_field.ttl +27 -27
- package/data/apps_landscape/component/grouped_select.ttl +25 -25
- package/data/apps_landscape/component/loading_state.ttl +8 -8
- package/data/apps_landscape/component/managed_file_input.ttl +18 -18
- package/data/apps_landscape/component/multi_select_field.ttl +50 -50
- package/data/apps_landscape/component/password_constraints.ttl +1 -1
- package/data/apps_landscape/component/progress_bar.ttl +20 -20
- package/data/apps_landscape/component/read_only_field.ttl +15 -15
- package/data/apps_landscape/component/search_help_popup.ttl +10 -10
- package/data/apps_landscape/component/search_query_editor.ttl +33 -33
- package/data/apps_landscape/component/tag_multi_select.ttl +9 -9
- package/data/apps_landscape/pattern/content_blocks.ttl +20 -20
- package/data/apps_landscape/pattern/dashboard_page_composition.ttl +37 -37
- package/data/apps_landscape/pattern/delivery_scheduling.ttl +6 -6
- package/data/apps_landscape/pattern/form_field_help.ttl +28 -28
- package/data/apps_landscape/pattern/header_search_controls.ttl +41 -41
- package/data/apps_landscape/pattern/ignorable_notification.ttl +16 -16
- package/data/apps_landscape/pattern/information_grid.ttl +14 -14
- package/data/apps_landscape/pattern/instance_association.ttl +5 -5
- package/data/apps_landscape/pattern/process_flow.ttl +11 -11
- package/data/apps_landscape/pattern/progressively_expandable_table.ttl +32 -32
- package/data/apps_landscape/pattern/recurring_schedule.ttl +3 -3
- package/data/apps_landscape/pattern/responsive_action_group.ttl +12 -12
- package/data/apps_landscape/pattern/responsive_header_actions.ttl +14 -14
- package/data/apps_landscape/pattern/responsive_table_filters.ttl +11 -11
- package/data/apps_landscape/pattern/side_panel_form_actions.ttl +40 -40
- package/data/apps_landscape/pattern/sortable_list.ttl +14 -14
- package/data/apps_landscape/pattern/table_filter.ttl +57 -57
- package/data/apps_landscape/pattern/table_filter_chips.ttl +67 -67
- package/data/apps_landscape/pattern/table_pagination.ttl +63 -63
- package/data/apps_landscape/pattern/typed_confirmation_modal.ttl +22 -22
- package/data/apps_landscape/subcomponent/bold_substring.ttl +4 -4
- package/data/apps_landscape/subcomponent/inline_cell_input.ttl +8 -8
- package/data/apps_landscape/subcomponent/label_with_description.ttl +14 -14
- package/data/apps_landscape/subcomponent/nested_dropdown_item.ttl +8 -8
- package/data/apps_landscape/subcomponent/pluralized_bold_count.ttl +7 -7
- package/data/apps_landscape/subcomponent/select_all_results_prompt.ttl +12 -12
- package/data/apps_launchpad/component/avatar.ttl +2 -2
- package/data/apps_launchpad/component/badge.ttl +2 -2
- package/data/apps_launchpad/component/breadcrumbs.ttl +1 -1
- package/data/apps_launchpad/component/button.ttl +2 -2
- package/data/apps_launchpad/component/checkbox_input.ttl +4 -4
- package/data/apps_launchpad/component/combobox.ttl +2 -2
- package/data/apps_launchpad/component/drawer.ttl +4 -4
- package/data/apps_launchpad/component/modal.ttl +4 -12
- package/data/apps_launchpad/component/radio_input.ttl +5 -5
- package/data/apps_launchpad/component/select_input.ttl +1 -1
- package/data/apps_launchpad/component/switch.ttl +5 -5
- package/data/apps_launchpad/component/text_input.ttl +8 -8
- package/data/apps_launchpad/component/textarea_input.ttl +10 -10
- package/data/apps_launchpad/component/tooltip.ttl +3 -3
- package/data/apps_launchpad/subcomponent/combobox-loading.ttl +2 -2
- package/data/apps_launchpad/subcomponent/combobox-search.ttl +4 -4
- package/data/apps_launchpad/subcomponent/description_list-item.ttl +1 -1
- package/data/apps_launchpad/subcomponent/modal-content.ttl +2 -2
- package/data/apps_lxd/component/back_link.ttl +1 -1
- package/data/apps_lxd/component/code_snippet_with_copy_button.ttl +1 -1
- package/data/apps_lxd/component/doc_link.ttl +2 -2
- package/data/apps_lxd/component/meter.ttl +5 -5
- package/data/apps_lxd/component/output_field.ttl +2 -3
- package/data/apps_lxd/component/rename_header.ttl +15 -15
- package/data/apps_lxd/component/tab_links.ttl +4 -4
- package/data/apps_lxd/subcomponent/copy_to_clipboard.ttl +2 -2
- package/data/apps_lxd/view/network_topology.ttl +3 -4
- package/data/apps_portal/layout/details_view.ttl +0 -1
- package/data/{apps_workplaceengineering → apps_workplace}/component/complex_multi_select.ttl +3 -3
- package/data/{apps_workplaceengineering → apps_workplace}/component/label-highlight.ttl +5 -6
- package/data/apps_workplace/component/org_chart.ttl +12 -0
- package/data/{apps_workplaceengineering → apps_workplace}/component/rule.ttl +2 -2
- package/data/{apps_workplaceengineering → apps_workplace}/component/skip_link.ttl +2 -2
- package/data/{apps_workplaceengineering → apps_workplace}/component/theme_switcher.ttl +3 -3
- package/data/{apps_workplaceengineering → apps_workplace}/pattern/callout_numbers_card.ttl +4 -4
- package/data/{apps_workplaceengineering → apps_workplace}/pattern/confirmation_modal.ttl +2 -2
- package/data/apps_workplace/pattern/org_event_card.ttl +12 -0
- package/data/apps_workplace/subcomponent/multi_select_input.ttl +12 -0
- package/data/{apps_workplaceengineering.ttl → apps_workplace.ttl} +2 -2
- package/data/concept/Accessibility.ttl +9 -0
- package/data/concept/Breakpoints.ttl +9 -0
- package/data/concept/Design-tokens-Overview.ttl +10 -0
- package/data/concept/Filtering-patterns.ttl +10 -0
- package/data/concept/Foundations-Baseline.ttl +0 -1
- package/data/concept/Foundations-Color.ttl +10 -0
- package/data/concept/Foundations-Density--the-form-channel.ttl +0 -1
- package/data/concept/Foundations-Grid--Layout.ttl +2 -3
- package/data/concept/Foundations-Spacing/-Element-vs-container-owned.ttl +0 -1
- package/data/concept/Foundations-Spacing.ttl +0 -1
- package/data/concept/Foundations-Surfaces.ttl +1 -2
- package/data/concept/Foundations-Typography.ttl +1 -2
- package/data/concept/How-to-choose-between-question-mark-and-information-icon.ttl +10 -0
- package/data/concept/How-to-differentiate-types-of-UI-blocks-.ttl +3 -4
- package/data/concept/How-to-indicate-required-fields-in-forms.ttl +1 -2
- package/data/concept/How-to-support-modifiers-in-a-component.ttl +0 -1
- package/data/concept/Intentional-friction.ttl +0 -1
- package/data/concept/Overflow.ttl +10 -0
- package/data/concept/Understanding-the-modifier-contract.ttl +0 -1
- package/data/documentation/layout/content_page_layout.ttl +13 -0
- package/data/documentation/layout/documentation_layout.ttl +2 -1
- package/data/documentation/layout/library_layout.ttl +13 -0
- package/data/documentation/layout/search_page_layout.ttl +13 -0
- package/data/documentation/pattern/library_side_navigation.ttl +4 -4
- package/data/global/component/accordion.ttl +5 -184
- package/data/global/component/announcement.ttl +4 -4
- package/data/global/component/avatar.ttl +1 -1
- package/data/global/component/badge.ttl +7 -9
- package/data/global/component/breadcrumbs.ttl +8 -7
- package/data/global/component/button.ttl +7 -25
- package/data/global/component/button_link.ttl +1 -1
- package/data/global/component/card.ttl +3 -12
- package/data/global/component/checkbox_field.ttl +1 -1
- package/data/global/component/chip.ttl +5 -6
- package/data/global/component/choices_field.ttl +11 -3
- package/data/global/component/code_snippet.ttl +1 -2
- package/data/global/component/color_field.ttl +1 -1
- package/data/global/component/combobox_field.ttl +2 -18
- package/data/global/component/contextual_menu.ttl +4 -6
- package/data/global/component/date_field.ttl +1 -1
- package/data/global/component/date_time_field.ttl +1 -1
- package/data/global/component/drag_and_drop_list.ttl +3 -3
- package/data/global/component/dropdown_button.ttl +2 -3
- package/data/global/component/file_upload_field.ttl +509 -60
- package/data/global/component/heading.ttl +4 -4
- package/data/global/component/hidden_field.ttl +1 -1
- package/data/global/component/icon.ttl +3 -3
- package/data/global/component/icon_button.ttl +35 -0
- package/data/global/component/icon_in_container.ttl +7 -2
- package/data/global/component/inline_code.ttl +1 -1
- package/data/{apps → global}/component/key_value_pair.ttl +3 -3
- package/data/global/component/keyboard_key.ttl +1 -1
- package/data/global/{pattern/navigation.ttl → component/link.ttl} +3 -3
- package/data/global/component/links.ttl +12 -0
- package/data/global/component/markdown_editor_field.ttl +13 -0
- package/data/global/component/mode_switcher.ttl +2 -2
- package/data/global/component/notification_toast.ttl +1 -1
- package/data/global/component/number_field.ttl +1 -1
- package/data/global/component/pagination.ttl +2 -2
- package/data/global/component/password_field.ttl +1 -1
- package/data/global/component/phone_field.ttl +1 -1
- package/data/global/component/popover.ttl +1 -1
- package/data/global/component/query_builder.ttl +12 -0
- package/data/global/component/range_field.ttl +1 -81
- package/data/global/component/rating_field.ttl +1 -1
- package/data/global/component/relative_timestamp.ttl +2 -1
- package/data/global/component/rich_choices_field.ttl +1 -1
- package/data/global/component/rich_text_editor.ttl +12 -0
- package/data/global/component/rich_text_field.ttl +1 -1
- package/data/global/component/search_field.ttl +1 -1
- package/data/global/{subcomponent/markdown_input.ttl → component/segmented_control.ttl} +3 -3
- package/data/global/component/segmented_control_field.ttl +1 -1
- package/data/global/component/select_field.ttl +1 -1
- package/data/global/component/switch_field.ttl +1 -1
- package/data/global/component/table.ttl +4 -4
- package/data/global/component/tabs.ttl +1 -1
- package/data/global/component/tag.ttl +2 -2
- package/data/global/component/text_field.ttl +1 -1
- package/data/global/component/textarea_field.ttl +1 -1
- package/data/global/component/tile.ttl +2 -5
- package/data/global/component/time_field.ttl +1 -1
- package/data/global/component/timestamp.ttl +2 -1
- package/data/global/component/tooltip.ttl +78 -120
- package/data/global/component/{data_tooltip.ttl → tooltip_data.ttl} +31 -23
- package/data/global/component/tooltip_wrapper.ttl +71 -15
- package/data/global/group/buttons.ttl +1 -8
- package/data/global/group/cards.ttl +2 -6
- package/data/global/group/code_snippets.ttl +1 -1
- package/data/{apps → global}/group/key_value_pairs.ttl +3 -3
- package/data/global/group/keyboard_keys.ttl +1 -1
- package/data/global/group/tiles.ttl +1 -1
- package/data/global/modifier/constructive.ttl +1 -1
- package/data/global/modifier/elevated.ttl +1 -1
- package/data/global/modifier/information.ttl +1 -1
- package/data/global/modifier_family/_emphasis.ttl +1 -2
- package/data/global/modifier_family/_other.ttl +1 -2
- package/data/global/modifier_family/surface.ttl +1 -1
- package/data/global/pattern/description_list.ttl +1 -1
- package/data/global/pattern/field.ttl +1 -1
- package/data/global/{component/markdown_field.ttl → pattern/filter.ttl} +3 -3
- package/data/global/pattern/form_login.ttl +1 -1
- package/data/global/pattern/modal.ttl +5 -21
- package/data/global/pattern/stepper.ttl +1 -1
- package/data/global/pattern/table_of_contents.ttl +1 -1
- package/data/global/pattern/timeline.ttl +14 -19
- package/data/global/pattern/top_navigation.ttl +13 -0
- package/data/global/subcomponent/accordion-item.ttl +3 -156
- package/data/global/subcomponent/card-content.ttl +1 -1
- package/data/global/subcomponent/card-footer.ttl +1 -1
- package/data/global/subcomponent/card-header.ttl +1 -1
- package/data/global/subcomponent/card-image.ttl +2 -2
- package/data/global/subcomponent/card-thumbnail.ttl +1 -1
- package/data/global/subcomponent/chart_legend.ttl +1 -1
- package/data/global/subcomponent/chart_legend_item.ttl +1 -1
- package/data/global/subcomponent/checkbox_input.ttl +1 -1
- package/data/global/subcomponent/color_input.ttl +1 -1
- package/data/global/subcomponent/combobox_input.ttl +2 -18
- package/data/global/subcomponent/date_input.ttl +1 -1
- package/data/global/subcomponent/date_time_input.ttl +1 -1
- package/data/global/subcomponent/field-description.ttl +1 -1
- package/data/global/subcomponent/field-label.ttl +1 -1
- package/data/global/subcomponent/file_upload_input.ttl +503 -50
- package/data/global/subcomponent/hidden_input.ttl +1 -1
- package/data/global/subcomponent/markdown_editor_input.ttl +13 -0
- package/data/global/subcomponent/modal-content.ttl +1 -1
- package/data/global/subcomponent/modal-footer.ttl +3 -19
- package/data/global/subcomponent/modal-header.ttl +5 -21
- package/data/global/subcomponent/number_input.ttl +1 -1
- package/data/global/subcomponent/password_input.ttl +1 -1
- package/data/global/subcomponent/phone_input.ttl +1 -1
- package/data/global/subcomponent/radio_input.ttl +1 -1
- package/data/global/subcomponent/range_input.ttl +3 -84
- package/data/global/subcomponent/rating_input.ttl +1 -1
- package/data/global/subcomponent/rich_text_input.ttl +1 -1
- package/data/global/subcomponent/search_input.ttl +3 -4
- package/data/global/subcomponent/segmented_control_input.ttl +1 -1
- package/data/global/subcomponent/select_input.ttl +1 -1
- package/data/global/subcomponent/spinner.ttl +2 -2
- package/data/global/subcomponent/switch_input.ttl +1 -1
- package/data/global/{layout/form_layout.ttl → subcomponent/text_editor_input.ttl} +2 -2
- package/data/global/subcomponent/text_input.ttl +1 -1
- package/data/global/subcomponent/textarea_input.ttl +1 -1
- package/data/global/subcomponent/tile-content.ttl +1 -1
- package/data/global/subcomponent/time_input.ttl +1 -1
- package/data/global/subcomponent/timeline-content.ttl +2 -2
- package/data/global/subcomponent/timeline-event.ttl +5 -5
- package/data/global/subcomponent/timeline-expansion_indicator.ttl +1 -1
- package/data/global/subcomponent/timeline-header.ttl +1 -1
- package/data/global/variant/tooltip_dense.ttl +87 -6
- package/data/global_dataviews/component/filter_button.ttl +487 -0
- package/data/global_dataviews/component/query_bar.ttl +1639 -0
- package/data/global_dataviews/component/query_chip.ttl +605 -0
- package/data/global_dataviews/group/query_chips.ttl +565 -0
- package/data/global_dataviews/modifier/exclusion.ttl +8 -0
- package/data/global_dataviews/modifier/inclusion.ttl +8 -0
- package/data/global_dataviews/modifier/match.ttl +8 -0
- package/data/global_dataviews/modifier/presence.ttl +8 -0
- package/data/global_dataviews/modifier/range.ttl +8 -0
- package/data/global_dataviews/modifier_family/condition.ttl +9 -0
- package/data/global_dataviews/subcomponent/query_chip-entry.ttl +186 -0
- package/data/global_dataviews/subcomponent/query_chip-segment.ttl +241 -0
- package/data/global_dataviews/subcomponent/query_input.ttl +1287 -0
- package/data/{tagcategory/documentation-stage.ttl → global_dataviews.ttl} +2 -2
- package/data/sites/component/store_card.ttl +92 -0
- package/data/sites/pattern/hero.ttl +295 -4
- package/data/{stores.ttl → sites_stores.ttl} +2 -2
- package/data/tag/designin-progress.ttl +9 -0
- package/data/tag/devbatch1.ttl +1 -1
- package/data/tag/devbatch2.ttl +1 -1
- package/data/tag/devbatch3.ttl +1 -1
- package/data/tag/{wpetriageupstream-and-deprecate.ttl → devdone.ttl} +3 -2
- package/data/tag/devin-progress.ttl +9 -0
- package/data/tag/{stylesready.ttl → devin-review.ttl} +3 -3
- package/data/tag/devpre-approved.ttl +9 -0
- package/data/tag/{devreactapproved.ttl → devreactdone.ttl} +3 -3
- package/data/tag/devreactpreapproved.ttl +1 -1
- package/data/tag/{wpeinital-implementation.ttl → devsveltepreapproved.ttl} +3 -3
- package/data/tag/divergent.ttl +1 -1
- package/data/tag/docscomplete.ttl +1 -1
- package/data/tag/global-docs-missing.ttl +1 -1
- package/data/tag/has-no-global-entry.ttl +1 -1
- package/data/tag/implementationcomplete.ttl +9 -0
- package/data/tag/lpto-be-upstreamed.ttl +1 -1
- package/data/tag/lptriageblocked-reqs-design.ttl +1 -1
- package/data/tag/lptriageno-upstream.ttl +1 -1
- package/data/tag/lptriagereimplement-and-deprecate.ttl +1 -1
- package/data/tag/lptriagereimplement-and-keep.ttl +1 -1
- package/data/tag/lptriageupstream-and-deprecate.ttl +1 -1
- package/data/tag/{needsdefinition.ttl → needscoredocumentation.ttl} +3 -3
- package/data/tag/needsdesign.ttl +9 -0
- package/data/tag/{needsdocumentation.ttl → needsfulldocumentation.ttl} +3 -3
- package/data/tag/needsimplementation.ttl +9 -0
- package/data/tag/needstriage.ttl +1 -1
- package/data/tag/specialadoption-docs.ttl +1 -1
- package/data/tag/triagedbacklog.ttl +2 -2
- package/data/tag/triagedrejected.ttl +2 -2
- package/data/tag/upstream-candidate.ttl +1 -1
- package/data/tag/upstream-compliant.ttl +1 -1
- package/data/tag/waiting-for-delta-review.ttl +1 -1
- package/data/tag/workplaceinitial-implementation.ttl +9 -0
- package/data/tag/workplacetriageupstream-and-deprecate.ttl +9 -0
- package/data/tagcategory/design--documentation-status.ttl +6 -0
- package/data/tagcategory/implementationnotes.ttl +6 -0
- package/data/tagcategory/implementationstatus.ttl +6 -0
- package/data/tagcategory/implementationworkflow.ttl +6 -0
- package/definitions/ontology.ttl +8 -2
- package/package.json +6 -6
- package/skills/adoption-a1-styles/SKILL.md +48 -7
- package/skills/adoption-a2-components/SKILL.md +125 -5
- package/skills/anatomy-author/SKILL.md +302 -95
- package/skills/anatomy-author/clarification-guidelines.md +150 -0
- package/skills/anatomy-author/completeness-checklist.md +224 -0
- package/skills/implement-component/SKILL.md +2 -2
- package/skills/map-journeys/SKILL.md +395 -0
- package/skills/map-journeys/journey-graph.example.html +298 -0
- package/skills/model-domains/SKILL.md +502 -0
- package/data/apps_workplaceengineering/pattern/event_timeline.ttl +0 -13
- package/data/apps_workplaceengineering/pattern/group_card.ttl +0 -13
- package/data/apps_workplaceengineering/pattern/travel_provider_card.ttl +0 -14
- package/data/apps_workplaceengineering/subcomponent/multi_select_input.ttl +0 -12
- package/data/concept/Question-mark-vs-information-icon.ttl +0 -11
- package/data/global/modifier/editable.ttl +0 -8
- package/data/global/modifier/focused.ttl +0 -8
- package/data/global/modifier/highlighted.ttl +0 -8
- package/data/global/modifier/loading.ttl +0 -8
- package/data/global/modifier/muted.ttl +0 -8
- package/data/global/modifier/wireframe.ttl +0 -8
|
@@ -7,5 +7,4 @@ ds:concept.Foundations-Spacing.-Element-vs-container-owned a ds:Concept;
|
|
|
7
7
|
ds:summary "This document covers both inter-element spacing (gaps between components and patterns) and intra-component spacing (internal padding and border compensation):\n\n- Vertical and horizontal spacing architecture\n- When and why to use each spacing model\n- Baseline grid and nudge token architecture\n- Invariants that both models must preserve";
|
|
8
8
|
ds:tier ds:global;
|
|
9
9
|
ds:content "\n\n**Status:** Final \n**Version:** 1.0 \n**Last updated:** 2026-04-24\n\n\n\n## Table of contents\n\n1. [Glossary](#glossary)\n2. [Problem statement and scope](#1-problem-statement-and-scope)\n3. [The vertical spacing architecture](#2-the-vertical-spacing-architecture)\n4. [Horizontal spacing](#3-horizontal-spacing)\n5. [Invariants](#4-invariants)\n\n\n\n## Glossary\n\nCopy of Copy of Table 10\n\n\n\n## 1. Problem statement and scope\n\n### 1.1 The problem\n\nOur Design System serves three fundamentally different tiers:\n\n- Application UIs – dashboards, forms, settings pages, admin panels (MAAS, Landscape, Launchpad, Snapcraft, support portal, and ~50 other products)\n- Editorial / marketing sites – [ubuntu.com](http://ubuntu.com), [canonical.com](http://canonical.com), canonical.design, blog content\n- Documentation\n\nThese tiers have different spacing needs. Application UIs benefit from explicit, container-controlled spacing. Editorial content and documentation benefit from semantic, element-owned spacing that preserves typographic hierarchy automatically.\n\nNo single spacing model optimally serves all tiers. A system that forces one model everywhere either frustrates the majority use case (application teams) or sacrifices semantic correctness for editorial and documentation tiers.\n\n### 1.2 Scope\n\nThis specification covers both inter-element spacing (gaps between components and patterns) and intra-component spacing (internal padding and border compensation):\n\n- Vertical and horizontal spacing architecture\n- When and why to use each spacing model\n- Baseline grid and nudge token architecture\n- Invariants that both models must preserve\n\nOut of scope:\n\n- Typography specification (referenced where relevant)\n- Grid system specification (referenced where relevant)\n- Implementation details (CSS architecture, component APIs, tooling)\n\n### 1.3 Goals\n\n1. **Predictability:** Spacing behaviour is deterministic and learnable\n2. **Composability:** Elements compose correctly in both models\n3. **Maintainability:** Spacing changes propagate through tokens, not through container dependencies\n4. **Tier fit:** Each tier uses the model best suited to it\n\n\n\n## 2. Vertical spacing\n\n### 2.1 Thesis\n\nVertical spacing should be owned by elements in content flow and owned by containers in application UIs. This split keeps editorial spacing typographically precise and application spacing simple.\n\nMature design systems implicitly follow this split: [GOV.UK](https://design-system.service.gov.uk/styles/spacing/) uses element-owned spacing for typography; [Material Design 3](https://m3.material.io/foundations/layout/understanding-layout/spacing), [Shopify Polaris](https://polaris.shopify.com/design/layout/spacial-organization), and [Atlassian](https://atlassian.design/foundations/spacing) use container-owned spacing for application UIs. Making this distinction explicit gives us semantic correctness for content and simple composability for UI composition.\n\nCopy of Copy of Table 11\n\n### 2.2 The two modes\n\nCopy of Table 27\n\n\n\n### 2.3 Element-owned spacing\n\nBy default, every element carries semantic margin-bottom. This ensures:\n\n- Developers not familiar with the DS get working spacing immediately\n- Prototyping is straightforward – drop elements on a page and they don’t collide\n- No container boilerplate required for simple pages\n\n2.3.1 Core principle\n\nEach element owns the space below it. Elements declare `margin-bottom` only; no element declares `margin-top`. This follows Harry Roberts’ “[single-direction margin declarations](https://csswizardry.com/2012/06/single-direction-margin-declarations/)” pattern.\n\nThe single-direction rule applies to spacing between elements only: elements use `margin-bottom` (never `margin-top`). The last-child reset (see §2.3.5) prevents external margins and container spacing from doubling up. Internal spacing inside components is handled with padding on any side (for example buttons, inputs, strips, and containers).\n\n**Why bottom (not top):**\n\n- **Resilience to unknown elements.** Content is authored top-down. If an unstyled element enters the flow (a D3 canvas, an embedded iframe, a third-party widget), it arrives with `margin-top: 0`. With bottom-only, the preceding element already declared appropriate space below itself – the unknown element gets reasonable separation for free. With top-only, the unknown element would need to declare its own space above, but since the system doesn’t style it, it won’t. The result: the unknown element crowds whatever is above it. \n \nComparison: \n*[Example: button followed by an unstyled D3 canvas – bottom-only provides separation vs top-only where the canvas crowds the button]* \n\n- **Industry precedent.** InDesign uses “Space After” as the primary typographic control; “Space Before” is avoided because it creates ambiguity at the tops of frames. Figma auto-layout applies gap after each item. [GOV.UK](https://design-system.service.gov.uk/styles/spacing/) typography applies `margin-top: 0` and relies primarily on bottom spacing for flow:\n\n2.3.2 How it works\n\nEvery text element and component ships with a semantic `margin-bottom`:\n\n```\nh1 → margin-bottom based on its role in hierarchy\nh2 → margin-bottom based on its role in hierarchy\np → margin-bottom based on its role in hierarchy\nbutton → margin-bottom based on its role in hierarchy\n```\n\nThe value is determined by the element’s semantic role and visual weight, drawn from the spacing token scale.\n\nElements like buttons may appear at different hierarchy levels (inside cards, at the end of forms, or inside hero sections). In element-owned mode, the button keeps the same semantic `margin-bottom` token across contexts. If a section needs extra separation from the next section, that separation is owned by the parent container (via its own padding or margin), not by changing button spacing. In container-owned mode, the container’s gap controls all spacing and button `margin-bottom` is reset to `0`.\n\n\n\n*[Example: stacked elements with margin-bottom showing semantic spacing values]*\n\n2.3.3 Why this model suits editorial content\n\nIn editorial/content flow, elements are heterogeneous – headings, paragraphs, images, pull quotes, lists. The spacing transition between a heading and a paragraph is semantically different from the transition between two paragraphs.\n\n```\nh2 → larger gap (topic change)\np → standard gap (continuation)\np → standard gap (continuation)\nfigure → larger gap (visual break)\nh2 → larger gap (new topic)\n```\n\nA parent container cannot manage these transitions without encoding knowledge of every child type and order. Element-owned spacing handles this automatically because each element carries its own contextually appropriate spacing.\n\nThis principle extends beyond text elements to higher-level layout devices: sections, figures, and content blocks also carry their own `margin-bottom`, establishing spacing at every level of the document hierarchy.\n\n**Real-world examples:**\n\n- Traditional publishing – element-intrinsic vertical spacing is the norm, implemented via space before/after in paragraph styles for example.\n- Browser defaults and markdown renderers – rely on element-owned margins\n\n2.3.4 Where it applies\n\nElement-owned spacing is the system default. It applies everywhere unless a container explicitly takes over. It is the primary model for:\n\n- Marketing pages with mixed content\n- Blog posts and articles\n- Documentation with semantic heading hierarchy\n- Rich text / markdown-rendered content\n\nThe choice between element-owned and container-owned spacing is made at the **product level** – an entire site or application commits to one mode. Mixing modes within a single product would create inconsistent vertical rhythm and complicate nudge token management, since baseline alignment relies on a single consistent spacing strategy per codebase.\n\n2.3.5 Last-child handling\n\nIn element-owned mode, the last child in a content-flow container still carries its `margin-bottom`. To prevent double spacing (element margin + container padding), the design system’s base CSS automatically resets trailing margins at each flow boundary:\n\n```css\n/* Working selector name for illustration; not a prescriptive API */\n.content-flow-container > :last-child {\n margin-bottom: 0;\n}\n```\n\nNote: This is not a manual step. The rule is part of the system’s CSS foundation. In nested layouts (for example `container > grid-row > col > h2` and `col > p`), each column that hosts content flow should be a content-flow container so each branch resets its own trailing margin.\n\n**Component implementations:** when text elements are wrapped as components (e.g. `<Heading>`, `<Paragraph>`), the last-child reset should be handled by the content-flow container, not by individual components. Components should not need a `:last` variant – the container’s `:last-child` selector targets whatever element renders last, regardless of component wrapper. If a framework prevents CSS child selectors from reaching the rendered element, the container component should apply the reset via its own logic.\n\nThe default reset uses `margin-bottom: 0`. A precision variant that preserves baseline compensation is described in §2.6.2.\n\n**Example: Hero pattern**\n\n```\nHero (padding-bottom: 64px)\n├── h1 \"Sign up today\" (margin-bottom: 24px)\n├── p \"Get started free\" (margin-bottom: 16px)\n├── [Button: Sign up] (margin-bottom: 0) ← last-child reset\n└── (hero padding-bottom provides the 64px separation to next section)\n\n```\n\nWithout the reset, the button’s `margin-bottom` (16px) would stack with the hero’s `padding-bottom` (64px), producing 80px – a double-spacing bug. The automatic reset eliminates this.\n\n### 2.4 Container-owned spacing\n\n2.4.1 Core principle\n\nContainers define spacing between their children. Children inside a container have their `margin-bottom` set to zero; the container controls gaps through `gap` values. Elements are spacing-neutral – the container owns all inter-child spacing.\n\n2.4.2 How it works\n\nA container resets child spacing and applies uniform (or structured) gaps:\n\n```\nContainer with gap (16px)\n ├── TextField (margin-bottom: 0)\n ├── TextField (margin-bottom: 0)\n └── Button (margin-bottom: 0)\n```\n\nThe container takes ownership. Elements become spacing-neutral. \nRecommended safeguard: apply an app-scope element qualifier margin-reset so browser default element margins do not reintroduce element-owned spacing.\n\n2.4.3 Why this model suits application UI\n\nIn application UI, we prioritise simplicity: spacing is owned by containers rather than by individual element semantics.\n\nContainer-owned spacing provides:\n\n- Visible spacing intent – inspect the parent to see spacing decisions\n- Predictable reordering – move children without spacing side effects\n- Density control – choose a container with the desired density level\n- Consolidated control – spacing is configured at the container level\n\n**Nested containers for varying density:**\n\nWhen different parts of an interface need different density, nest containers with different gap values. Each container owns the spacing for its direct children – no element-level margin decisions are needed.\n\n```\nForm (padding: 16px, gap: 16px)\n├── Field group (gap: 4px) ← dense: label, input, helper text\n│ ├── Label: \"Upstream DNS\"\n│ ├── Input: \"8.8.8.8\"\n│ └── Helper: \"Comma-separated list of upstream DNS servers.\"\n└── Field group (gap: 4px) ← same dense group, separated by larger gap\n ├── Label: \"Default TTL\"\n ├── Input: \"30\"\n └── Helper: \"...\"\n```\n\nIn this example, the form’s `gap` separates the two field groups with comfortable spacing. Inside each field group, a small gap keeps the label, input, and helper text tightly bound as a single unit. The form container owns the inter-group spacing; each field group owns its internal density.\n\n**Real-world examples:**\n\n- Material Design 3 – spacing defined via grid and structural primitives\n- Shopify Polaris – Stack primitive controls vertical spacing\n- Atlassian Design System – Stack primitive defines spacing between children\n- Chakra UI – Stack component exists specifically to control spacing\n\n### 2.4.4 Application-specific container provisions\n\nOne container pattern is unique to application layouts:\n\n**Fixed-height status bar.** A status bar is simply a container with a fixed height. Its width can span both the main area and side drawers, or be scoped to the main area only – depending on use case. Like all application containers, it resets child margins to zero and owns the spacing between its children.\n\n### 2.5 Intra-component vertical padding\n\nIntra-component vertical padding is component-owned: each component sets its internal top/bottom padding regardless of context.\n\nFor example, buttons, inputs, and cards keep the same internal top/bottom padding whether they appear alone or inside grouped layouts.\n\nWhen borders change the box model, adjust top/bottom padding so outer component height remains aligned to whole-`bU` steps.\n\n### 2.6 Baseline grid and nudges\n\n2.6.1 The baseline grid\n\nIn our design system, the default baseline unit is 4px (previously 8px). \nWe use the acronym `bU` throughout this specification.\n\n> **Box model consideration:** When elements have borders, the entire box model must be accounted for in height calculations. For example, an element with `padding: 16px` and `border: 1px` should reduce padding to `14px` to maintain the same total height. This principle applies to both spacing modes.\n\n2.6.2 The nudge technique\n\nThe underlying issue is browser line-height centering: CSS centres text vertically within the line-height box rather than anchoring it to a baseline. This means stacking text elements of different sizes produces baselines that land at unpredictable positions – not on any consistent grid.\n\nNudge tokens solve this by adding a small `padding-top` to push each text element’s baseline onto the grid, with a corresponding increase in `margin-bottom` to compensate.\n\nNudges are text-level only. They apply to typographic elements and text-bearing components (for example buttons, inputs, list items, etc), not containers. Containers remain spacing-neutral and use semantic spacing tokens; this preserves substitutability when elements are swapped.\n\nBaseline compensation model:\n\n- `padding-top = nudge`\n- `baseline-compensation = bU - nudge`\n- `margin-bottom = semantic-spacing + baseline-compensation`\n\nFlow-boundary precision reset (for non-zero nudge contexts):\n\n```css\n\n/* Each text element sets semantic spacing and compensation values. Illustration in px for clarity, real values are rem and come from tokens, not css vars */\np {\n --spAfter-sem: var(--space-after-semantic-p); /* e.g. 16px */\n --spAfter-comp: var(--space-after-comp-p); /* e.g. 6.4px */\n}\n\nh1 {\n --spAfter-sem: var(--space-after-semantic-h1); /* e.g. 16px */\n --spAfter-comp: var(--space-after-comp-h1); /* e.g. 2px */\n}\n\n.content-flow-container > * {\n margin-bottom: calc(var(--spAfter-sem, 0px) + var(--spAfter-comp, 0px));\n}\n\n.content-flow-container > :last-child {\n margin-bottom: var(--spAfter-comp, 0px);\n}\n```\n\nThis approach keeps baseline continuity at flow boundaries. \nImplementation can be provided through any equivalent mechanism (for example a prose wrapper component, a utility class, or a scoped element qualifier).\n\n**Last-child reset options**\n\n`Option A (default, simpler):` \nKeep the boundary reset as `margin-bottom: 0` (as described in §2.3.5).\n\n`Option B (precision):` \nUse the precision reset above, which preserves `spAfter` compensation on the last child and trims only semantic spacing. This keeps baselines aligned even at flow boundaries.\n\n2.6.3 Scope\n\nThe nudge technique is reserved for Editorial / marketing and Documentation tiers, where calculated nudge values are used for content-flow typography. Application UI tier is exempt, and all nudge tokens are intentionally set to `0`.\n\n2.6.4 Trade-off summary\n\nCopy of Copy of Table 13\n\n\n\n## 3. Horizontal spacing\n\nHorizontal spacing uses a container-owned model in both vertical modes.\n\nUnlike vertical spacing, horizontal spacing rarely encodes semantic hierarchy or visual weight transitions between adjacent elements. Large separations are typically set by the grid (gutters, margins, keylines). What remains is spacing between smaller grouped elements inside components and patterns, where container-defined gaps are simpler and more consistent.\n\n### 3.1 Layout-level spacing\n\nHorizontal spacing at the layout level is handled by the grid system:\n\nCopy of Copy of Table 14\n\nThe grid provides consistent horizontal rhythm across breakpoints and establishes keylines: shared horizontal offsets that align text and controls across components and patterns, improving scannability. Components placed within grid columns inherit this spacing automatically.\n\n> **Two-dimensional grids:** When layout produces a two-dimensional grid of items (card grids, dashboards, image galleries), the vertical gap between rows must equal the horizontal gutter (24px). This ensures items sit on a uniform spatial grid in both axes.\n\n### 3.2 Horizontal sibling spacing\n\nHorizontal spacing between sibling elements is container-owned: the parent context sets the gap.\n\nFor example, in a row of buttons or chips, the container defines the horizontal gap between items:\n\n\n\n### 3.3 Intra-component horizontal padding\n\nIntra-component horizontal padding is component-owned: each component sets its internal left/right padding regardless of context.\n\nFor example, buttons, inputs, and chips keep the same internal left/right padding whether they appear alone or inside grouped layouts.: \n\n\nWhen borders change the box model, adjust left/right padding to preserve content box width. For bottom-only borders, left/right padding stays unchanged.\n\nCopy of Copy of Table 15\n\n\n\n## 4. Invariants\n\nInvariants are the non-negotiable rules that both spacing modes must preserve. They serve as evaluation criteria for architectural decisions and acceptance criteria for contributions.\n\n### 4.1 The invariant list\n\nCopy of Copy of Table 16\n\n### 4.2 How invariants apply to each mode\n\n**Element-owned (default mode):**\n\n- Substitutability is intrinsic – each element brings its own spacing\n- Locality is intrinsic – no parent knowledge required\n- No double spacing is handled by margin-bottom-only rule (no collapsing margin-top)\n\n**Container-owned mode:**\n\n- Substitutability is preserved because all children have margin-bottom: 0; spacing is uniform from the container\n- Locality is preserved – elements don’t need to know their context; the container resets them unconditionally\n- No double spacing is handled by the reset mechanism (children have no margins to double)\n\n### 4.3 Invariant priority\n\nWhen invariants conflict, resolve in this order:\n\n1. **Substitutability** – composition must remain predictable\n2. **Locality** – knowledge shouldn’t leak across boundaries\n3. **No double spacing** – additive bugs break layouts\n4. **Composition isolation** – parent-child contracts must be stable\n5. **Grid alignment** – vertical rhythm should be maintained\n6. **Predictable removal** – overrides must be safe\n\n> **Note on grid alignment:** In zero-nudge mode, grid alignment refers to element heights being whole multiples of `bU`. True baseline alignment (text sitting on grid lines) is only achieved with non-zero nudge values.\n\n\n\n\n\n## 5. Authoring guidance\n\nThis section translates the architectural model into concrete decisions for the two audiences who apply it daily.\n\n### 5.1 Component designers\n\nSpacing behaviour differs between tiers, but the difference is encoded in the token values – not in how components are designed. A component built correctly for one tier will work in the other once the appropriate tokens are applied.\n\nIn editorial and documentation tiers, text inside components aligns to a baseline grid – the same behaviour as the legacy Vanilla framework this design system replaces. Nudge tokens (`padding-top`) shift each text baseline onto the grid, with a corresponding `margin-bottom` compensation. In application UI tiers, nudge tokens are set to zero; internal padding on elements such as buttons is set so that the entire element aligns to the baseline grid, rather than individual text baselines within it.\n\n**Application UI**\n\nContainers own all inter-child spacing. Components should be spacing-neutral.\n\n- `spAfter` (margin-bottom) is set to `0` at the tier level via zero-nudge tokens – no manual work per component.\n- Internal vertical padding is component-owned. Use values from the spacing scale.\n- If the component has a border that changes the box model, reduce padding to keep total height on whole-`bU` steps.\n\n**Editorial and documentation**\n\nComponents carry their own spacing in content flow.\n\n- Set `margin-bottom` using a semantic spacing token. Never use `margin-top`.\n- If the component contains text, apply the nudge token (`padding-top`) for baseline alignment (§2.6.2).\n- Pick the token that matches the element’s visual weight and hierarchy level.\n\n**Both tiers**\n\n- Internal horizontal padding is always component-owned.\n- For all-side borders, reduce horizontal padding by the border width.\n- Keep all internal padding consistent regardless of layout context.\n\n**Pre-review checklist**\n\n- Spacing values use tokens, not arbitrary px\n- No `margin-top` declared anywhere in the component\n- Text elements: nudge token applied if serving editorial/docs tier\n- Component height is whole-`bU` multiples (account for borders)\n- Tested in composition: followed by a heading, a paragraph, and a button\n\n### 5.2 Pattern designers\n\nPatterns compose components. The principle: patterns don’t re-encode spacing that belongs to components or containers.\n\n**Application UI patterns**\n\nUse container-owned spacing (§2.4).\n\n- Set a gap value on the container. Component tokens are already zeroed; children will be spacing-neutral.\n- Don’t add `margin-bottom` to individual children.\n- Use nested containers for sections of the pattern that need different density (§2.4.3 for an example).\n- For two-dimensional grids (card grids, tile layouts), set the vertical row gap equal to the horizontal gutter (24px, per §3.1).\n\n**Editorial and documentation patterns**\n\nUse element-owned spacing (§2.3).\n\n- Don’t override child `margin-bottom`. If the gap looks wrong, the component needs adjusting – not the pattern.\n- Wrap the pattern in a content-flow container so the last-child reset applies automatically (§2.3.5).\n\n**Tight compositions**\n\nHero heading pairs, button bars, and key–value rows sometimes need less space than the component default. This is not a pattern-level override.\n\n- Request a spacing variant in the component: minimal mode removes semantic spacing while preserving baseline compensation.\n- The pattern references the component variant; it never applies inline spacing values.\n- Substitutability (§4.1) is preserved: swapping the component still composes correctly.\n\n**Slot-based patterns**\n\nWhen a pattern passes arbitrary children through a slot, it can’t guarantee specific spacing.\n\n- Document the expected child types.\n- Wrap the slot in a content-flow container (editorial/docs) or a gap container (application UI).\n\n\n\n\n\n## Appendices\n\n### A. References\n\n- Harry Roberts: [Single-direction margin declarations](https://csswizardry.com/2012/06/single-direction-margin-declarations/)\n- [GOV.UK Design System: Spacing](https://design-system.service.gov.uk/styles/spacing/)\n- Material Design 3: [Layout spacing](https://m3.material.io/foundations/layout/understanding-layout/spacing#9ebf5386-23ca-400a-b68d-e8c679a4a19d)\n- Shopify Polaris: [Stack](https://shopify.dev/docs/api/checkout-ui-extensions/latest/polaris-web-components/layout-and-structure/stack)\n - Atlassian Design System: [Stack](https://atlassian.design/components/primitives/stack/)\n\n";
|
|
10
|
-
ds:knownEdgeCases "";
|
|
11
10
|
ds:conceptType ds:concepttype.Explanation.
|
|
@@ -7,5 +7,4 @@ ds:concept.Foundations-Spacing a ds:Concept;
|
|
|
7
7
|
ds:summary "This document covers both inter-element spacing (gaps between components and patterns) and intra-component spacing (internal padding and border compensation):\n\n- Vertical and horizontal spacing architecture\n- How containers own inter-child spacing across tiers\n- Baseline grid and nudge token architecture\n- Invariants the system must preserve";
|
|
8
8
|
ds:tier ds:global;
|
|
9
9
|
ds:content "\n\nStatus: Final \nVersion: 1.1 \nLast updated: 2026-06-29\n\n\n\n## Table of contents\n\n1. [Glossary](#glossary)\n2. [Problem statement and scope](#1-problem-statement-and-scope)\n3. [The vertical spacing architecture](#2-the-vertical-spacing-architecture)\n4. [Horizontal spacing](#3-horizontal-spacing)\n5. [Invariants](#4-invariants)\n\n\n\n## Glossary\n\nCopy of Table 10\n\n\n\n## 1. Problem statement and scope\n\n### 1.1 The problem\n\nOur Design System serves three fundamentally different tiers:\n\n- Application UIs – dashboards, forms, settings pages, admin panels (MAAS, Landscape, Launchpad, Snapcraft, support portal, and ~50 other products)\n- Editorial / marketing sites – [ubuntu.com](http://ubuntu.com), [canonical.com](http://canonical.com), canonical.design, blog content\n- Documentation\n\nEarlier drafts also explored element-owned spacing for some editorial / prose contexts.\n\nFor the current specification, semantic spacing is container-owned throughout the system. Editorial, marketing, documentation, and application UI all follow the same semantic spacing model. Where baseline alignment is enabled, text elements may also carry nudge and baseline-compensation values; those do not replace container-owned semantic spacing.\n\n### 1.2 Scope\n\nThis specification covers both inter-element spacing (gaps between components and patterns) and intra-component spacing (internal padding and border compensation):\n\n- Vertical and horizontal spacing architecture\n- How containers own inter-child spacing across tiers\n- Baseline grid and nudge token architecture\n- Invariants the system must preserve\n\nOut of scope:\n\n- Typography specification (referenced where relevant)\n- Grid system specification (referenced where relevant)\n- Implementation details (CSS architecture, component APIs, tooling)\n\n### 1.3 Goals\n\n1. **Predictability:** Spacing behaviour is deterministic and learnable\n2. Composability: Components and patterns compose correctly without child-specific margin overrides\n3. Single implementation path: The system uses one semantic spacing model across tiers\n4. Tier coverage: Different products can express their needs without changing the semantic spacing model\n\n\n\n## 2. Vertical spacing\n\n### 2.1 Decision\n\nVertical semantic spacing is container-owned everywhere.\n\nThe implementation guidance below applies across application UI, editorial, marketing, and documentation.\n\nCopy of Table 11\n\n### 2.2 Core principle\n\nTable 73\n\nChildren are spacing-neutral externally. Containers define the space between them.\n\n### 2.3 Implementation model\n\nInter-child semantic spacing is owned by containers and patterns, not by child elements.\n\n- Use `gap` or an equivalent container-defined rule for authored semantic spacing.\n- Do not rely on child `margin-top` or semantic `margin-bottom` for authored layout spacing.\n- Reset browser default margins inside design-system scope so native elements stay semantically spacing-neutral.\n\n2.3.1 Ownership rules\n\nContainers and patterns own semantic spacing between direct children.\n\nWhere baseline alignment is enabled, text elements may still carry nudge and baseline compensation.\n\nImplementation guidance\n\n- Use structured containers when prose needs non-uniform semantic transitions.\n- Use nested containers when local density changes, and keep semantic spacing decisions at container boundaries.\n\n2.3.2 Current ownership\n\nInter-child semantic spacing is owned by containers and patterns, not by child elements.\n\n```\nStack → gap based on container density\nField group → gap based on local context\nSection → padding / gap owned by container\nButton → no external spacing\n```\n\nSpacing decisions stay at container boundaries.\n\nMixed editorial content may still need different semantic transitions between headings, paragraphs, figures, and lists. Where baseline alignment is enabled, the text elements may also carry their own nudge and baseline-compensation values.\n\n\n\nExample: prose wrapper with structured transitions\n\n2.3.3 Structured containers\n\nWhen prose needs non-uniform semantic spacing, that logic belongs to a prose wrapper or pattern rather than to the individual elements.\n\n```\nh2 → larger gap (owned by prose wrapper)\np → standard gap (owned by prose wrapper)\np → standard gap (owned by prose wrapper)\nfigure → larger gap (owned by prose wrapper)\nh2 → larger gap (owned by prose wrapper)\n```\n\nThis is how editorial and documentation content are handled in the current specification.\n\nThe ownership model stays the same even when the transitions differ.\n\nCurrent coverage:\n\n- App UI - forms, dashboards, card grids, settings pages\n- Editorial / marketing and documentation content rendered inside prose wrappers\n\n2.3.4 Tier coverage\n\nThe semantic spacing model does not change by product or tier.\n\n- Application UI uses container-owned semantic spacing.\n- Editorial / marketing uses container-owned semantic spacing. Where baseline alignment is enabled, text elements also carry nudge and baseline compensation.\n- Documentation uses container-owned semantic spacing. Where baseline alignment is enabled, text elements also carry nudge and baseline compensation.\n- Rich text / markdown output should be wrapped in a container that owns semantic spacing for its rendered children.\n\nThis keeps one implementation path throughout the system.\n\n2.3.5 Section boundaries\n\nSeparation between sections is owned by the section container, surrounding layout container, or pattern padding.\n\n```css\n.ds-scope :where(h1, h2, h3, h4, h5, h6, p, ul, ol, dl, figure, blockquote) {\nmargin-block: 0;\n}\n.stack { gap: var(–space-y, 1rem); }\n```\n\nBrowser default margins should be reset in design-system scope so native elements do not reintroduce external child spacing.\n\n2.3.6 Component implementations\n\nComponents are spacing-neutral externally; the container owns inter-child spacing.\n\n**Example: Hero pattern**\n\n```\nHero (padding-bottom: 64px, gap: 24px)\n├── h1 “Sign up today”\n├── p “Get started free”\n└── [Button: Sign up]\n└── (hero padding-bottom provides the 64px separation to next section)\n\n```\n\nThe section container, not the child elements, owns the spacing boundary to what follows.\n\n### 2.4 Container-owned spacing\n\n2.4.1 Core principle\n\nContainers define spacing between their children. Children stay spacing-neutral externally, and authored layout spacing is expressed through container gaps or equivalent rules.\n\n2.4.2 How it works\n\nA container applies uniform or structured gaps:\n\n```\nContainer with gap (16px)\n├── TextField\n├── TextField\n└── Button\n```\n\nRecommended safeguard: apply a design-system scope margin reset so browser default element margins do not reintroduce external child spacing.\n\n2.4.3 Applying the model across tiers\n\nApplication UI, editorial / marketing, and documentation all use container-owned spacing.\n\nUse the appropriate container type for the content being composed:\n\n- Stack, group, and grid containers for repeated UI\n- Prose wrappers and section containers for mixed editorial content\n- Markdown / rich-text wrappers for rendered documentation content\n- Nested containers where different local densities are needed\n\n**Nested containers for varying density:**\n\nWhen different parts of an interface need different density, nest containers with different gap values. Each container owns the spacing for its direct children.\n\n```\nForm (padding: 16px, gap: 16px)\n├── Field group (gap: 4px) ← dense: label, input, helper text\n│ ├── Label: \"Upstream DNS\"\n│ ├── Input: \"8.8.8.8\"\n│ └── Helper: \"Comma-separated list of upstream DNS servers.\"\n└── Field group (gap: 4px) ← same dense group, separated by larger gap\n ├── Label: \"Default TTL\"\n ├── Input: \"30\"\n └── Helper: \"...\"\n```\n\nIn this example, the form’s `gap` separates the two field groups with comfortable spacing. Inside each field group, a small gap keeps the label, input, and helper text tightly bound as a single unit. The form container owns the inter-group spacing; each field group owns its internal density.\n\nThe same ownership rule applies regardless of tier:\n\n- App forms, dashboards, and settings pages\n- Editorial sections, figures, and calls to action\n- Documentation articles, callouts, and examples\n- Markdown or rich-text renderers wrapped by the design system\n\n### 2.4.4 Application-specific container provisions\n\nOne container pattern is unique to application layouts:\n\nFixed-height status bar. A status bar is simply a container with a fixed height. Its width can span both the main area and side drawers, or be scoped to the main area only, depending on use case. Like all application containers, it resets default child margins and owns the spacing between its children.\n\n### 2.5 Intra-component vertical padding\n\nIntra-component vertical padding is component-owned: each component sets its internal top/bottom padding regardless of context.\n\nFor example, buttons, inputs, and cards keep the same internal top/bottom padding whether they appear alone or inside grouped layouts.\n\nWhen borders change the box model, adjust top/bottom padding so outer component height remains aligned to whole-`bU` steps.\n\n### 2.6 Baseline grid and nudges\n\n2.6.1 The baseline grid\n\nIn our design system, the default baseline unit is 4px (previously 8px). \nWe use the acronym `bU` throughout this specification.\n\n> Box model consideration: When elements have borders, the entire box model must be accounted for in height calculations. For example, an element with padding: 16px and border: 1px should reduce padding to 14px to maintain the same total height. This principle applies across the system.\n\n2.6.2 The nudge technique\n\nThe underlying issue is browser line-height centering: CSS centres text vertically within the line-height box rather than anchoring it to a baseline. This means text baselines can land at inconsistent positions unless they are compensated deliberately.\n\nNudge tokens address that by adding a small `padding-top` to text-bearing elements or components.\n\nIn baseline-aligned contexts, baseline correction is an explicit exception to the semantic spacing rule.\n\nImplementation notes:\n\n- `padding-top = nudge`\n- `margin-bottom = baseline-compensation`\n- Container `gap` or structured transition rule = semantic spacing\n\nSome implementations approximate measured nudges with a cap-height alignment shortcut.\n\n```css\nThat avoids reading and maintaining calculated nudges, but it is less accurate because cap height is only a proxy for the ascender/descender metrics that determine line-box centering.\nThe ownership model does not change: if text is shifted with `padding-top`, the resulting offset still needs compensation.\n.stack {\ngap: var(–space-y, 1rem);\n}\n.baseline-text {\npadding-top: var(–nudge, 0px);\nmargin-bottom: var(–baseline-comp, 0px);\n}\n```\n\nThis preserves the architecture: containers still own semantic spacing, while text elements own the correction needed to land their baselines on the grid.\n\n2.6.3 Scope\n\nBaseline alignment is currently enabled for editorial / marketing and documentation. In those contexts, text elements own nudge and baseline compensation while containers still own semantic spacing. Application UI continues to use the same container-owned semantic spacing model without non-zero nudge compensation.\n\nCopy of Table 13\n\n\n\n## 3. Horizontal spacing\n\nHorizontal spacing uses a container-owned model throughout the system.\n\nUnlike vertical spacing, horizontal spacing rarely encodes typographic hierarchy between adjacent elements. Large separations are typically set by the grid (gutters, margins, keylines). What remains is spacing between grouped elements inside components and patterns, where container-defined gaps are simpler and more consistent.\n\n### 3.1 Layout-level spacing\n\nHorizontal spacing at the layout level is handled by the grid system:\n\nCopy of Table 14\n\nThe grid provides consistent horizontal rhythm across breakpoints and establishes keylines: shared horizontal offsets that align text and controls across components and patterns, improving scannability. Components placed within grid columns inherit this spacing automatically.\n\n> Two-dimensional grids: When layout produces a two-dimensional grid of items (card grids, dashboards, image galleries), the vertical gap between rows must equal the horizontal gutter (24px). This keeps items on a uniform spatial grid in both axes.\n\n### 3.2 Horizontal sibling spacing\n\nHorizontal spacing between sibling elements is container-owned: the parent context sets the gap.\n\nFor example, in a row of buttons or chips, the container defines the horizontal gap between items.\n\n\n\n### 3.3 Intra-component horizontal padding\n\nIntra-component horizontal padding is component-owned: each component sets its internal left and right padding regardless of context.\n\nFor example, buttons, inputs, and chips keep the same internal left and right padding whether they appear alone or inside grouped layouts.\n\nWhen borders change the box model, adjust left and right padding to preserve content box width. For bottom-only borders, left and right padding stays unchanged.\n\nCopy of Table 15\n\n\n\n## 4. Invariants\n\nInvariants are the non-negotiable rules this spacing model must preserve. They serve as evaluation criteria for architectural decisions and acceptance criteria for contributions.\n\n### 4.1 The invariant list\n\nCopy of Table 16\n\n### 4.2 How the invariants apply\n\nSubstitutability: containers own semantic spacing contracts, so children can be exchanged without inherited semantic-spacing side effects.\n\n- Locality: components own internal padding and any baseline correction; containers own inter-child semantic spacing.\n- No double spacing: semantic spacing does not stack with parent spacing. Where baseline compensation uses `margin-bottom`, it must remain distinct from the semantic spacing term.\n- Composition isolation: semantic spacing rules stay at container boundaries.\n\nPredictable removal: removing a child leaves the remaining container spacing intact.\n\n- Grid alignment: components and patterns should resolve to whole-bU outer heights.\n- Where baseline correction is required, the text element owns nudge and baseline compensation.\n\n### 4.3 Invariant priority\n\nWhen invariants conflict, resolve in this order:\n\n1. **Substitutability** – composition must remain predictable\n2. **Locality** – knowledge shouldn’t leak across boundaries\n3. **No double spacing** – additive bugs break layouts\n4. **Composition isolation** – parent-child contracts must be stable\n5. **Grid alignment** – vertical rhythm should be maintained\n6. **Predictable removal** – overrides must be safe\n\n> Grid alignment refers to outer component height in whole-bU steps; baseline correction is handled by nudges where needed.\n\n\n\n\n\n## 5. Authoring guidance\n\nThis section translates the architectural model into concrete decisions for the audiences who apply it daily.\n\n### 5.1 Component designers\n\nComponents are spacing-neutral externally, except for baseline compensation where baseline alignment is enabled.\n\nIf tiers use different nudge values, that is a token decision rather than a different semantic spacing architecture.\n\nCore rules\n\nComponents do not own inter-child semantic spacing.\n\n- Internal vertical padding is component-owned; use values from the spacing scale.\n- If the component contains text and uses nudge tokens, preserve outer height through the defined baseline-compensation term or equivalent internal box-model compensation.\n- If the component has a border that changes the box model, reduce padding to keep total height on whole-`bU` steps.\n\nAdditional rules\n\nInternal horizontal padding is always component-owned.\n\n- Do not ship authored layout dependence on semantic `margin-top` or `margin-bottom`.\n- Keep internal padding consistent regardless of layout context.\n- Text-bearing components apply nudge tokens where required.\n\nPre-review checklist\n\n- Spacing values use tokens, not arbitrary px\n- No authored layout dependence on child `margin-top` or semantic `margin-bottom`\n- Component height is whole-bU multiples (account for borders)\n\nVerification\n\n- Text-bearing components apply nudge tokens where required\n- Tested in composition inside a stack, a grid cell, and a prose wrapper where relevant\n- Container-owned spacing is used consistently across apps, editorial, and documentation\n- Where prose needs varied transitions, use a structured container rather than child-owned external spacing\n- Use tokenized gaps and padding values rather than ad hoc spacing fixes\n\n### 5.2 Pattern designers\n\nPatterns compose components. The principle: patterns own spacing between their children.\n\nUse uniform stack containers for repeated UI.\n\nUse structured prose wrappers for mixed editorial content when different transitions need different values.\n\n- Use nested containers where different local densities are needed.\n- Do not add one-off spacing overrides to individual children when the spacing decision belongs to the container.\n- For two-dimensional grids, set the vertical row gap equal to the horizontal gutter (24px).\n- Wrap markdown or rich-text output in a container that owns spacing for rendered children.\n\nPattern variants\n\nIf a pattern needs tighter or looser spacing, change the container recipe or use a component variant that keeps external spacing neutral.\n\n- Keep spacing decisions at the container or pattern boundary.\n- Do not depend on child `margin-bottom` to solve composition problems.\n\nSlot-based patterns\n\nWhen a pattern passes arbitrary children through a slot, wrap the slot in a container that owns spacing for that child list.\n\n- Do not depend on slotted children to provide their own external margins.\n- Document expected child types where the slot is constrained.\n- Use the same ownership model in apps, editorial, and documentation.\n\n\n\n\n\n## Appendices\n\n### A. References\n\n- Material Design 3: [Layout spacing](https://m3.material.io/foundations/layout/understanding-layout/spacing#9ebf5386-23ca-400a-b68d-e8c679a4a19d)\n- Shopify Polaris: [Stack](https://shopify.dev/docs/api/checkout-ui-extensions/latest/polaris-web-components/layout-and-structure/stack)\n - Atlassian Design System: [Stack](https://atlassian.design/components/primitives/stack/)\n\n";
|
|
10
|
-
ds:knownEdgeCases "";
|
|
11
10
|
ds:conceptType ds:concepttype.Explanation.
|
|
@@ -6,6 +6,5 @@ ds:concept.Foundations-Surfaces a ds:Concept;
|
|
|
6
6
|
ds:name "Foundations: Surfaces";
|
|
7
7
|
ds:summary "This document covers surface levels: how nesting a surface steps its tone, what each control looks like at every level, and which tokens the control CSS reads to follow the surface it sits on.";
|
|
8
8
|
ds:tier ds:global;
|
|
9
|
-
ds:content "**Status:** Final \n**Version:** 1.0 \n**Last updated:** 2026-09-11 \n**Source:** `@canonical/react-ds-global-form` Storybook guide — _Surfaces_\n\n\nForm controls are **surface-aware**. Rather than painting one fixed colour on
|
|
10
|
-
ds:knownEdgeCases "";
|
|
9
|
+
ds:content "**Status:** Final \n\n**Version:** 1.0 \n\n**Last updated:** 2026-09-11 \n\n**Source:** `@canonical/react-ds-global-form` Storybook guide — _Surfaces_\n\n## Surface awareness\n\nIn terms of UI blocks, only items consuming “background” tokens, inputs, navigation and items consuming ghost background tokens change with the surface; the components consuming “foreground” tokens (for example [Chip](https://docs.superhuman.com/d/_dNyzE_TLZDh#_tugrid-20dWwIHYhx/_rui-N-fnT7n4mU), [Badge](https://docs.superhuman.com/d/_dNyzE_TLZDh#_tugrid-20dWwIHYhx/_rui-eHpgyzRyDl) etc), borders, text, and icons do not change color depending on the surface level. The accessibility contrast is calculated so they can be used comfidently on all surfaces.\n\n## Form controls and surfaces\n\nForm controls are **surface-aware**. Rather than painting one fixed colour on every background, the checkbox, radio and switch read their colours from the design system's `--surface-color-foreground-*` channels, so a control recolours to suit the surface it sits on.\n\n\n\nSurfaces step by **nesting**, not by a prop: a `.surface` element is level 1, a `.surface` inside another `.surface` is level 2, and a third level of nesting is level 3. Each level resolves the surface channels to its own tone, and any control inside inherits it automatically.\n\nSurface steps\n\n\n\n### Every control at each level\n\n\n\nSelected fills, radio dots and switch tracks step with the band; the switch knob\n\nand the masked checkmark read their own surface channels too, so they stay\n\nlegible against the stepping fill.\n\n\n\n_(An interactive example accompanies this section in Storybook.)_\n\n\n\n### Checkbox\n\n\n\nThe box fill and the masked checkmark both resolve per surface, including the indeterminate state.\n\n\n\n_(An interactive example accompanies this section in Storybook.)_\n\n\n\n### Switch\n\nThe track (selected and unselected) steps with the surface, while the knob reads its own channel so it keeps contrast against the track at every level.\n\n\n\n_(An interactive example accompanies this section in Storybook.)_\n\n\n\n### What the control CSS reads\n\n\n\nEach control names the surface channel with a flat fallback, so it works whether or not a surface context is present:\n\n```\n```css\n.ds.form-checkbox:checked {\n background: var(\n --surface-color-foreground-checkbox-selected,\n var(--color-foreground-checkbox-selected)\n );\n}\n```\n```\n\n\n\nHover on a selected control shifts **only** the fill/track — via the `--hover--color-foreground-*-selected` channels — never the checkmark glyph or the switch knob. This replaced an earlier whole-element `filter: brightness()` that dimmed the glyph along with the fill.\n\n\n\n### Upstream note\n\n\n\nThe design tokens currently provide surface channels for the controls' unselected and checkmark/knob colours. The `-selected` surface channels (and the switch's unselected track) are supplied by a temporary shim in `@canonical/styles` (`controls.hover.shim.css`) until they are generated upstream; the components already read them, so no component change is needed when they land.\n\n";
|
|
11
10
|
ds:conceptType ds:concepttype.Explanation.
|
|
@@ -6,6 +6,5 @@ ds:concept.Foundations-Typography a ds:Concept;
|
|
|
6
6
|
ds:name "Foundations: Typography";
|
|
7
7
|
ds:summary "This document covers the foundations of the type scale decisions foundational to the Canonical design language, including: \n\n- The mathematical foundation of the type scale (formula, parameters, full sequence)\n- Per-tier heading hierarchies – which sizes, weights, and line heights apply to h1–h6 and body text in applications, documentation, and editorial\n- Weight pairing rules and emphasis conventions\n- Line height selection and baseline grid alignment\n- Responsive scaling behaviour\n- Accessibility constraints on minimum sizes";
|
|
8
8
|
ds:tier ds:global;
|
|
9
|
-
ds:content "**Status:** Draft \n**Version:** 1.0 \n**Last updated:** 2026-04-25\n\n\n\n## Table of contents\n\n1. [Problem statement and scope](#1-problem-statement-and-scope)\n2. [The modular scale](#2-the-modular-scale)\n3. [Domain type scales](#3-domain-type-scales)\n4. [Weights](#4-weights)\n5. [Line height and the baseline grid](#5-line-height-and-the-baseline-grid)\n6. [Cross-domain principles](#6-cross-domain-principles)\n7. [Accessibility](#7-accessibility)\n8. [Responsive behaviour](#8-responsive-behaviour)\n9. [Invariants](#9-invariants)\n10. [Tooling](#10-tooling)\n\n\n\n## Glossary\n\nTable 54\n\n\n\n## 1. Problem statement and scope\n\n### 1.1 The problem\n\nCanonical’s product ecosystem spans three broad tiers:\n\n- **Applications** (MAAS, Landscape, Launchpad) – dense, tool-oriented interfaces where users work in extended sessions, often in small windows alongside other software.\n- **Documentation** (discourse sites, installation guides, API references) – deep, structured content where authors need semantic emphasis at every heading level.\n- **Editorial** ([ubuntu.com](http://ubuntu.com), [canonical.com](http://canonical.com), blog posts, campaign pages) – short-session content where scannability, visual hierarchy, and impact drive comprehension.\n\nEach tier demands a different balance between information density and visual contrast. Applications need the most compact scale possible. Documentation needs moderate contrast with strong emphasis support. Editorial needs generous contrast to guide rapid scanning. No single heading hierarchy optimally serves all three.\n\nWithout a shared mathematical foundation, these three hierarchies risk diverging into ad-hoc size choices. The result is inconsistency across products, difficulty maintaining design tokens, and no principled way to resolve conflicts when content moves between tiers.\n\n### 1.2 Scope\n\nThis spec covers:\n\n- The mathematical foundation of the type scale (formula, parameters, full sequence)\n- Per-tier heading hierarchies – which sizes, weights, and line heights apply to h1–h6 and body text in applications, documentation, and editorial\n- Weight pairing rules and emphasis conventions\n- Line height selection and baseline grid alignment\n- Responsive scaling behaviour\n- Accessibility constraints on minimum sizes\n\nThis spec does not cover:\n\n- Typeface selection (see the typeface spec)\n- Vertical and horizontal spacing between elements (see the spacing spec)\n- Grid column structure and layout zones (see the grid spec)\n- CSS implementation details or token naming conventions (see the `docs-typescale` reference implementation)\n- OpenType feature usage, letter-spacing, or text decoration\n\n### 1.3 Goals\n\n- **Harmonic consistency:** all type sizes across all three tiers derive from a single modular scale, ensuring visual coherence even when content crosses tier boundaries.\n- **Density fit:** each tier selects the portion of the scale that matches its density requirements – compact for applications, moderate for documentation, generous for editorial.\n- **Emphasis without proliferation:** heading hierarchies rely on weight pairing to distinguish levels, minimising the number of distinct sizes needed.\n- **Baseline grid integration:** every type size maps to a line height that is a multiple of the 4px baseline unit (`bU`), producing consistent vertical rhythm.\n\n\n\n## 2. The modular scale\n\n### 2.1 Foundation\n\nOur type scale is based on Spencer Mortensen’s refinement of the classical modular scale described by Robert Bringhurst in *The Elements of Typographic Style*¹ – a system with centuries of proven application in both print and digital typography.\n\nMortensen replaces the classical scale’s finite sequence with a continuous formula that identifies and corrects several outliers in the traditional progression. Because his improvements deliver greater mathematical precision – a quality central to our brand – we adopt his sequence as the basis for all three domain scales.\n\n### 2.2 The formula\n\nThe scale is expressed as a fractional-step geometric progression:\n\n```\nf(i) = f(0) × pow(ratio, i / n)\n```\n\nWhere:\n\n- `f(0)` is the base type size – 1rem (16px) for editorial, 0.875rem (14px) for documentation and applications\n- `ratio` defines the harmonic relationship – 2 for octave-based scales\n- `n` represents the number of steps per octave – 5 in Mortensen’s classic scale\n- `i` is the position in the sequence\n\nThe result is an infinite sequence of harmonically related sizes. Each domain selects a contiguous subset of this sequence for its heading hierarchy.\n\n### 2.3 The full sequence\n\nThe following table lists every size in the scale that our system uses, from 6px up to 96px. Sizes are rounded to whole pixels for implementation; rem values assume a 16px root.\n\nTable 55\n\n> **Note:** The sub-10px sizes (steps –5 through –2) exist in the mathematical sequence but are rarely used in UI. They appear in captions, legal text, and subscripts where applicable.\n\n\n\n## 3. Domain type scales\n\nWe work with content broadly categorised into three tiers – applications, documentation, and editorial. Each has distinct constraints and established practices that merit a separate heading hierarchy. The three tiers share the modular scale as a common foundation but optimise for different points on the density–contrast spectrum.\n\n### 3.1 Applications\n\nContext: maximum information density\n\nApplications support users through extended interaction sessions. Unlike websites – where interactions are often brief and familiarity is limited – applications assume expertise and must be optimised for sustained focus. User testing shows that applications are frequently run in small windows alongside other software, reinforcing the need for the highest possible information density.\n\nOn Ubuntu, default type sizes for UI and terminals fall between 11px and 13px. Aligning our application type sizes as closely as web accessibility standards allow reduces the cognitive effort required when users switch between tools.\n\nThe application type scale\n\nTo achieve maximum density, body text, h6, and h5 all share the root type size of 14px. H5 and h6 are distinguished from body text by bold and bold small caps rather than by size. The remaining heading levels (h4/h3, then h2/h1) use the minimum size increments needed for clear distinction. The result is the most compact scale of all three tiers, using only three distinct sizes:\n\nTable 56\n\n**Size discipline:** 3 distinct sizes (14, 18, 24px).\n\n### 3.2 Documentation\n\nContext: information density with semantic clarity\n\nDocumentation typography prioritises information density while maintaining the ability to create semantic emphasis. Technical authors need to distinguish between regular text, *emphasis*, and **strong emphasis** at every heading level. This requirement drives the weight pairing strategy and a slightly broader size range than applications.\n\nThe documentation type scale\n\nBody text is set at 14px. Bold at 14px is reserved for strong emphasis in body copy. Headings are set in pairs of lighter and bolder weights, skipping one step in the modular scale between pairs for clear distinction and consistent rhythm:\n\nTable 57\n\n**Size discipline:** 4 distinct sizes (14, 18, 24, 32px).\n\n### 3.3 Editorial\n\nContext: scannability, clarity, impact\n\nEditorial content – including marketing sites, blog posts, and promotional materials – serves users who are scanning, evaluating, and consuming information in short, focused sessions. Higher contrast and more generous spacing facilitate quick comprehension and help users rapidly locate the information they need. Editorial typography therefore applies the strongest contrasts in type size to establish a clear visual hierarchy.\n\nThe editorial type scale\n\nBody text is set at 16px – the browser default, providing optimal accessibility compliance. Headings use the widest range of sizes, with the largest (h1 at 42px) providing strong visual impact:\n\nTable 58\n\n**Size discipline:** 3 distinct sizes (16, 24, 42px), though up to 5 are available in the scale for display use cases (e.g. 84px at weight 200 for hero headlines).\n\n### 3.4 Comparison\n\nTable 59\n\n\n\n## 4. Weights\n\nOur system uses font weight as a primary hierarchy signal, reducing dependence on type size alone. This requires sufficient contrast between weight values to prevent visual confusion.\n\n### 4.1 Weight contrast minimum\n\nAdjacent weights in any pairing must differ by at least 200 units. This rule applies to:\n\n- Weight pairs within a heading level (e.g. h1 at 500, h2 at 300 – a difference of 200)\n- Emphasis within a heading (e.g. h1 at 500, emphasised word at 700 – a difference of 200)\n- Body text and strong emphasis (regular 400, bold 600 – a difference of 200)\n\nSkipping the intermediate value (e.g. going from 400 to 600, not 400 to 500) ensures clear visual distinction at every size.\n\n### 4.2 Body text\n\nBody text is set in regular weight (400). The next available weight at the same size is 600 (semi-bold), used for strong emphasis. Weight 500 is skipped at body size to maintain the 200-unit minimum contrast.\n\n### 4.3 Heading weight pairing\n\nHeadings follow three rules:\n\n1. **Weight decreases as size increases.** Larger headings use lighter weights. For example, 18px documentation h3 uses weight 600, while 24px editorial h3 uses weight 500.\n2. **Pairs of headings share a type size and are distinguished by weight.** H1 and h2 share a size; h3 and h4 share a size. This halves the number of distinct sizes needed.\n3. **Weight pairs differ by at least 200 units.** Within a pair, the bolder heading uses weight 500 or 600; the lighter uses 300 or 400.\n\n### 4.4 Emphasis in headings\n\nEmphasis within headings uses a weight increment of 200 from the heading’s own weight:\n\n- h1 (weight 500) → emphasised words: 700\n- h2 (weight 300) → emphasised words: 500\n\n> **Note:** emphasis should be used sparingly if at all. When used, it should highlight only key words, never the entire heading.\n\n### 4.5 Available weights\n\nTable 60\n\n\n\n## 5. Line height and the baseline grid\n\n### 5.1 Line height ratios\n\nLine height ratios follow a traditional pattern: most generous at body text size, then progressively tighter as heading sizes increase. We start at **1.5** for body text – a ratio that provides optimal readability for sustained reading while maintaining reasonable space efficiency.\n\nAt display sizes, ratios compress toward **1.1**, reflecting the typographic convention that large text needs proportionally less leading to maintain visual cohesion.\n\n### 5.2 Snapping to the baseline grid\n\nAll line heights must be a multiple of the 4px baseline unit (`bU`). We select the multiple of the baseline unit that yields a ratio appropriate to the heading’s position in the hierarchy. The following table lists the recommended line height at every size in the scale:\n\nTable 61\n\n> **Note:** all line heights in our system are multiples of the 4px baseline unit.\n\n### 5.3 Baseline alignment with nudge tokens\n\nCSS line-height alone does not guarantee that text baselines land on the grid. The vertical position of a glyph’s baseline within its line box depends on the font’s ascender/descender metrics, which vary by typeface, size, and rendering engine.\n\nNudge tokens solve this by adding a measured `padding-top` to each text element, shifting the first baseline onto the nearest grid line. Nudge values are:\n\n- **Font-specific** – calculated for Ubuntu Sans\n- **Size-specific** – each size/line-height pair has its own nudge\n- **Platform-measured** – extracted from Chromium at 1× device pixel ratio, snapped to the nearest 0.0625rem (1px)\n\nThe baseline compensation model (defined in the spacing spec §2.6.2) preserves the element’s total block contribution:\n\n- `padding-top = nudge`\n- `baseline-compensation = bU − nudge`\n- `margin-bottom = semantic-spacing + baseline-compensation`\n\nThis means nudge tokens shift the baseline without consuming any of the element’s semantic spacing.\n\n> **Scope:** the nudge technique applies only to the editorial and documentation tiers. The application tier is exempt – all nudge tokens are intentionally set to `0`. See the spacing spec §2.6.3 for rationale.\n\n```css\n/* Example: documentation h1 at 32px / 40px line height, bU = 4px */\nh1 {\n font-size: 2rem;\n line-height: 2.5rem;\n font-weight: 500;\n padding-top: 0.039rem; /* nudge */\n margin-bottom: calc(\n var(--space-after-semantic-h1) /* e.g. 1rem */\n + var(--space-after-comp-h1) /* bU − nudge */\n );\n margin-top: 0;\n}\n```\n\n\n\n## 6. Cross-domain principles\n\n### 6.1 Restraint in type size usage\n\nThe modular scale offers an infinite sequence of sizes. Applied without restraint, it can introduce inconsistency and visual clutter. We take inspiration from Massimo Vignelli², who often limited his typography to just two type sizes.\n\nOur type scales make full use of a typeface’s range of styles rather than depending on size alone. By alternating lighter and bolder weights at body and heading levels, we eliminate the need for at least three extra type sizes. We also incorporate the newly available small caps in Ubuntu Sans, reinforcing a disciplined and economical approach to font sizing.\n\n### 6.2 Navigating a type family\n\nThe way we navigate a font family to craft our type scales is inspired by Robert Bringhurst’s \"grammatical roadmap\"¹ – a systematic method for traversing the styles available in a type family (roman, italic, bold, small caps, etc.) to build a clear typographic hierarchy.\n\nWe make a small departure: we use bold small caps instead of bold full caps (as in Bringhurst’s original roadmap), since full caps can be perceived as typographic shouting. The tall x-height of Ubuntu Sans makes our small caps slightly larger than those in classical typefaces, helping establish a clear hierarchy without resorting to capitalisation.\n\n### 6.3 The baseline grid\n\nThe baseline grid is the backbone of our typography. It provides accountability and rigour rarely seen on the web, especially at the enterprise level. Every typographic element, spacing decision, border, and UI component in our design system aligns to it.\n\nThis is not merely an aesthetic choice – it is a systematic approach that ensures:\n\n- **Visual consistency:** all elements adhere to an invisible vertical rhythm, rather than floating arbitrarily.\n- **Scalable precision:** everything in our design system – from a simple button to complex components and patterns – aligns to the baseline grid. This alignment is especially visible across columns, reinforcing a sense of precision and rigour.\n- **Quality assurance:** any visual inconsistency becomes immediately apparent. We provide a baseline grid visualisation utility (in both Figma and CSS) to highlight drift from the grid.\n\n### 6.4 Font stacks\n\nAll tiers use Ubuntu Sans as the primary typeface, with a system font fallback chain for environments where Ubuntu Sans is unavailable:\n\nTable 62\n\n\n\n## 7. Accessibility\n\n### 7.1 Minimum size requirements\n\nAll base type sizes meet or exceed WCAG 2.1 guidelines for minimum readable size:\n\n- **Editorial:** 16px (1rem) base provides optimal accessibility compliance and matches the browser default.\n- **Documentation and applications:** 14px (0.875rem) base meets minimum readable size requirements while optimising for information density.\n\nNo heading or body text in any tier falls below 14px. Smaller sizes in the scale (10–12px) are reserved for captions, labels, and legal text where reduced size is contextually appropriate.\n\n### 7.2 Contrast standards\n\nType size affects the minimum contrast ratio required by WCAG 2.1:\n\n- Text below 18px (or below 14px bold) requires a **4.5:1** contrast ratio against its background (AA level).\n- Text at or above 18px (or at/above 14px bold) qualifies as “large text” and requires a **3:1** ratio (AA level).\n\nAll heading and body combinations in our system meet at least AA contrast requirements when rendered in the default palette.\n\n\n\n## 8. Responsive behaviour\n\n### 8.1 Root em scaling\n\nAll tiers include an optional root em scaling feature that proportionally scales all `rem`-based measurements by increasing the root font size on larger screens. The current default factor is **1.125** (18px root instead of 16px), applied above the large breakpoint (currently 1680px).\n\nBecause our type sizes, line heights, and spacing are all expressed in `rem`, this single change effectively “zooms” the entire UI without breaking any proportional relationships.\n\n### 8.2 Documentation and applications\n\nDocumentation and application tiers use consistent sizing across breakpoints. No size increases occur on larger screens beyond the optional root em scaling.\n\n### 8.3 Editorial\n\nIn the editorial domain, we scale larger headings (h1/h2 and h3/h4) on smaller screens to preserve presentation quality. Body text remains at 16px across all breakpoints for accessibility.\n\nEditorial domains implement root em scaling by default for larger screens.\n\n\n\n## 9. Invariants\n\nThe following rules are non-negotiable. Any implementation that violates them is considered a bug.\n\nTable 63\n\n### 9.1 Invariant priority\n\nWhen invariants conflict – for example, if an unusual size would satisfy baseline alignment but violate the single-scale rule – resolve in the order listed above. The single-scale rule takes precedence over all others.\n\n\n\n## 10. Tooling\n\nImplementing baseline grid alignment traditionally required manual measurement and adjustment – a tedious, error-prone process that limited adoption of baseline grids on the web. We contribute open-source tooling that automates this process.\n\n### 10.1 npm package\n\nThe [@lyubomir-popov/baseline-nudge-generator](https://www.npmjs.com/package/@lyubomir-popov/baseline-nudge-generator) package automates baseline alignment by:\n\n- Extracting font metrics from TTF/WOFF files programmatically\n- Calculating precise CSS nudge values required for baseline alignment\n- Generating design tokens that maintain mathematical relationships\n- Providing interactive demos with baseline grid overlays for verification\n\n### 10.2 Shell script\n\nThe [unified-type-scale.sh](https://github.com/lyubomir-popov/docs-typescale) script generates modular scale sequences:\n\n```bash\n# Continuous formula mode (Mortensen)\n./unified-type-scale.sh continuous <f0> <ratio> <n> [rounding]\n\n# Classic typographic scale mode (harmonic ratios)\n./unified-type-scale.sh classic <f0> <n> [rounding]\n```\n\nRounding options: `none` (4 decimal places), `floor`, `round`, `0.5` (default – snaps to nearest half-pixel).\n\n### 10.3 Figma plugin\n\nA Figma plugin reads the typography configuration and automatically generates text components with correct sizes, weights, line heights, and nudge values. This ensures design files stay synchronised with the token definitions.\n\n### 10.4 Spreadsheet reference\n\nA [spreadsheet](https://docs.google.com/spreadsheets/d/1_zfQX8JtJ6c7SAIChu0t08CFya2szX3PFD-_rVLDqq4/edit?gid=0#gid=0) provides a quick designer reference, implementing the full modular scale with recommended line heights and per-domain mappings.\n\n\n\n## References\n\n1. Robert Bringhurst, *The Elements of Typographic Style*. The grammatical roadmap for navigating a type family appears on p. 55; the classical modular scale is discussed in chapters 8.3–8.4.\n2. Massimo Vignelli, *The Vignelli Canon*, p. 61 – on limiting typography to two type sizes. Available from the [Vignelli Center](https://www.rit.edu/vignellicenter/sites/rit.edu.vignellicenter/files/documents/The%20Vignelli%20Canon.pdf).\n3. Spencer Mortensen, [“Typographic Scale”](https://spencermortensen.com/articles/typographic-scale/) – the mathematical refinement of the classical scale adopted as our foundation.\n4. W3C, [WCAG 2.1 Success Criterion 1.4.3: Contrast (Minimum)](https://www.w3.org/WAI/WCAG21/Understanding/contrast-minimum.html).\n\n\n\n## Spec history\n\nTable 64";
|
|
10
|
-
ds:knownEdgeCases "";
|
|
9
|
+
ds:content "**Status:** Draft \n**Version:** 1.0 \n**Last updated:** 2026-04-25\n\n\n\n## Table of contents\n\n1. [Problem statement and scope](#1-problem-statement-and-scope)\n2. [The modular scale](#2-the-modular-scale)\n3. [Tier-specific type sets](https://docs.superhuman.com/d/_dNyzE_TLZDh#_tuier-specifictypesets)\n4. [Weights](#4-weights)\n5. [Line height and the baseline grid](#5-line-height-and-the-baseline-grid)\n6. [Cross-domain principles](#6-cross-domain-principles)\n7. [Accessibility](#7-accessibility)\n8. [Responsive behaviour](#8-responsive-behaviour)\n9. [Invariants](#9-invariants)\n10. [Tooling](#10-tooling)\n\n\n\n\n\n## Glossary\n\nTypography glossary\n\n\n\n## 1. Problem statement and scope\n\n### 1.1 The problem\n\nCanonical’s product ecosystem spans three broad [https://docs.superhuman.com/d/_dNyzE_TLZDh/_suGGZ-v7](https://docs.superhuman.com/d/_dNyzE_TLZDh/_suGGZ-v7) :\n\n- **Applications** (MAAS, Landscape, Launchpad) – dense, tool-oriented interfaces where users work in extended sessions, often in small windows alongside other software.\n- **Documentation** (discourse sites, installation guides, API references) – deep, structured content where authors need semantic emphasis at every heading level.\n- **Editorial** ([ubuntu.com](http://ubuntu.com), [canonical.com](http://canonical.com), blog posts, campaign pages) – short-session content where scannability, visual hierarchy, and impact drive comprehension.\n\nEach tier demands a different balance between information density and visual contrast. Applications need the most compact scale possible. Documentation needs moderate contrast with strong emphasis support. Editorial needs generous contrast to guide rapid scanning. No single heading hierarchy optimally serves all three.\n\nWithout a shared mathematical foundation, these three hierarchies risk diverging into ad-hoc size choices. The result is inconsistency across products, difficulty maintaining design tokens, and no principled way to resolve conflicts when content moves between tiers.\n\n### 1.2 Scope\n\nThis document covers:\n\n- The mathematical foundation of the type scale (formula, parameters, full sequence)\n- Per-tier heading hierarchies – which sizes, weights, and line heights apply to h1–h6 and body text in applications, documentation, and editorial\n- Weight pairing rules and emphasis conventions\n- Line height selection and baseline grid alignment\n- Responsive scaling behaviour\n- Accessibility constraints on minimum sizes\n\nThis document does not cover:\n\n- Typeface selection \n- Vertical and horizontal spacing between elements (visit [Foundations: Spacing](https://docs.superhuman.com/d/_dNyzE_TLZDh#_tugrid-GnfOU3MM-3/_rui-F6TAL50Cgy) )\n- Grid column structure and layout zones (visit [Foundations: Grid & Layout](https://docs.superhuman.com/d/_dNyzE_TLZDh#_tugrid-GnfOU3MM-3/_rui-qRZ-zDsjGX) )\n- CSS implementation details or token naming conventions\n- OpenType feature usage, letter-spacing, or text decoration\n\n### 1.3 Goals\n\n- **Harmonic consistency:** all type sizes across all three tiers derive from a single modular scale, ensuring visual coherence even when content crosses tier boundaries.\n- **Density fit:** each tier selects the portion of the scale that matches its density requirements – compact for applications, moderate for documentation, generous for editorial.\n- **Emphasis without proliferation:** heading hierarchies rely on weight pairing to distinguish levels, minimising the number of distinct sizes needed.\n- **Baseline grid integration:** every type size maps to a line height that is a multiple of the 4px baseline unit (`bU`), producing consistent vertical rhythm.\n\n\n\n## 2. The modular scale\n\n### 2.1 Foundation\n\nOur type scale is based on Spencer Mortensen’s refinement of the classical modular scale described by Robert Bringhurst in *The Elements of Typographic Style*¹ – a system with centuries of proven application in both print and digital typography.\n\nMortensen replaces the classical scale’s finite sequence with a continuous formula that identifies and corrects several outliers in the traditional progression. Because his improvements deliver greater mathematical precision – a quality central to our brand – we adopt his sequence as the basis for all three domain scales.\n\n### 2.2 The formula\n\nThe scale is expressed as a fractional-step geometric progression:\n\n```\nf(i) = f(0) × pow(ratio, i / n)\n```\n\nWhere:\n\n- `f(0)` is the base type size – 1rem (16px) for editorial, 0.875rem (14px) for documentation and applications\n- `ratio` defines the harmonic relationship – 2 for octave-based scales\n- `n` represents the number of steps per octave – 5 in Mortensen’s classic scale\n- `i` is the position in the sequence\n\nThe result is an infinite sequence of harmonically related sizes. Each domain selects a contiguous subset of this sequence for its heading hierarchy.\n\n### 2.3 The full sequence\n\nThe following table lists every size in the scale that our system uses, from 6px up to 96px. Sizes are rounded to whole pixels for implementation; rem values assume a 16px root.\n\nTable 55\n\n> **Note:** The sub-10px sizes (steps –5 through –2) exist in the mathematical sequence but are rarely used in UI. They appear in captions, legal text, and subscripts where applicable.\n\n\n\n## 3. Tier-specific type sets\n\nWe work with content broadly categorised into three tiers – applications, documentation, and editorial. Each has distinct constraints and established practices that merit a separate heading hierarchy. The three tiers share the modular scale as a common foundation but optimise for different points on the density–contrast spectrum.\n\n### 3.1 Applications\n\nContext: maximum information density\n\nApplications support users through extended interaction sessions. Unlike websites – where interactions are often brief and familiarity is limited – applications assume expertise and must be optimised for sustained focus. User testing shows that applications are frequently run in small windows alongside other software, reinforcing the need for the highest possible information density.\n\nOn Ubuntu, default type sizes for UI and terminals fall between 11px and 13px. Aligning our application type sizes as closely as web accessibility standards allow reduces the cognitive effort required when users switch between tools.\n\n#### The application type scale\n\nTo achieve maximum density, body text, h6, and h5 all share the root type size of 14px. H5 and h6 are distinguished from body text by bold and bold small caps rather than by size. The remaining heading levels (h4/h3, then h2/h1) use the minimum size increments needed for clear distinction. The result is the most compact scale of all three tiers, using only three distinct sizes. \n \n**Size discipline:** 3 distinct sizes (14, 18, 24px).\n\nApplication type scale\n\n### 3.2 Documentation\n\nContext: information density with semantic clarity\n\nDocumentation typography prioritises information density while maintaining the ability to create semantic emphasis. Technical authors need to distinguish between regular text, *emphasis*, and **strong emphasis** at every heading level. This requirement drives the weight pairing strategy and a slightly broader size range than applications.\n\nThe documentation type scale\n\nBody text is set at 14px. Bold at 14px is reserved for strong emphasis in body copy. Headings are set in pairs of lighter and bolder weights, skipping one step in the modular scale between pairs for clear distinction and consistent rhythm:\n\nTable 57\n\n**Size discipline:** 4 distinct sizes (14, 18, 24, 32px).\n\n### 3.3 Editorial\n\nContext: scannability, clarity, impact\n\nEditorial content – including marketing sites, blog posts, and promotional materials – serves users who are scanning, evaluating, and consuming information in short, focused sessions. Higher contrast and more generous spacing facilitate quick comprehension and help users rapidly locate the information they need. Editorial typography therefore applies the strongest contrasts in type size to establish a clear visual hierarchy.\n\nThe editorial type scale\n\nBody text is set at 16px – the browser default, providing optimal accessibility compliance. Headings use the widest range of sizes, with the largest (h1 at 42px) providing strong visual impact:\n\nTable 58\n\n**Size discipline:** 3 distinct sizes (16, 24, 42px), though up to 5 are available in the scale for display use cases (e.g. 84px at weight 200 for hero headlines).\n\n### 3.4 Comparison\n\nTable 59\n\n\n\n## 4. Weights\n\nOur system uses font weight as a primary hierarchy signal, reducing dependence on type size alone. This requires sufficient contrast between weight values to prevent visual confusion.\n\n### 4.1 Weight contrast minimum\n\nAdjacent weights in any pairing must differ by at least 200 units. This rule applies to:\n\n- Weight pairs within a heading level (e.g. h1 at 500, h2 at 300 – a difference of 200)\n- Emphasis within a heading (e.g. h1 at 500, emphasised word at 700 – a difference of 200)\n- Body text and strong emphasis (regular 400, bold 600 – a difference of 200)\n\nSkipping the intermediate value (e.g. going from 400 to 600, not 400 to 500) ensures clear visual distinction at every size.\n\n### 4.2 Body text\n\nBody text is set in regular weight (400). The next available weight at the same size is 600 (semi-bold), used for strong emphasis. Weight 500 is skipped at body size to maintain the 200-unit minimum contrast.\n\n### 4.3 Heading weight pairing\n\nHeadings follow three rules:\n\n1. **Weight decreases as size increases.** Larger headings use lighter weights. For example, 18px documentation h3 uses weight 600, while 24px editorial h3 uses weight 500.\n2. **Pairs of headings share a type size and are distinguished by weight.** H1 and h2 share a size; h3 and h4 share a size. This halves the number of distinct sizes needed.\n3. **Weight pairs differ by at least 200 units.** Within a pair, the bolder heading uses weight 500 or 600; the lighter uses 300 or 400.\n\n### 4.4 Emphasis in headings\n\nEmphasis within headings uses a weight increment of 200 from the heading’s own weight:\n\n- h1 (weight 500) → emphasised words: 700\n- h2 (weight 300) → emphasised words: 500\n\n> **Note:** emphasis should be used sparingly if at all. When used, it should highlight only key words, never the entire heading.\n\n### 4.5 Available weights\n\nTable 60\n\n\n\n## 5. Line height and the baseline grid\n\n### 5.1 Line height ratios\n\nLine height ratios follow a traditional pattern: most generous at body text size, then progressively tighter as heading sizes increase. We start at **1.5** for body text – a ratio that provides optimal readability for sustained reading while maintaining reasonable space efficiency.\n\nAt display sizes, ratios compress toward **1.1**, reflecting the typographic convention that large text needs proportionally less leading to maintain visual cohesion.\n\n### 5.2 Snapping to the baseline grid\n\nAll line heights must be a multiple of the 4px baseline unit (`bU`). We select the multiple of the baseline unit that yields a ratio appropriate to the heading’s position in the hierarchy. The following table lists the recommended line height at every size in the scale:\n\nTable 61\n\n> **Note:** all line heights in our system are multiples of the 4px baseline unit.\n\n### 5.3 Baseline alignment with nudge tokens\n\nCSS line-height alone does not guarantee that text baselines land on the grid. The vertical position of a glyph’s baseline within its line box depends on the font’s ascender/descender metrics, which vary by typeface, size, and rendering engine.\n\nNudge tokens solve this by adding a measured `padding-top` to each text element, shifting the first baseline onto the nearest grid line. Nudge values are:\n\n- **Font-specific** – calculated for Ubuntu Sans\n- **Size-specific** – each size/line-height pair has its own nudge\n- **Platform-measured** – extracted from Chromium at 1× device pixel ratio, snapped to the nearest 0.0625rem (1px)\n\nThe baseline compensation model (defined in the spacing spec §2.6.2) preserves the element’s total block contribution:\n\n- `padding-top = nudge`\n- `baseline-compensation = bU − nudge`\n- `margin-bottom = semantic-spacing + baseline-compensation`\n\nThis means nudge tokens shift the baseline without consuming any of the element’s semantic spacing.\n\n> **Scope:** the nudge technique applies only to the editorial and documentation tiers. The application tier is exempt – all nudge tokens are intentionally set to `0`. See the spacing spec §2.6.3 for rationale.\n\n```css\n/* Example: documentation h1 at 32px / 40px line height, bU = 4px */\nh1 {\n font-size: 2rem;\n line-height: 2.5rem;\n font-weight: 500;\n padding-top: 0.039rem; /* nudge */\n margin-bottom: calc(\n var(--space-after-semantic-h1) /* e.g. 1rem */\n + var(--space-after-comp-h1) /* bU − nudge */\n );\n margin-top: 0;\n}\n```\n\n\n\n## 6. Cross-domain principles\n\n### 6.1 Restraint in type size usage\n\nThe modular scale offers an infinite sequence of sizes. Applied without restraint, it can introduce inconsistency and visual clutter. We take inspiration from Massimo Vignelli², who often limited his typography to just two type sizes.\n\nOur type scales make full use of a typeface’s range of styles rather than depending on size alone. By alternating lighter and bolder weights at body and heading levels, we eliminate the need for at least three extra type sizes. We also incorporate the newly available small caps in Ubuntu Sans, reinforcing a disciplined and economical approach to font sizing.\n\n### 6.2 Navigating a type family\n\nThe way we navigate a font family to craft our type scales is inspired by Robert Bringhurst’s \"grammatical roadmap\"¹ – a systematic method for traversing the styles available in a type family (roman, italic, bold, small caps, etc.) to build a clear typographic hierarchy.\n\nWe make a small departure: we use bold small caps instead of bold full caps (as in Bringhurst’s original roadmap), since full caps can be perceived as typographic shouting. The tall x-height of Ubuntu Sans makes our small caps slightly larger than those in classical typefaces, helping establish a clear hierarchy without resorting to capitalisation.\n\n### 6.3 The baseline grid\n\nThe baseline grid is the backbone of our typography. It provides accountability and rigour rarely seen on the web, especially at the enterprise level. Every typographic element, spacing decision, border, and UI component in our design system aligns to it.\n\nThis is not merely an aesthetic choice – it is a systematic approach that ensures:\n\n- **Visual consistency:** all elements adhere to an invisible vertical rhythm, rather than floating arbitrarily.\n- **Scalable precision:** everything in our design system – from a simple button to complex components and patterns – aligns to the baseline grid. This alignment is especially visible across columns, reinforcing a sense of precision and rigour.\n- **Quality assurance:** any visual inconsistency becomes immediately apparent. We provide a baseline grid visualisation utility (in both Figma and CSS) to highlight drift from the grid.\n\n### 6.4 Font stacks\n\nAll tiers use Ubuntu Sans as the primary typeface, with a system font fallback chain for environments where Ubuntu Sans is unavailable:\n\nTable 62\n\n\n\n## 7. Accessibility\n\n### 7.1 Minimum size requirements\n\nAll base type sizes meet or exceed WCAG 2.1 guidelines for minimum readable size:\n\n- **Editorial:** 16px (1rem) base provides optimal accessibility compliance and matches the browser default.\n- **Documentation and applications:** 14px (0.875rem) base meets minimum readable size requirements while optimising for information density.\n\nNo heading or body text in any tier falls below 14px. Smaller sizes in the scale (10–12px) are reserved for captions, labels, and legal text where reduced size is contextually appropriate.\n\n### 7.2 Contrast standards\n\nType size affects the minimum contrast ratio required by WCAG 2.1:\n\n- Text below 18px (or below 14px bold) requires a **4.5:1** contrast ratio against its background (AA level).\n- Text at or above 18px (or at/above 14px bold) qualifies as “large text” and requires a **3:1** ratio (AA level).\n\nAll heading and body combinations in our system meet at least AA contrast requirements when rendered in the default palette.\n\n\n\n## 8. Responsive behaviour\n\n### 8.1 Root em scaling\n\nAll tiers include an optional root em scaling feature that proportionally scales all `rem`-based measurements by increasing the root font size on larger screens. The current default factor is **1.125** (18px root instead of 16px), applied above the large breakpoint (currently 1680px).\n\nBecause our type sizes, line heights, and spacing are all expressed in `rem`, this single change effectively “zooms” the entire UI without breaking any proportional relationships.\n\n### 8.2 Documentation and applications\n\nDocumentation and application tiers use consistent sizing across breakpoints. No size increases occur on larger screens beyond the optional root em scaling.\n\n### 8.3 Editorial\n\nIn the editorial domain, we scale larger headings (h1/h2 and h3/h4) on smaller screens to preserve presentation quality. Body text remains at 16px across all breakpoints for accessibility.\n\nEditorial domains implement root em scaling by default for larger screens.\n\n\n\n## 9. Invariants\n\nThe following rules are non-negotiable. Any implementation that violates them is considered a bug.\n\nTable 63\n\n### 9.1 Invariant priority\n\nWhen invariants conflict – for example, if an unusual size would satisfy baseline alignment but violate the single-scale rule – resolve in the order listed above. The single-scale rule takes precedence over all others.\n\n\n\n## 10. Tooling\n\nImplementing baseline grid alignment traditionally required manual measurement and adjustment – a tedious, error-prone process that limited adoption of baseline grids on the web. We contribute open-source tooling that automates this process.\n\n### 10.1 npm package\n\nThe [@lyubomir-popov/baseline-nudge-generator](https://www.npmjs.com/package/@lyubomir-popov/baseline-nudge-generator) package automates baseline alignment by:\n\n- Extracting font metrics from TTF/WOFF files programmatically\n- Calculating precise CSS nudge values required for baseline alignment\n- Generating design tokens that maintain mathematical relationships\n- Providing interactive demos with baseline grid overlays for verification\n\n### 10.2 Shell script\n\nThe [unified-type-scale.sh](https://github.com/lyubomir-popov/docs-typescale) script generates modular scale sequences:\n\n```bash\n# Continuous formula mode (Mortensen)\n./unified-type-scale.sh continuous <f0> <ratio> <n> [rounding]\n\n# Classic typographic scale mode (harmonic ratios)\n./unified-type-scale.sh classic <f0> <n> [rounding]\n```\n\nRounding options: `none` (4 decimal places), `floor`, `round`, `0.5` (default – snaps to nearest half-pixel).\n\n### 10.3 Figma plugin\n\nA Figma plugin reads the typography configuration and automatically generates text components with correct sizes, weights, line heights, and nudge values. This ensures design files stay synchronised with the token definitions.\n\n### 10.4 Spreadsheet reference\n\nA [spreadsheet](https://docs.google.com/spreadsheets/d/1_zfQX8JtJ6c7SAIChu0t08CFya2szX3PFD-_rVLDqq4/edit?gid=0#gid=0) provides a quick designer reference, implementing the full modular scale with recommended line heights and per-domain mappings.\n\n\n\n## References\n\n1. Robert Bringhurst, *The Elements of Typographic Style*. The grammatical roadmap for navigating a type family appears on p. 55; the classical modular scale is discussed in chapters 8.3–8.4.\n2. Massimo Vignelli, *The Vignelli Canon*, p. 61 – on limiting typography to two type sizes. Available from the [Vignelli Center](https://www.rit.edu/vignellicenter/sites/rit.edu.vignellicenter/files/documents/The%20Vignelli%20Canon.pdf).\n3. Spencer Mortensen, [“Typographic Scale”](https://spencermortensen.com/articles/typographic-scale/) – the mathematical refinement of the classical scale adopted as our foundation.\n4. W3C, [WCAG 2.1 Success Criterion 1.4.3: Contrast (Minimum)](https://www.w3.org/WAI/WCAG21/Understanding/contrast-minimum.html).\n5. [Canonical internal] [DE034 - typography tokens](https://docs.google.com/document/d/1HXYvbs9I_EJm2cCwjiNm_DTSwTT3IHQf6xl7mIpX2AY/edit?tab=t.0)\n\n\n\n## Spec history\n\nTable 64";
|
|
11
10
|
ds:conceptType ds:concepttype.Explanation.
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
@prefix ds: <https://ds.canonical.com/>.
|
|
2
|
+
@prefix anatomy: <https://anatomy.canonical.com/>.
|
|
3
|
+
@prefix dt: <https://dt.canonical.com/>.
|
|
4
|
+
|
|
5
|
+
ds:concept.How-to-choose-between-question-mark-and-information-icon a ds:Concept;
|
|
6
|
+
ds:name "How to choose between question mark and information icon";
|
|
7
|
+
ds:summary "*This concept is a stub.*\n\nThis article will help you decide between using the information icon or the question mark icon in your application when you want to signal to users that there is more information available on a specific topic.";
|
|
8
|
+
ds:tier ds:global;
|
|
9
|
+
ds:content "The information icon signals 'Here is additional context you might find useful,' making it a bit more proactive in offering supplementary details. The question mark icon signals 'Need help understanding this?', making it a bit more reactive and assuming that the user might be confused or unfamiliar with the concept.\n\nThere is a soft convention is that “the question mark icon indicates extensive help is available, provides an interface for someone having a problem to click, and implies that a more sophisticated means of resolving the problem is being offered. The information icon indicates only that some additional explanatory information is available, but not an extensive help system.”1 \n \nWith the `i` the system offers the additional information to the user, that may be useful even when they do not have a question.\n\nSo `i` is the right icon to use if you have information that:\n\n- the user would not ask for, because he's not missing it\n- is useful for a user who is interested in the details.\n\nInformation exposed only through a tooltip must never be essential to completing the task.\n\n\n\nWith the `**?**`, the system offers the information to the user, that they need when they have a question.\n\nSo `?` is the right icon to use if you have information that:\n\n- would unblock the user\n- would offer extensive supplimentary help\n\nIcons depend heavily on the visual conventions a user has been exposed to, so how they interpret an icon will often come down to their cultural background and prior experience. Ultimately, the accompanying text or tooltip is what communicates our intention to the user. However some additional internal research has proven the above assumptions.\n\n \nThe interaction and triggered component also varies depending on the provided information. This is how to decide what to do:\n\n```\nIs the information necessary to complete the task?\n│\n├── YES\n│ └── Don't hide it in a tooltip.\n│ Use visible helper text / inline guidance.\n│\n└── NO\n │\n Is it brief and contextual?\n │\n ├── YES\n │ └── i + tooltip\n │\n └── NO\n │\n Is it contextual and can be understood\n without leaving the current task?\n │\n ├── YES\n │ └── i + toggletip/popover\n │\n └── NO\n └── ? icon button + link to help/documentation\n```\n\n### Source\n\n1. [https://ux.stackexchange.com/questions/64920/info-icon-vs-question-mark](https://ux.stackexchange.com/questions/64920/info-icon-vs-question-mark)\n\n\n\n### References\n\n[https://www.nngroup.com/articles/info-tips-bad/](https://www.nngroup.com/articles/info-tips-bad/)\n\n[https://learn.microsoft.com/en-us/windows/win32/uxguide/vis-std-icons?redirectedfrom=MSDN](https://learn.microsoft.com/en-us/windows/win32/uxguide/vis-std-icons?redirectedfrom=MSDN)\n\n[https://ux.stackexchange.com/questions/80954/is-the-question-mark-internationally-recognised-as-an-icon-for-help](https://ux.stackexchange.com/questions/80954/is-the-question-mark-internationally-recognised-as-an-icon-for-help)\n\n[https://ux.stackexchange.com/questions/21102/best-uses-of-help-and-i-information-icons-in-ui](https://ux.stackexchange.com/questions/21102/best-uses-of-help-and-i-information-icons-in-ui)\n\n[https://uxmovement.com/forms/question-mark-vs-info-icon-when-to-use-which/](https://uxmovement.com/forms/question-mark-vs-info-icon-when-to-use-which/)\n\n";
|
|
10
|
+
ds:conceptType ds:concepttype.How-to-guide.
|
|
@@ -3,9 +3,8 @@
|
|
|
3
3
|
@prefix dt: <https://dt.canonical.com/>.
|
|
4
4
|
|
|
5
5
|
ds:concept.How-to-differentiate-types-of-UI-blocks- a ds:Concept;
|
|
6
|
-
ds:name "How to differentiate types of UI blocks
|
|
7
|
-
ds:summary "This decision tree is helps us categorize UI blocks that share certain attributes: deciding whether we are talking about the same or separate UI blocks, if it’s a matter of inheritance, variants of the same UI block, or simply properties of a block.
|
|
6
|
+
ds:name "How to differentiate types of UI blocks";
|
|
7
|
+
ds:summary "This decision tree is helps us categorize UI blocks that share certain attributes: deciding whether we are talking about the same or separate UI blocks, if it’s a matter of inheritance, variants of the same UI block, or simply properties of a block.";
|
|
8
8
|
ds:tier ds:global;
|
|
9
|
-
ds:content "Given two things (X, Y) that share visual kinship: \n\nTEST 1 — AFFORDANCE
|
|
10
|
-
ds:knownEdgeCases "";
|
|
9
|
+
ds:content "Given two things (X, Y) that share visual kinship: \n\n```\nTEST 1 — AFFORDANCE\n│ Does X enable a fundamentally different user action than Y?\n│ (Different primary affordance: navigate vs act, input vs display,\n│ dismiss vs inform, filter vs label)\n│\n│ Diagnostic signals:\n│ • Would X and Y require different HTML elements for semantic correctness?\n│ • Does one respond to user interaction where the other does not?\n│ • Would a screen reader announce them with different roles?\n│ • Could you describe X's purpose with a verb and Y's with a different verb?\n│\n├─ YES → SPLIT into separate components\n│ (Chip / Label, Button / Link, Checkboxes / Radios*)\n│\n│ *Note: Radios/Checkboxes remain an open discussion.\n│ The group has explored whether \"Choices\" as a unified\n│ component better captures semantic function.\n│\n└─ NO → continue to Test 2\n```\n\n```\nTEST 2 — INHERITANCE\n│ Does Y specialise X by narrowing its possibility space and increasing its specificity while\n│ preserving X's affordance and anatomy?\n│\n│ Diagnostic signals:\n│ • Y preconfigures properties that X leaves open\n│ • Y restricts the API surface (fewer valid inputs)\n│ • Y carries domain-specific opinions (branding, context)\n│ • Y would NOT alter structural properties (spacing, layout) [BrandedLabel an edge case bc of historical reasons]\n│ • Y's name naturally takes the form [Qualifier][Parent]\n│ (BrandedLabel > Label, GithubHero > Hero, NumericalBadge > Badge)\n│\n├─ YES → Model as INHERITANCE (Y inherits from X)\n│ Y receives all of X's characteristics.\n│ Y is named with parent as suffix.\n│ Y's documentation is separate and references parent's core docs.\n│\n│ Ontological note: This is a conceptual relationship.\n│ Implementation uses composition (hooks, render composition),\n│ not class inheritance.\n│\n└─ NO → continue to Test 3\n```\n\n```\nTEST 3 — VARIANT\n│ Does the difference represent a design-time choice between\n│ information delivery strategies under the same affordance?\n│\n│ Diagnostic signals:\n│ • The choice is made AFTER the component/pattern has been selected\n│ • The choice optimises information flow under constraints (not taste)\n│ • The difference can be articulated as \"when you are in X situation,\n│ use this form\" — i.e., the guidance is constraint-driven\n│ • The semantic meaning and primary affordance are unchanged\n│\n│ Variant subcategories (provisional, not fully resolved):\n│\n│ a) COMPLEXITY VARIANT — Same affordance, different information density\n│ (ProfileTag: short / medium / long)\n│ (Timeline: simple / detailed)\n│ (Pagination: basic / complex)\n│ (Tooltip: dense / actions / data visualisation)\n│\n│ b) PLACEMENT VARIANT — Same affordance, different spatial arrangement\n│ (Hero: image left / image right)\n│\n├─ YES → Model as VARIANT\n│ Single component page with variant-specific guidance.\n│ Guidance documents the constraints informing recommended choice.\n│ Variants do not exist for aesthetic preference alone.\n│\n└─ NO → It's a property\n```\n\n```\nTEST 4 — MODIFIER FAMILY\n│ Does the difference represent a cross-cutting communicative axis\n│ that multiple components share?\n│\n│ Diagnostic signals:\n│ • The variation is about status, emphasis, or hierarchy — not structure\n│ • Other components in the system exhibit the same axis of variation\n│ • Members of the family are mutually exclusive within one instance\n│ • A component consuming the family must support ALL its members\n│ • The variation is expressed through visual tokens (colour, weight),\n│ not structural changes\n│\n│ Existing families: severity, emphasis, importance, criticality,\n│ density, anticipation, lifecycle\n│\n├─ YES → Model as MODIFIER FAMILY membership\n│ Component opts into existing family.\n│ Modifier docs live at global level; component references them.\n│\n└─ NO → Variant\n```\n\n\n\n### Further references \n\n- Internal Canonical ontology [meeting notes](https://docs.google.com/document/d/1HHhTD80-nya5CkrWOzWitDsehDdILz0mkPPHzIySahs/edit?usp=sharing)";
|
|
11
10
|
ds:conceptType ds:concepttype.How-to-guide.
|
|
@@ -4,8 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
ds:concept.How-to-indicate-required-fields-in-forms a ds:Concept;
|
|
6
6
|
ds:name "How to indicate required fields in forms";
|
|
7
|
-
ds:summary "This guideline documents and explains the decision for marking required fields in forms, while taking into account WCAG accessibility requirements and examining various methods for indicating required fields in forms.
|
|
7
|
+
ds:summary "This guideline documents and explains the decision for marking required fields in forms, while taking into account WCAG accessibility requirements and examining various methods for indicating required fields in forms.";
|
|
8
8
|
ds:tier ds:global;
|
|
9
9
|
ds:content "# **Rationale**\n\nThere are various different methods to indicate required fields within forms. Some products denote the required fields with a “*”, some do it with text in the label, some denote the optional ones with text in the label, while others denote both. This creates inconsistency between products and even within the same product sometimes. Follwing this guide on when to use what method will provide a more consistent and predictable product experience for users.\n\n# Considerations\n\n## **Accessibility**\n\nAccording to WCAG 2.2 [Success Criterion 3.3.2](https://www.w3.org/TR/WCAG22/#labels-or-instructions) and [Technique H90](https://www.w3.org/WAI/WCAG22/Techniques/html/H90):\n\n1. *For each required form control, check that the required status is indicated in the form control's label or legend.*\n2. *For each indicator of required status that is not provided in text, check that the meaning of the indicator is explained before the form control that uses it.*\n\n\n\nIt can easily be interpreted as “marking all required fields” is necessary. However, many people requested clarification on the Success Criterion (SC), and an [official w3c Working Group response](https://github.com/w3c/wcag/issues/3553#issuecomment-2022967832:~:text=which%20are%20optional).-,If%20some%20or%20all%20fields%20are%20required%20for%20submission%2C%20there%20can,above)%20are%20feasible%20and%20not%20ruled%20out%20by%20this%20success%20criterion.,-Other%20criteria%2C%20such) was provided. It is clear that distinguishing the required and the optional fields is necessary. However, some nuances are heavily debated.\n\n- Is it a failure of the SC to indicate required fields with an asterisk (*) *without* a legend to explain the meaning?\n\nSome Working Group (WG) members believe the answer is *no*, with supporting arguments like [this](https://github.com/w3c/wcag/issues/4791#:~:text=But%20I%20would%20be%20concerned%20with%20creating%20a%20failure%20technique%20stating%20unconditionally%20that%20use%20of%20an%20asterisk%20without%20some%20kind%20of%20legend%20is%20a%20failure.).\n\n- Is it necessary to indicate required fields on *well-understood small forms where all fields are required* like a two-field login form and one-field newsletter subscription form?\n\nMost WG members believe the answer is *no*, with supporting arguments like [this](https://github.com/w3c/wcag/issues/4791#issuecomment-3664703933).\n\n\n\nTo summarize, here are the safe methods that should pass SC 3.3.2.\n\n- Indicating optional fields with “optional” in the label (by implication the other fields would be required).\n- Indicating required fields explicitly by adding “(required)” after the label.\n- Use a convention like the asterisk and legend to indicate required fields.\n- State “all fields are required” at the beginning of the form (if they are).\n- Do not indicate required fields on small, well-understood forms where all fields are required.\n\n## **Common form scenarios**\n\nThe word “scenario”, instead of “type” or “category” is used here because these are not mutually exclusive classifications. They are characterized mostly by intent or context of the form.\n\n### **Conventional small forms**\n\nThese are forms with very few fields (1-3), where all fields are typically required and the purpose is *immediately* clear. Examples: Login, Sign-up, Newsletter Subscription, Search.\n\nMarking required fields in these forms adds more cognitive load than value.\n\n### **Low-motivation forms**\n\nFor these forms, the user's motivation to complete the submission is often low. We are asking for more information than the user originally intended to provide, and because form submission is usually non-essential to their immediate needs, they are likely to abandon the process. This is common for things like customer survey forms and the majority of sites forms.\n\n\n\nMarking optional fields may result in most fields being marked in some forms, making them more wordy than it should be. On the other hand, marking the required fields makes it clear the minimum information needed to proceed, which can arguably improve conversion rate.\n\n### **High-motivation forms**\n\nFor these forms, the user's motivation to complete the submission is often high. We are asking for essential information that directly facilitates the user's immediate needs, and because form submission is crucial to their goal, they are highly likely to complete the process. This is common for things like forms to complete a task or operation in apps.\n\n\n\nUsers are eager to complete the form, so clearly indicating the required fields meets their expectation, gives them more confidence and promotes a smoother flow.\n\n### **Fully required forms**\n\nForms where every single field must be completed to proceed.\n\nMarking every required field may feel a little redundant, especially when the form is long.\n\n## **Consistency**\n\nUsing one method for all forms is dogmatic and unnecessary. Picking a method for each usage scenario seems to be more reasonable. We should also leave room for unknown exceptions as well.\n\n## **Position of the asterisk**\n\nWhen used to mark the required fields, the asterisk can be placed at the start of the label or at the end. \n\nThe industry convention is to place it at the end. Most users should be familiar with this position. On the other hand, placing it at the start makes it a lot easier to scan and find required fields without having to read the labels. It can be very helpful for users who value efficiency and transparency, which is true for most Canonical personas.\n\n\n\nTable 10\n\n\n\nOne thing to note is that wherever it is placed, the asterisk needs to be hidden with aria-hidden=\"true\" so that it is not announced by screen readers.\n\n## How to\n\nTable 11\n\n\n\n# **Further information**\n\n[WCAG 2.2 SC 3.3.2 Labels and instructions](https://www.w3.org/TR/WCAG22/#labels-or-instructions)\n\n[WCAG 2.2 Technique H90: Indicating required form controls using label or legend](https://www.w3.org/WAI/WCAG22/Techniques/html/H90)\n\n\n\nWG discussions:\n\n[https://github.com/w3c/wcag/issues/1698](https://github.com/w3c/wcag/issues/1698)\n\n[https://github.com/w3c/wcag/issues/2357](https://github.com/w3c/wcag/issues/2357)\n\n[https://github.com/w3c/wcag/issues/3553](https://github.com/w3c/wcag/issues/3553)\n\n[https://github.com/w3c/wcag/issues/4791](https://github.com/w3c/wcag/issues/4791)\n\n \nReference: [Spec DE077](https://docs.google.com/document/d/1FGtZ1ZOQ3QcYQ4-3nCh4jnycw7aeEN2l_XgmpFlFHq0/edit?tab=t.0)";
|
|
10
|
-
ds:knownEdgeCases "";
|
|
11
10
|
ds:conceptType ds:concepttype.How-to-guide.
|
|
@@ -7,5 +7,4 @@ ds:concept.How-to-support-modifiers-in-a-component a ds:Concept;
|
|
|
7
7
|
ds:summary "This guide covers the steps to make a component follow modifiers: identifying its colour properties, adding the modifier channel and surface fallbacks, adding interaction state tokens, and testing across modifier classes and themes.";
|
|
8
8
|
ds:tier ds:global;
|
|
9
9
|
ds:content "**Status:** Final \n**Version:** 1.0 \n**Last updated:** 2026-09-11 \n**Source:** `@canonical/react-tokens` Storybook guide — _How to support modifiers in a component_\n\n\nThis guide shows you how to make a component respond to modifier classes (`.error`, `.success`, `.warning`, etc.) through the token channel variable system. No JavaScript is involved.\n\n## Prerequisites\n\n- A working React component with CSS\n- `@canonical/styles` imported in your project\n- Familiarity with CSS custom properties\n\n## Steps\n\n### 1. Identify the color properties in your component\n\nList every CSS property that sets a color. These are the properties that need modifier support:\n\n\\`\\`\\`css\n/* Before: direct semantic references */\n.ds.my-component {\n color: var(--color-text);\n border-color: var(--color-border);\n background: var(--color-foreground-ghost);\n}\n\\`\\`\\`\n\n### 2. Add the modifier channel fallback\n\nFor each color property, prepend the matching `--modifier-*` channel variable:\n\n\\`\\`\\`css\n/* After: modifier-aware */\n.ds.my-component {\n color: var(--modifier-color-text, var(--color-text));\n border-color: var(--modifier-color-border, var(--color-border));\n background: var(--modifier-color-foreground-ghost, var(--color-foreground-ghost));\n}\n\\`\\`\\`\n\nThe channel variable names follow a consistent pattern: `--modifier-color-{rest}` where `{rest}` matches the base semantic token name after `--color-`.\n\n| Base semantic token | Modifier channel |\n|--------------------|-----------------|\n| `--color-text` | `--modifier-color-text` |\n| `--color-border` | `--modifier-color-border` |\n| `--color-icon-default` | `--modifier-color-icon` |\n| `--color-foreground-primary` | `--modifier-color-foreground-primary` |\n| `--color-foreground-ghost` | `--modifier-color-foreground-ghost` |\n| `--color-foreground-input` | `--modifier-color-foreground-input` |\n| `--color-focus-ring` | `--modifier-color-focus-ring` |\n\n### 3. Add surface fallbacks (if applicable)\n\nIf the component renders a background or sits inside layered containers, add the surface channel between modifier and base:\n\n\\`\\`\\`css\n.ds.my-component {\n background: var(\n --modifier-color-foreground-ghost,\n var(--surface-color-foreground-ghost,\n var(--color-foreground-ghost))\n );\n}\n\\`\\`\\`\n\nFor the component's own background when it acts as a surface:\n\n\\`\\`\\`css\n.ds.my-component {\n background: var(--surface-color-background, var(--color-background));\n}\n\\`\\`\\`\n\n### 4. Add interaction state tokens (if interactive)\n\nFor hover, active, and disabled states on interactive elements:\n\n\\`\\`\\`css\n.ds.my-component:hover {\n background: var(\n --hover--color-foreground-primary,\n var(--modifier-color-foreground-primary,\n var(--color-foreground-primary))\n );\n}\n\n.ds.my-component:active {\n background: var(\n --active--color-foreground-primary,\n var(--modifier-color-foreground-primary,\n var(--color-foreground-primary))\n );\n}\n\n.ds.my-component:disabled {\n background: var(\n --disabled--color-foreground-primary,\n var(--modifier-color-foreground-primary,\n var(--color-foreground-primary))\n );\n}\n\\`\\`\\`\n\n### 5. Test with modifier classes\n\nWrap your component in modifier containers to verify:\n\n\\`\\`\\`html\n<!-- Default (no modifier) -->\n<MyComponent />\n\n<!-- Error context -->\n<div class=\"error\">\n <MyComponent />\n</div>\n\n<!-- Success context -->\n<div class=\"success\">\n <MyComponent />\n</div>\n\n<!-- Warning context -->\n<div class=\"warning\">\n <MyComponent />\n</div>\n\\`\\`\\`\n\nIn Storybook, the **Modifiers story** demonstrates this pattern with live token tables.\n\n### 6. Test across themes\n\nSwitch the Storybook theme between light and dark. All modifier colors should remain legible because the modifier-specific semantic tokens (like `--color-text-error`) carry paired light/dark values.\n\n## Variations\n\n### Components that only need text/icon color\n\nSimple components like labels or badges may only need the text channel:\n\n\\`\\`\\`css\n.ds.label {\n color: var(--modifier-color-text, var(--color-text));\n}\n\\`\\`\\`\n\n### Components with multiple color zones\n\nComplex components like cards may have a header with a background and a body with text. Apply the appropriate channel to each zone:\n\n\\`\\`\\`css\n.ds.card {\n & > .header {\n background: var(--modifier-color-foreground-primary, var(--color-foreground-primary));\n color: var(--color-text-on-foreground);\n }\n\n & > .body {\n color: var(--modifier-color-text, var(--color-text));\n border-top-color: var(--modifier-color-border, var(--color-border-subtle));\n }\n}\n\\`\\`\\`\n\n> **Note**: `--color-text-on-foreground` does not have a modifier channel because it is always read on top of a foreground surface. Its value adapts via theme pairing, not modifier rebinding.\n\n## Troubleshooting\n\n### Colors don't change inside `.error`\n\nVerify you are using the modifier channel `var(--modifier-color-text, ...)` and not a direct `var(--color-text)` reference. The modifier class only sets `--modifier-*` variables — it cannot intercept a direct semantic reference.\n\n### Colors look wrong in nested modifiers\n\nIf a component is inside both `.error` and an inner `.success`, the inner modifier wins because CSS custom properties inherit to the closest ancestor. This is expected behavior. If you need to prevent nesting, that is a layout concern, not a token concern.\n\n### Focus ring doesn't change\n\nUse `--modifier-color-focus-ring` for the focus ring color:\n\n\\`\\`\\`css\n.ds.input:focus-visible {\n outline-color: var(--modifier-color-focus-ring, var(--color-focus-ring));\n}\n\\`\\`\\`\n\n## Related\n\n- **How to find the right token** — token selection guide\n- **The Modifier Contract** — understanding why channels exist\n- **How to handle token changes** — managing pre-1.0 token changes";
|
|
10
|
-
ds:knownEdgeCases "";
|
|
11
10
|
ds:conceptType ds:concepttype.How-to-guide.
|
|
@@ -7,5 +7,4 @@ ds:concept.Intentional-friction a ds:Concept;
|
|
|
7
7
|
ds:summary "Design friction is the intentional use of obstacles in a user interface to prevent accidental or destructive mistakes. It should be used when a user is about to perform an action that is irreversible, such as deleting data or changing permanent system settings.\n\nFor high-risk tasks, use blocking friction like requiring the user to type a confirmation word or check a box acknowledging specific risks. For medium-risk or advanced settings, use non-blocking friction like warning dialogs or technical language to ensure the user is acting deliberately rather than clicking through mindlessly.";
|
|
8
8
|
ds:tier ds:global;
|
|
9
9
|
ds:content "It is sometimes desirable to introduce some friction in flows so users are fully aware of risks and take any irreversible or destructive actions knowingly. This friction is not supposed to be a substantial nuisance that keeps the user from acting deliberately, but instead a guardrail to prevent accidental interactions.\n\nFor instance, a user using a wizard may be tempted to click repeatedly on the “Next” button. This may be OK in many cases. For instance, the defaults for the Ubuntu installer may work well enough when setting up a virtual machine. However, you may decide to disable that “Next” button in critical steps to prevent the user from taking destructive actions (like wiping a drive or not saving their recovery key) without explicitly acknowledging the risks (losing their data).\n\n### Blocking friction\n\nAdding friction that blocks the user from continuing the flow unless taking a very deliberate action is ideal for **destructive** actions.\n\nFor destructive actions, you may:\n\n- **Ask the user to type a word:** you may ask the user to type either the name of the action (e.g. “delete”) or the name of the object that will be destroyed (e.g. a VM or repository name).\n\n \n\n\n\n\n\n\nFor *potentially* destructive actions, you may:\n\n- **Ask the user to acknowledge risk**: similar to the way we collect legal consent, it should be voiced in first tense, e.g. “I understand the risk”, ideally explaining the risk (e.g. “I understand all my data may get lost”. This is a well established pattern in registration forms, so we can expect users to understand what it conveys.\n- **Ask the user to confirm they have taken precautions**: if there is any action that the user can take to avoid the actions becoming destructive (e.g. “I have recovery keys for all my encrypted disks”)\n\n \n\n\n\n\n### Non-blocking friction\n\nNon-blocking callouts are ideal for **mildly problematic or irreversible, non-destructive** actions. Example: FIPS is an advanced option in Ubuntu Pro that facilitates compliance with government standards, so it’s only useful for a minority of users. Once enabled, it cannot be disabled and Livepatch is permanently disabled.\n\n\n\nIn these cases, you may:\n\n- **Add a dialog to confirm the action**: It will add one extra step to the process, and the distinctive design will help grab the user's attention, but it will only add one extra click.\n\n \n\n\n\n\n\n\n- **Show a warning message**: May be good enough for irreversible, non-destructive actions\n - Use in Vanilla or warning info panel in Yaru.\n\n \n\n\n\n\nYou may also rely on **obscurity**. If an action is only supposed to be used by advanced users that know what they are doing, or in very specific circumstances, you may choose to make the option less visible, or to use technical language that will discourage users from playing with it. This will force users to be more deliberate, perhaps by relying on fully-fledged documentation that can provide full context.";
|
|
10
|
-
ds:knownEdgeCases "";
|
|
11
10
|
ds:conceptType ds:concepttype.How-to-guide.
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
@prefix ds: <https://ds.canonical.com/>.
|
|
2
|
+
@prefix anatomy: <https://anatomy.canonical.com/>.
|
|
3
|
+
@prefix dt: <https://dt.canonical.com/>.
|
|
4
|
+
|
|
5
|
+
ds:concept.Overflow a ds:Concept;
|
|
6
|
+
ds:name "Overflow";
|
|
7
|
+
ds:summary "";
|
|
8
|
+
ds:tier ds:global;
|
|
9
|
+
ds:content "Example of overflow (from stores) in table to be considered - button probably needs to be left aligned \n\n\n";
|
|
10
|
+
ds:conceptType ds:concepttype.How-to-guide.
|
|
@@ -7,5 +7,4 @@ ds:concept.Understanding-the-modifier-contract a ds:Concept;
|
|
|
7
7
|
ds:summary "This document covers what modifiers are and the contract between the modifier side and the component side: the problem modifiers solve, the modifier families, how nesting and overrides behave, where modifiers sit in the cascade, and what modifiers deliberately do not do.";
|
|
8
8
|
ds:tier ds:global;
|
|
9
9
|
ds:content "**Status:** Final \n**Version:** 1.0 \n**Last updated:** 2026-09-11 \n**Source:** `@canonical/react-tokens` Storybook guide — _Understanding the Modifier Contract_\n\n\nModifiers are the mechanism through which a parent container changes the visual output of every descendant component — without those components knowing about the modifier, and without any prop drilling or runtime logic.\n\nThis page explains the contract between modifier classes and component styles.\n\n## The problem modifiers solve\n\nA form has an error. The form's border should turn red, but so should the label text, the input border, the icon color, and the helper text — every piece of the form's visual output should shift to communicate the error state.\n\nWithout modifiers, you would need to thread an `intent=\"error\"` prop into every child component. This couples components to specific contexts, requires runtime coordination, and makes composition fragile. If you add a new child to the form, you must remember to pass the prop.\n\nModifiers solve this by letting a single ancestor class change every descendant's output simultaneously through the CSS cascade. No prop drilling, no React context, no JavaScript at all.\n\n## How the contract works\n\nThe modifier contract has two sides: the **modifier class** sets channel variables, and **component styles** read them through fallback chains.\n\n### The modifier side\n\nWhen an ancestor element applies a modifier class like `.error`, it sets a group of **channel variables**:\n\n\\`\\`\\`css\n.error {\n --modifier-color-text: var(--color-text-error);\n --modifier-color-border: var(--color-border-error);\n --modifier-color-icon: var(--color-icon-error);\n --modifier-color-foreground-input: var(--color-foreground-input-error);\n --modifier-color-focus-ring: var(--color-focus-ring-error);\n}\n\\`\\`\\`\n\nThese channel variables are prefixed with `--modifier-` to make their role explicit. They are intermediate — set by modifiers, read by components — and they point to intent-specific semantic tokens (`--color-text-error`, `--color-border-error`).\n\n### The component side\n\nComponents read the channel variable first, with a fallback to the base semantic token:\n\n\\`\\`\\`css\n.button {\n color: var(--modifier-color-text, var(--color-text));\n border-color: var(--modifier-color-border, var(--color-border));\n}\n\\`\\`\\`\n\nOutside any modifier context, `--modifier-color-text` is unset, and the component falls through to `--color-text`. Inside `.error`, the channel variable resolves to the error text color. Inside `.success`, it resolves to the success text color. The component code is identical in every case.\n\n## Modifier families\n\nThe system defines several modifier families, each setting the same channel variables to different intent-specific values:\n\n| Family | Classes | Purpose |\n|--------|---------|---------|\n| **Criticality** | `.error`, `.warning`, `.success`, `.information` | Feedback states for forms and alerts |\n| **Emphasis** | `.muted`, `.branded` | Visual prominence adjustment |\n| **Anticipation** | `.constructive`, `.destructive`, `.caution` | Expected outcome of an action |\n\nAll families set the same channel variables. This uniformity means a component that supports `.error` automatically supports `.constructive`, `.branded`, and every other modifier — the component does not distinguish between them.\n\n## Why this matters for composition\n\nThe channel variable indirection is what makes modifiers compositional. Consider a form:\n\n\\`\\`\\`html\n<form class=\"error\">\n <label>Email</label>\n <input type=\"email\" />\n <span class=\"helper-text\">Please enter a valid email</span>\n</form>\n\\`\\`\\`\n\nThe label, input, and helper text all read `--modifier-color-text`. None of them know about `.error`. If you replace `.error` with `.warning`, every descendant's color shifts. If you add a new component inside the form, it automatically participates in the modifier context as long as it reads the channel variable.\n\nThis compositionality breaks if a component references `--color-text-error` directly. That hard-codes the intent and prevents the component from working inside `.warning` or `.success` contexts. The contract is: **components reference channels, not intents**.\n\n## Nesting and override behavior\n\nModifiers can nest. An `.error` form might contain a `.success` badge:\n\n\\`\\`\\`html\n<form class=\"error\">\n <div class=\"success\">\n <span>Verified</span>\n </div>\n</form>\n\\`\\`\\`\n\nThe inner `.success` sets `--modifier-color-text` to the success text color, overriding the `.error` value for its descendants. CSS custom property inheritance handles this automatically — the closest ancestor setting a channel variable wins.\n\nThis means modifiers compose without special logic: the last modifier in the DOM tree determines the visual output.\n\n## What modifiers do not do\n\nModifiers **do not** change layout, spacing, or typography. They only affect color-related channel variables. This is a deliberate constraint — color is the visual property most affected by context (error, success, brand emphasis), while layout is determined by the component's own specifications.\n\nModifiers also do not affect primitive tokens. A palette color like `--color-palette-red-600` is the same everywhere. Only semantic tokens participate in the modifier system, because only semantic tokens carry intent.\n\n## The cascade position\n\nModifier channel variables live in `@layer ds.modifiers`, which overrides `@layer ds.tokens` (base semantic values). This means a modifier can override a semantic token's value regardless of selector specificity, and a surface channel (in `@layer ds.surfaces`) can in turn override a modifier channel when appropriate.\n\nThe layered cascade ensures a predictable resolution order: tokens → modifiers → surfaces → states.\n\n## Common misconceptions\n\n### \"Modifiers change the theme\"\n\nModifiers do not change the theme. Theme switching (light/dark) changes _which values_ semantic tokens resolve to. Modifiers change _which semantic tokens_ a component reads. An `.error` modifier works identically in light mode and dark mode — the error text color is defined for both themes in the semantic token layer.\n\n### \"Components should detect the modifier\"\n\nComponents should not detect or respond to modifiers through JavaScript. The entire mechanism is CSS-only. A component that checks `classList.contains('error')` has broken the contract — it now depends on a specific modifier instead of reading the channel.\n\n### \"I need a new modifier for my use case\"\n\nNew modifiers are rarely needed. The existing families cover the standard intent space. If you need a novel color context, first check whether a combination of existing modifiers and surfaces achieves the result. If a new modifier family is genuinely needed, it should be added to `@canonical/styles` so that all components benefit from it.\n\n## Further reading\n\n- **Token Architecture**: why the system has three tiers\n- **Surface Depth Model**: how surfaces interact with modifiers\n- **How to support modifiers in a component**: practical steps for modifier integration\n- **Modifiers story**: live demonstration of modifier rebinding";
|
|
10
|
-
ds:knownEdgeCases "";
|
|
11
10
|
ds:conceptType ds:concepttype.Explanation.
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
@prefix ds: <https://ds.canonical.com/>.
|
|
2
|
+
@prefix anatomy: <https://anatomy.canonical.com/>.
|
|
3
|
+
@prefix dt: <https://dt.canonical.com/>.
|
|
4
|
+
|
|
5
|
+
ds:documentation.layout.content_page_layout a ds:Layout;
|
|
6
|
+
ds:name "ContentPageLayout";
|
|
7
|
+
ds:summary "";
|
|
8
|
+
ds:anatomyDsl "";
|
|
9
|
+
ds:anatomyClassic "";
|
|
10
|
+
ds:usage "";
|
|
11
|
+
ds:guidelines "";
|
|
12
|
+
ds:tier ds:documentation;
|
|
13
|
+
ds:parentComponent ds:documentation.layout.library_layout, ds:documentation.layout.documentation_layout.
|
|
@@ -10,4 +10,5 @@ ds:documentation.layout.documentation_layout a ds:Layout;
|
|
|
10
10
|
ds:usage "";
|
|
11
11
|
ds:guidelines "";
|
|
12
12
|
ds:tier ds:documentation;
|
|
13
|
-
ds:documentationStage ds:tag.needstriage
|
|
13
|
+
ds:documentationStage ds:tag.needstriage;
|
|
14
|
+
ds:hasSubcomponent ds:documentation.layout.search_page_layout, ds:documentation.layout.content_page_layout.
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
@prefix ds: <https://ds.canonical.com/>.
|
|
2
|
+
@prefix anatomy: <https://anatomy.canonical.com/>.
|
|
3
|
+
@prefix dt: <https://dt.canonical.com/>.
|
|
4
|
+
|
|
5
|
+
ds:documentation.layout.library_layout a ds:Layout;
|
|
6
|
+
ds:name "LibraryLayout";
|
|
7
|
+
ds:summary "";
|
|
8
|
+
ds:anatomyDsl "";
|
|
9
|
+
ds:anatomyClassic "";
|
|
10
|
+
ds:usage "";
|
|
11
|
+
ds:guidelines "";
|
|
12
|
+
ds:tier ds:documentation;
|
|
13
|
+
ds:hasSubcomponent ds:documentation.layout.search_page_layout, ds:documentation.layout.content_page_layout.
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
@prefix ds: <https://ds.canonical.com/>.
|
|
2
|
+
@prefix anatomy: <https://anatomy.canonical.com/>.
|
|
3
|
+
@prefix dt: <https://dt.canonical.com/>.
|
|
4
|
+
|
|
5
|
+
ds:documentation.layout.search_page_layout a ds:Layout;
|
|
6
|
+
ds:name "SearchPageLayout";
|
|
7
|
+
ds:summary "";
|
|
8
|
+
ds:anatomyDsl "";
|
|
9
|
+
ds:anatomyClassic "";
|
|
10
|
+
ds:usage "";
|
|
11
|
+
ds:guidelines "";
|
|
12
|
+
ds:tier ds:documentation;
|
|
13
|
+
ds:parentComponent ds:documentation.layout.library_layout, ds:documentation.layout.documentation_layout.
|