@canonical/design-system 0.46.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.
Files changed (122) hide show
  1. package/data/apps/pattern/data_views.ttl +85 -0
  2. package/data/apps/pattern/datatable.ttl +3 -73
  3. package/data/apps/pattern/page_header.ttl +50 -5
  4. package/data/apps/subcomponent/data_table-action_bar.ttl +2 -2
  5. package/data/apps/subcomponent/data_table-pagination_bar.ttl +2 -2
  6. package/data/apps/subcomponent/data_table-persistent_selection.ttl +1 -1
  7. package/data/apps/subcomponent/data_views-filters.ttl +13 -0
  8. package/data/apps/subcomponent/data_views-saved_views.ttl +13 -0
  9. package/data/apps/subcomponent/data_views-sort_panel.ttl +13 -0
  10. package/data/apps/subcomponent/side_panel-footer.ttl +1 -1
  11. package/data/apps_launchpad/component/modal.ttl +2 -2
  12. package/data/{apps_workplaceengineering → apps_workplace}/component/complex_multi_select.ttl +3 -3
  13. package/data/{apps_workplaceengineering → apps_workplace}/component/label-highlight.ttl +4 -4
  14. package/data/{apps_workplaceengineering → apps_workplace}/component/org_chart.ttl +2 -2
  15. package/data/{apps_workplaceengineering → apps_workplace}/component/rule.ttl +2 -2
  16. package/data/{apps_workplaceengineering → apps_workplace}/component/skip_link.ttl +2 -2
  17. package/data/{apps_workplaceengineering → apps_workplace}/component/theme_switcher.ttl +2 -2
  18. package/data/{apps_workplaceengineering → apps_workplace}/pattern/callout_numbers_card.ttl +2 -2
  19. package/data/{apps_workplaceengineering → apps_workplace}/pattern/confirmation_modal.ttl +2 -2
  20. package/data/{apps_workplaceengineering → apps_workplace}/pattern/org_event_card.ttl +2 -2
  21. package/data/{apps_workplaceengineering → apps_workplace}/subcomponent/multi_select_input.ttl +2 -2
  22. package/data/{apps_workplaceengineering.ttl → apps_workplace.ttl} +2 -2
  23. package/data/concept/Accessibility.ttl +9 -0
  24. package/data/concept/Breakpoints.ttl +9 -0
  25. package/data/concept/Design-tokens-Overview.ttl +10 -0
  26. package/data/concept/Filtering-patterns.ttl +0 -1
  27. package/data/concept/Foundations-Baseline.ttl +0 -1
  28. package/data/concept/Foundations-Color.ttl +10 -0
  29. package/data/concept/Foundations-Density--the-form-channel.ttl +0 -1
  30. package/data/concept/Foundations-Grid--Layout.ttl +1 -2
  31. package/data/concept/Foundations-Spacing/-Element-vs-container-owned.ttl +0 -1
  32. package/data/concept/Foundations-Spacing.ttl +0 -1
  33. package/data/concept/Foundations-Surfaces.ttl +0 -1
  34. package/data/concept/Foundations-Typography.ttl +1 -2
  35. package/data/concept/How-to-choose-between-question-mark-and-information-icon.ttl +10 -0
  36. package/data/concept/How-to-differentiate-types-of-UI-blocks-.ttl +0 -1
  37. package/data/concept/How-to-indicate-required-fields-in-forms.ttl +0 -1
  38. package/data/concept/How-to-support-modifiers-in-a-component.ttl +0 -1
  39. package/data/concept/Intentional-friction.ttl +0 -1
  40. package/data/concept/Overflow.ttl +0 -1
  41. package/data/concept/Understanding-the-modifier-contract.ttl +0 -1
  42. package/data/documentation/pattern/library_side_navigation.ttl +2 -2
  43. package/data/global/component/accordion.ttl +2 -2
  44. package/data/global/component/announcement.ttl +2 -1
  45. package/data/global/component/avatar.ttl +1 -1
  46. package/data/global/component/badge.ttl +2 -2
  47. package/data/global/component/breadcrumbs.ttl +3 -3
  48. package/data/global/component/button.ttl +3 -3
  49. package/data/global/component/button_link.ttl +1 -1
  50. package/data/global/component/card.ttl +3 -7
  51. package/data/global/component/chip.ttl +1 -0
  52. package/data/global/component/code_snippet.ttl +1 -1
  53. package/data/global/component/drag_and_drop_list.ttl +1 -1
  54. package/data/global/component/dropdown_button.ttl +2 -2
  55. package/data/global/component/file_upload_field.ttl +509 -60
  56. package/data/global/component/icon.ttl +1 -1
  57. package/data/global/component/icon_button.ttl +26 -4
  58. package/data/{apps → global}/component/key_value_pair.ttl +2 -2
  59. package/data/global/{subcomponent/markdown_input.ttl → component/markdown_editor_field.ttl} +3 -3
  60. package/data/global/component/mode_switcher.ttl +1 -1
  61. package/data/global/component/number_field.ttl +1 -1
  62. package/data/global/component/range_field.ttl +0 -80
  63. package/data/global/component/table.ttl +2 -2
  64. package/data/global/component/tile.ttl +1 -1
  65. package/data/global/component/tooltip.ttl +51 -91
  66. package/data/global/component/{data_tooltip.ttl → tooltip_data.ttl} +31 -23
  67. package/data/global/component/tooltip_wrapper.ttl +70 -14
  68. package/data/global/group/cards.ttl +1 -1
  69. package/data/{apps → global}/group/key_value_pairs.ttl +2 -2
  70. package/data/global/modifier/constructive.ttl +1 -1
  71. package/data/global/modifier/elevated.ttl +1 -1
  72. package/data/global/modifier_family/_emphasis.ttl +1 -2
  73. package/data/global/modifier_family/_other.ttl +1 -2
  74. package/data/global/modifier_family/surface.ttl +1 -1
  75. package/data/global/pattern/description_list.ttl +1 -1
  76. package/data/global/pattern/modal.ttl +1 -1
  77. package/data/global/pattern/timeline.ttl +1 -1
  78. package/data/global/pattern/{navigation.ttl → top_navigation.ttl} +2 -2
  79. package/data/global/subcomponent/chart_legend.ttl +1 -1
  80. package/data/global/subcomponent/chart_legend_item.ttl +1 -1
  81. package/data/global/subcomponent/file_upload_input.ttl +503 -50
  82. package/data/global/subcomponent/markdown_editor_input.ttl +13 -0
  83. package/data/global/subcomponent/modal-footer.ttl +1 -1
  84. package/data/global/subcomponent/number_input.ttl +1 -1
  85. package/data/global/subcomponent/range_input.ttl +3 -84
  86. package/data/global/{component/markdown_field.ttl → subcomponent/text_editor_input.ttl} +3 -3
  87. package/data/global/variant/tooltip_dense.ttl +86 -5
  88. package/data/global_dataviews/component/filter_button.ttl +487 -0
  89. package/data/global_dataviews/component/query_bar.ttl +1639 -0
  90. package/data/global_dataviews/component/query_chip.ttl +605 -0
  91. package/data/global_dataviews/group/query_chips.ttl +565 -0
  92. package/data/global_dataviews/modifier/exclusion.ttl +8 -0
  93. package/data/global_dataviews/modifier/inclusion.ttl +8 -0
  94. package/data/global_dataviews/modifier/match.ttl +8 -0
  95. package/data/global_dataviews/modifier/presence.ttl +8 -0
  96. package/data/global_dataviews/modifier/range.ttl +8 -0
  97. package/data/global_dataviews/modifier_family/condition.ttl +9 -0
  98. package/data/global_dataviews/subcomponent/query_chip-entry.ttl +186 -0
  99. package/data/global_dataviews/subcomponent/query_chip-segment.ttl +241 -0
  100. package/data/global_dataviews/subcomponent/query_input.ttl +1287 -0
  101. package/data/global_dataviews.ttl +6 -0
  102. package/data/sites/component/store_card.ttl +1 -1
  103. package/data/tag/{wpeinital-implementation.ttl → workplaceinitial-implementation.ttl} +2 -2
  104. package/data/tag/{wpetriageupstream-and-deprecate.ttl → workplacetriageupstream-and-deprecate.ttl} +2 -2
  105. package/definitions/ontology.ttl +8 -2
  106. package/package.json +6 -6
  107. package/skills/adoption-a1-styles/SKILL.md +11 -0
  108. package/skills/adoption-a2-components/SKILL.md +82 -2
  109. package/skills/anatomy-author/SKILL.md +278 -95
  110. package/skills/anatomy-author/clarification-guidelines.md +150 -0
  111. package/skills/anatomy-author/completeness-checklist.md +224 -0
  112. package/skills/implement-component/SKILL.md +2 -2
  113. package/skills/map-journeys/SKILL.md +395 -0
  114. package/skills/map-journeys/journey-graph.example.html +298 -0
  115. package/skills/model-domains/SKILL.md +502 -0
  116. package/data/concept/Question-mark-vs-information-icon.ttl +0 -11
  117. package/data/global/modifier/editable.ttl +0 -8
  118. package/data/global/modifier/focused.ttl +0 -8
  119. package/data/global/modifier/highlighted.ttl +0 -8
  120. package/data/global/modifier/loading.ttl +0 -8
  121. package/data/global/modifier/muted.ttl +0 -8
  122. package/data/global/modifier/wireframe.ttl +0 -8
@@ -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.
@@ -7,5 +7,4 @@ ds:concept.How-to-differentiate-types-of-UI-blocks- a ds:Concept;
7
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
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)";
10
- ds:knownEdgeCases "";
11
10
  ds:conceptType ds:concepttype.How-to-guide.
@@ -7,5 +7,4 @@ ds:concept.How-to-indicate-required-fields-in-forms a ds:Concept;
7
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\n​For 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\n​You 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.
@@ -7,5 +7,4 @@ ds:concept.Overflow a ds:Concept;
7
7
  ds:summary "";
8
8
  ds:tier ds:global;
9
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:knownEdgeCases "";
11
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.