@filipgutica/design-system 2.2.0 → 2.3.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/language/DESIGN.md +1 -1
- package/language/components.html +53 -7
- package/language/components.md +128 -21
- package/language/decisions.md +2 -0
- package/package.json +1 -1
package/language/DESIGN.md
CHANGED
|
@@ -40,7 +40,7 @@ Center the **container**, not every sentence. Align header, content, images, and
|
|
|
40
40
|
## Files and examples
|
|
41
41
|
|
|
42
42
|
- `tokens.css`: a standalone snapshot of the values (the Graphite Indigo theme) owned by `@filipgutica/ui`. The identity inputs sit in one block at the top. Each line's `ui:` comment lists the library variables that carry that value, the line's own name first. Update it when the package values change.
|
|
43
|
-
- `components.md`: one spec for each component, with anatomy,
|
|
43
|
+
- `components.md`: one spec for each component, with anatomy, states, Do and Don't lines, keyboard and screen-reader behavior, motion, and forced colors. Read it for any component work.
|
|
44
44
|
- `components.html`: every component in each of its states, in plain HTML and CSS on `tokens.css`. Copy component markup and styles from there.
|
|
45
45
|
- `decisions.md`: the choices behind the components, and the options they replaced.
|
|
46
46
|
- `reference.html`: an application example, and a Foundations catalogue (`#foundations`) of every token: type, color with contrast, spacing, shape, borders, elevation, focus, and motion.
|
package/language/components.html
CHANGED
|
@@ -206,6 +206,11 @@
|
|
|
206
206
|
.range[data-size="sm"] { height: var(--control-sm); }
|
|
207
207
|
.range[data-size="lg"] { height: var(--control-lg); }
|
|
208
208
|
.range:disabled { opacity: 0.58; cursor: not-allowed; }
|
|
209
|
+
/* The current value follows the track, so the reader sees the number the thumb sets. */
|
|
210
|
+
.slider { display: flex; align-items: center; gap: var(--space-3); width: 220px; max-width: 100%; }
|
|
211
|
+
.slider > .range { flex: 1; width: auto; min-width: 0; }
|
|
212
|
+
.slider-value { min-width: 4ch; font-size: var(--text-sm); font-variant-numeric: tabular-nums; }
|
|
213
|
+
.range:disabled + .slider-value { opacity: 0.58; }
|
|
209
214
|
/* The ring goes on the thumb, not the full-width input. */
|
|
210
215
|
.range:is(:focus-visible, .is-focus) { outline: none; }
|
|
211
216
|
.range:is(:focus-visible, .is-focus)::-webkit-slider-thumb { outline: var(--focus-width) solid var(--color-focus); outline-offset: var(--focus-offset); }
|
|
@@ -642,6 +647,10 @@
|
|
|
642
647
|
.component > header a { font-size: var(--text-sm); }
|
|
643
648
|
/* Each component has a one-line purpose, which Find also matches, and a Copy link quiet action. */
|
|
644
649
|
.purpose { max-width: var(--measure); margin-top: calc(-1 * var(--space-2)); color: var(--color-muted); font-size: var(--text-sm); }
|
|
650
|
+
/* The spec's Do and Don't lines, as a two-column definition list under the purpose. components.md owns the text. */
|
|
651
|
+
.guidance { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: var(--space-1) var(--space-3); max-width: var(--measure); margin: 0; font-size: var(--text-sm); }
|
|
652
|
+
.guidance dt { font-weight: var(--weight-medium); }
|
|
653
|
+
.guidance dd { margin: 0; color: var(--color-muted); }
|
|
645
654
|
.copy-link { width: var(--control-sm); height: var(--control-sm); align-self: center; color: var(--color-muted); }
|
|
646
655
|
.note { max-width: var(--measure); color: var(--color-muted); font-size: var(--text-sm); }
|
|
647
656
|
.row { display: grid; grid-template-columns: 140px minmax(0, 1fr); gap: var(--space-2) var(--space-6); padding: var(--space-3) 0; border-bottom: 1px solid var(--color-border-subtle); }
|
|
@@ -871,6 +880,7 @@
|
|
|
871
880
|
<section class="component" id="button" data-layer="Core" data-states="hover pressed focus disabled busy" aria-labelledby="button-title">
|
|
872
881
|
<header><h3 id="button-title">Button</h3><span class="badge">Core</span><a href="components.md#button">Spec</a><button class="quiet-action copy-link" type="button" data-copy-link="button" aria-label="Copy link to Button" title="Copy link"><svg class="icon" aria-hidden="true"><use href="#i-link"/></svg></button></header>
|
|
873
882
|
<p class="purpose">The main action control: primary, secondary, ghost, danger, and text.</p>
|
|
883
|
+
<dl class="guidance"><dt>Do</dt><dd>One primary button in each decision group, labelled with a verb for its result, such as “Save changes”. Every other action in the group is secondary, ghost, or text.</dd><dt>Don’t</dt><dd>The danger variant on an action the reader can undo. Danger marks an action that destroys something.</dd></dl>
|
|
874
884
|
<div class="row"><h4>Primary</h4><div class="states">
|
|
875
885
|
<div class="state"><button class="btn" type="button"><svg class="icon" aria-hidden="true"><use href="#i-plus"/></svg>New monitor</button><span class="caption">Rest</span></div>
|
|
876
886
|
<div class="state" inert><button class="btn is-hover" type="button">New monitor</button><span class="caption">Hover</span></div>
|
|
@@ -921,6 +931,7 @@
|
|
|
921
931
|
<section class="component" id="quiet-action" data-layer="Core" data-states="hover pressed focus disabled" aria-labelledby="quiet-action-title">
|
|
922
932
|
<header><h3 id="quiet-action-title">Quiet action</h3><span class="badge">Core</span><a href="components.md#quiet-action">Spec</a><button class="quiet-action copy-link" type="button" data-copy-link="quiet-action" aria-label="Copy link to Quiet action" title="Copy link"><svg class="icon" aria-hidden="true"><use href="#i-link"/></svg></button></header>
|
|
923
933
|
<p class="purpose">A small transparent action inside a component, such as Copy or Close.</p>
|
|
934
|
+
<dl class="guidance"><dt>Do</dt><dd>Use it for an action inside a component: Copy in a code block or command list, close in a dialog or drawer, Full size on a capture, and the project trigger.</dd><dt>Don’t</dt><dd>An action that stands on its own in the page, such as Save or Next. That is a button.</dd></dl>
|
|
924
935
|
<p class="note">One recipe for Copy, Full size, dialog and drawer close, and the project trigger. Each component sets only its size and place.</p>
|
|
925
936
|
<div class="row"><h4>Icon</h4><div class="states">
|
|
926
937
|
<div class="state"><button class="quiet-action close" type="button" aria-label="Close"><svg class="icon" aria-hidden="true"><use href="#i-close"/></svg></button><span class="caption">Rest</span></div>
|
|
@@ -945,6 +956,7 @@
|
|
|
945
956
|
<section class="component" id="checkbox-and-radio" data-layer="Core" data-states="selected focus disabled" aria-labelledby="check-title">
|
|
946
957
|
<header><h3 id="check-title">Checkbox and radio</h3><span class="badge">Core</span><a href="components.md#checkbox-and-radio">Spec</a><button class="quiet-action copy-link" type="button" data-copy-link="checkbox-and-radio" aria-label="Copy link to Checkbox and radio" title="Copy link"><svg class="icon" aria-hidden="true"><use href="#i-link"/></svg></button></header>
|
|
947
958
|
<p class="purpose">Pick several options, or one from a short list.</p>
|
|
959
|
+
<dl class="guidance"><dt>Do</dt><dd>Checkboxes for options the reader can pick in any combination. Radios for one choice from a short list that stays in view.</dd><dt>Don’t</dt><dd>A label written as a question, such as “Send updates?”, or as a negative, such as “Don’t email me”. Name the option: “Email me updates”.</dd></dl>
|
|
948
960
|
<div class="row"><h4>Checkbox</h4><div class="states">
|
|
949
961
|
<div class="state"><label class="check"><input type="checkbox">Notify on recovery</label><span class="caption">Rest</span></div>
|
|
950
962
|
<div class="state" inert><label class="check"><input type="checkbox" checked>Notify on recovery</label><span class="caption">Checked</span></div>
|
|
@@ -967,6 +979,7 @@
|
|
|
967
979
|
<section class="component" id="radio-card-group" data-layer="Core" data-states="hover selected focus disabled" aria-labelledby="rc-title">
|
|
968
980
|
<header><h3 id="rc-title">Radio card group</h3><span class="badge">Core</span><a href="components.md#radio-card-group">Spec</a><button class="quiet-action copy-link" type="button" data-copy-link="radio-card-group" aria-label="Copy link to Radio card group" title="Copy link"><svg class="icon" aria-hidden="true"><use href="#i-link"/></svg></button></header>
|
|
969
981
|
<p class="purpose">Pick one option that needs a description.</p>
|
|
982
|
+
<dl class="guidance"><dt>Do</dt><dd>Use radio cards when the reader chooses by a description, such as plans or deploy modes. Give each card a title and one line on what differs.</dd><dt>Don’t</dt><dd>Radio cards for options that a title alone explains. Use radios.</dd></dl>
|
|
970
983
|
<div class="row"><h4>Live</h4><div class="states">
|
|
971
984
|
<div class="state wide"><fieldset class="radio-cards"><legend class="sr-only">Delivery</legend><label class="radio-card"><input type="radio" name="delivery" checked><strong>Immediate</strong><span class="muted">Send each alert.</span></label><label class="radio-card"><input type="radio" name="delivery"><strong>Digest</strong><span class="muted">Group the alerts.</span></label></fieldset><span class="caption">Rest; Immediate is selected</span></div>
|
|
972
985
|
</div></div>
|
|
@@ -979,6 +992,7 @@
|
|
|
979
992
|
<section class="component" id="switch" data-layer="Core" data-states="selected focus disabled" aria-labelledby="switch-title">
|
|
980
993
|
<header><h3 id="switch-title">Switch</h3><span class="badge">Core</span><a href="components.md#switch">Spec</a><button class="quiet-action copy-link" type="button" data-copy-link="switch" aria-label="Copy link to Switch" title="Copy link"><svg class="icon" aria-hidden="true"><use href="#i-link"/></svg></button></header>
|
|
981
994
|
<p class="purpose">Turn a setting on or off at once.</p>
|
|
995
|
+
<dl class="guidance"><dt>Do</dt><dd>Use a switch for a setting that applies the moment it changes. Its label names the setting, such as “Dark mode”, and stays the same when on or off.</dd><dt>Don’t</dt><dd>A switch in a form that applies on submit. Use a checkbox there.</dd></dl>
|
|
982
996
|
<div class="row"><h4>States</h4><div class="states">
|
|
983
997
|
<div class="state"><div class="switch-row"><button class="switch" id="sw-rest" type="button" role="switch" aria-checked="false" aria-labelledby="sw-rest-label"><span class="switch-track" aria-hidden="true"></span></button><label id="sw-rest-label" for="sw-rest">Alerts</label></div><span class="caption">Off, live</span></div>
|
|
984
998
|
<div class="state" inert><div class="switch-row"><button class="switch" id="sw-on" type="button" role="switch" aria-checked="true" aria-labelledby="sw-on-label"><span class="switch-track" aria-hidden="true"></span></button><label id="sw-on-label" for="sw-on">Alerts</label></div><span class="caption">On</span></div>
|
|
@@ -996,6 +1010,7 @@
|
|
|
996
1010
|
<section class="component" id="toggle-button" data-layer="Core" data-states="hover pressed focus disabled" aria-labelledby="toggle-title">
|
|
997
1011
|
<header><h3 id="toggle-title">Toggle button</h3><span class="badge">Core</span><a href="components.md#toggle-button">Spec</a><button class="quiet-action copy-link" type="button" data-copy-link="toggle-button" aria-label="Copy link to Toggle button" title="Copy link"><svg class="icon" aria-hidden="true"><use href="#i-link"/></svg></button></header>
|
|
998
1012
|
<p class="purpose">A labelled card that latches on, with a switch inside.</p>
|
|
1013
|
+
<dl class="guidance"><dt>Do</dt><dd>Use it for an on or off option whose label sits inside the control, such as “Wrap lines” in a viewer’s toolbar.</dd><dt>Don’t</dt><dd>A toggle button for an action that runs once, such as Refresh. It stays on until pressed again; an action is a button.</dd></dl>
|
|
999
1014
|
<div class="row"><h4>States</h4><div class="states">
|
|
1000
1015
|
<div class="state"><button class="toggle" type="button" aria-pressed="false" data-live-toggle><span class="toggle-track" aria-hidden="true"></span><span class="toggle-text">Wrap lines<small>Long lines fold</small></span></button><span class="caption">Rest, live</span></div>
|
|
1001
1016
|
<div class="state" inert><button class="toggle is-hover" type="button" aria-pressed="false"><span class="toggle-track" aria-hidden="true"></span><span class="toggle-text">Wrap lines</span></button><span class="caption">Hover</span></div>
|
|
@@ -1013,6 +1028,7 @@
|
|
|
1013
1028
|
<section class="component" id="segmented-control" data-layer="Core" data-states="hover pressed focus disabled" aria-labelledby="seg-title">
|
|
1014
1029
|
<header><h3 id="seg-title">Segmented control</h3><span class="badge">Core</span><a href="components.md#segmented-control">Spec</a><button class="quiet-action copy-link" type="button" data-copy-link="segmented-control" aria-label="Copy link to Segmented control" title="Copy link"><svg class="icon" aria-hidden="true"><use href="#i-link"/></svg></button></header>
|
|
1015
1030
|
<p class="purpose">Two to five short options that apply at once.</p>
|
|
1031
|
+
<dl class="guidance"><dt>Do</dt><dd>Use it for two to five short options that apply at once and change how the same content shows, such as a view mode or the System, Light, and Dark choice.</dd><dt>Don’t</dt><dd>A segmented control that switches between panels of content. Use tabs.</dd></dl>
|
|
1016
1032
|
<p class="note">The live control glides its thumb between options: 260ms for the leading edge, 300ms for the trailing edge. The theme picker at the top uses the same script, and it does not glide when the page loads a saved choice.</p>
|
|
1017
1033
|
<div class="row"><h4>Text</h4><div class="states">
|
|
1018
1034
|
<div class="state"><div class="segmented" role="group" aria-label="View" data-live><button type="button" aria-pressed="true">List</button><button type="button" aria-pressed="false">Board</button><button type="button" aria-pressed="false">Timeline</button></div><span class="caption">Rest, live</span></div>
|
|
@@ -1035,6 +1051,7 @@
|
|
|
1035
1051
|
<section class="component" id="text-input-and-textarea" data-layer="Core" data-states="focus disabled invalid" aria-labelledby="input-title">
|
|
1036
1052
|
<header><h3 id="input-title">Text input and textarea</h3><span class="badge">Core</span><a href="components.md#text-input-and-textarea">Spec</a><button class="quiet-action copy-link" type="button" data-copy-link="text-input-and-textarea" aria-label="Copy link to Text input and textarea" title="Copy link"><svg class="icon" aria-hidden="true"><use href="#i-link"/></svg></button></header>
|
|
1037
1053
|
<p class="purpose">Type a short value or a longer note.</p>
|
|
1054
|
+
<dl class="guidance"><dt>Do</dt><dd>A textarea for an answer longer than one line, and <code>type="search"</code> for a field that filters.</dd><dt>Don’t</dt><dd>A label or an instruction that lives only in the placeholder. It disappears as the reader types.</dd></dl>
|
|
1038
1055
|
<div class="row"><h4>Input</h4><div class="states">
|
|
1039
1056
|
<div class="state"><div class="field"><label class="field-label" for="in-rest">Service</label><input class="input" id="in-rest" placeholder="checkout-api"></div><span class="caption">Rest</span></div>
|
|
1040
1057
|
<div class="state" inert><div class="field"><label class="field-label" for="in-focus">Service</label><input class="input is-focus" id="in-focus" value="checkout-api"></div><span class="caption">Focus visible</span></div>
|
|
@@ -1062,6 +1079,7 @@
|
|
|
1062
1079
|
<section class="component" id="select" data-layer="Core" data-states="focus disabled invalid" aria-labelledby="select-title">
|
|
1063
1080
|
<header><h3 id="select-title">Select</h3><span class="badge">Core</span><a href="components.md#select">Spec</a><button class="quiet-action copy-link" type="button" data-copy-link="select" aria-label="Copy link to Select" title="Copy link"><svg class="icon" aria-hidden="true"><use href="#i-link"/></svg></button></header>
|
|
1064
1081
|
<p class="purpose">Choose from a longer list.</p>
|
|
1082
|
+
<dl class="guidance"><dt>Do</dt><dd>Use a select for one choice from more than five options, in a predictable order: alphabetical, numeric, or by frequency of use.</dd><dt>Don’t</dt><dd>A first option that acts as the label, such as “Choose a region”. The label goes above the field.</dd></dl>
|
|
1065
1083
|
<div class="row"><h4>Closed</h4><div class="states">
|
|
1066
1084
|
<div class="state"><div class="field"><label class="field-label" for="se-rest">Window</label><select class="select" id="se-rest"><option>Last hour</option><option>Last 24 hours</option><option>Last 7 days</option></select></div><span class="caption">Rest</span></div>
|
|
1067
1085
|
<div class="state" inert><div class="field"><label class="field-label" for="se-focus">Window</label><select class="select is-focus" id="se-focus"><option>Last hour</option></select></div><span class="caption">Focus visible</span></div>
|
|
@@ -1081,6 +1099,7 @@
|
|
|
1081
1099
|
<section class="component" id="field-wrapper" data-layer="Core" data-states="invalid" aria-labelledby="fieldw-title">
|
|
1082
1100
|
<header><h3 id="fieldw-title">Field wrapper</h3><span class="badge">Core</span><a href="components.md#field-wrapper">Spec</a><button class="quiet-action copy-link" type="button" data-copy-link="field-wrapper" aria-label="Copy link to Field wrapper" title="Copy link"><svg class="icon" aria-hidden="true"><use href="#i-link"/></svg></button></header>
|
|
1083
1101
|
<p class="purpose">Label, description, and error text around a field.</p>
|
|
1102
|
+
<dl class="guidance"><dt>Do</dt><dd>Write the error as the fix, such as “Enter a date after today”, and the description as a format or limit, such as “Up to 64 characters”.</dd><dt>Don’t</dt><dd>A description that repeats the label, or an error that only says “Invalid”.</dd></dl>
|
|
1084
1103
|
<div class="row"><h4>Description and error</h4><div class="states">
|
|
1085
1104
|
<div class="state"><div class="field"><label class="field-label" for="fw-desc">Threshold</label><input class="input" id="fw-desc" inputmode="numeric" value="300" aria-describedby="fw-desc-text"><p class="field-description" id="fw-desc-text">Milliseconds at p95.</p></div><span class="caption">With description</span></div>
|
|
1086
1105
|
<div class="state" inert><div class="field"><label class="field-label" for="fw-error">Threshold</label><input class="input" id="fw-error" value="-1" aria-invalid="true" aria-errormessage="fw-error-text"><p class="field-error" id="fw-error-text">Enter a positive number.</p></div><span class="caption">Error replaces the description</span></div>
|
|
@@ -1090,15 +1109,16 @@
|
|
|
1090
1109
|
<section class="component" id="slider" data-layer="Core" data-states="focus disabled" aria-labelledby="slider-title">
|
|
1091
1110
|
<header><h3 id="slider-title">Slider</h3><span class="badge">Core</span><a href="components.md#slider">Spec</a><button class="quiet-action copy-link" type="button" data-copy-link="slider" aria-label="Copy link to Slider" title="Copy link"><svg class="icon" aria-hidden="true"><use href="#i-link"/></svg></button></header>
|
|
1092
1111
|
<p class="purpose">Set a value in a range.</p>
|
|
1112
|
+
<dl class="guidance"><dt>Do</dt><dd>Use a slider for an approximate value in a range, such as volume or opacity, and show the current value as text beside it.</dd><dt>Don’t</dt><dd>A slider for a value the reader must set exactly, such as a port or a price. Use a text input.</dd></dl>
|
|
1093
1113
|
<div class="row"><h4>States</h4><div class="states">
|
|
1094
|
-
<div class="state"><div class="field"><label class="field-label" for="sl-rest">Sample rate</label><input class="range" id="sl-rest" type="range" min="0" max="100" value="40" style="--value:40%" data-live-range></div><span class="caption">Rest, live</span></div>
|
|
1095
|
-
<div class="state" inert><input class="range is-focus" type="range" aria-label="Sample rate, focused" min="0" max="100" value="60" style="--value:60%"><span class="caption">Focus visible</span></div>
|
|
1096
|
-
<div class="state" inert><input class="range" type="range" aria-label="Sample rate, disabled" min="0" max="100" value="60" style="--value:60%" disabled><span class="caption">Disabled</span></div>
|
|
1114
|
+
<div class="state"><div class="field"><label class="field-label" for="sl-rest">Sample rate</label><div class="slider"><input class="range" id="sl-rest" type="range" min="0" max="100" value="40" style="--value:40%" data-live-range><output class="slider-value" for="sl-rest" aria-live="off">40%</output></div></div><span class="caption">Rest, live</span></div>
|
|
1115
|
+
<div class="state" inert><div class="slider"><input class="range is-focus" id="sl-focus" type="range" aria-label="Sample rate, focused" min="0" max="100" value="60" style="--value:60%"><output class="slider-value" for="sl-focus" aria-live="off">60%</output></div><span class="caption">Focus visible</span></div>
|
|
1116
|
+
<div class="state" inert><div class="slider"><input class="range" id="sl-disabled" type="range" aria-label="Sample rate, disabled" min="0" max="100" value="60" style="--value:60%" disabled><output class="slider-value" for="sl-disabled" aria-live="off">60%</output></div><span class="caption">Disabled</span></div>
|
|
1097
1117
|
</div></div>
|
|
1098
1118
|
<div class="row"><h4>Sizes</h4><div class="states">
|
|
1099
|
-
<div class="state" inert><input class="range" data-size="sm" type="range" aria-label="Small slider" min="0" max="100" value="50"><span class="caption">sm</span></div>
|
|
1100
|
-
<div class="state" inert><input class="range" type="range" aria-label="Medium slider" min="0" max="100" value="50"><span class="caption">md</span></div>
|
|
1101
|
-
<div class="state" inert><input class="range" data-size="lg" type="range" aria-label="Large slider" min="0" max="100" value="50"><span class="caption">lg</span></div>
|
|
1119
|
+
<div class="state" inert><div class="slider"><input class="range" id="sl-sm" data-size="sm" type="range" aria-label="Small slider" min="0" max="100" value="50"><output class="slider-value" for="sl-sm" aria-live="off">50%</output></div><span class="caption">sm</span></div>
|
|
1120
|
+
<div class="state" inert><div class="slider"><input class="range" id="sl-md" type="range" aria-label="Medium slider" min="0" max="100" value="50"><output class="slider-value" for="sl-md" aria-live="off">50%</output></div><span class="caption">md</span></div>
|
|
1121
|
+
<div class="state" inert><div class="slider"><input class="range" id="sl-lg" data-size="lg" type="range" aria-label="Large slider" min="0" max="100" value="50"><output class="slider-value" for="sl-lg" aria-live="off">50%</output></div><span class="caption">lg</span></div>
|
|
1102
1122
|
</div></div>
|
|
1103
1123
|
</section>
|
|
1104
1124
|
|
|
@@ -1110,6 +1130,7 @@
|
|
|
1110
1130
|
<section class="component" id="progress" data-layer="Core" aria-labelledby="progress-title">
|
|
1111
1131
|
<header><h3 id="progress-title">Progress</h3><span class="badge">Core</span><a href="components.md#progress">Spec</a><button class="quiet-action copy-link" type="button" data-copy-link="progress" aria-label="Copy link to Progress" title="Copy link"><svg class="icon" aria-hidden="true"><use href="#i-link"/></svg></button></header>
|
|
1112
1132
|
<p class="purpose">Show how far a task has got.</p>
|
|
1133
|
+
<dl class="guidance"><dt>Do</dt><dd>Use it for a task with a known end, such as an import, and name it for the task.</dd><dt>Don’t</dt><dd>A progress bar for a measured value, such as disk usage or a rating. It shows a task moving to its end; use text or a score.</dd></dl>
|
|
1113
1134
|
<div class="row"><h4>Values</h4><div class="states">
|
|
1114
1135
|
<div class="state"><div class="progress" role="progressbar" aria-label="Import, empty" aria-valuemin="0" aria-valuemax="100" aria-valuenow="0"><span style="transform:translateX(-100%)"></span></div><span class="caption">0%</span></div>
|
|
1115
1136
|
<div class="state"><div class="progress" role="progressbar" aria-label="Import" aria-valuemin="0" aria-valuemax="100" aria-valuenow="40"><span style="transform:translateX(-60%)"></span></div><span class="caption">40%</span></div>
|
|
@@ -1120,6 +1141,7 @@
|
|
|
1120
1141
|
<section class="component" id="score" data-layer="Core" aria-labelledby="score-title">
|
|
1121
1142
|
<header><h3 id="score-title">Score</h3><span class="badge">Core</span><a href="components.md#score">Spec</a><button class="quiet-action copy-link" type="button" data-copy-link="score" aria-label="Copy link to Score" title="Copy link"><svg class="icon" aria-hidden="true"><use href="#i-link"/></svg></button></header>
|
|
1122
1143
|
<p class="purpose">Show a value out of a maximum.</p>
|
|
1144
|
+
<dl class="guidance"><dt>Do</dt><dd>Use it for a value out of a fixed maximum, such as 4/5, and keep one maximum across a list so the rows compare.</dd><dt>Don’t</dt><dd>A score for a percentage or an open-ended count. Write the number as text.</dd></dl>
|
|
1123
1145
|
<div class="row"><h4>Values</h4><div class="states">
|
|
1124
1146
|
<div class="state"><span class="score"><span class="pips" aria-hidden="true"><i class="on"></i><i class="on"></i><i class="on"></i><i></i><i></i></span><b>3<span>/5</span></b></span><span class="caption">3 of 5</span></div>
|
|
1125
1147
|
<div class="state"><span class="score"><span class="pips" aria-hidden="true"><i class="on"></i><i class="on"></i><i class="on"></i><i class="on"></i><i class="on"></i></span><b>5<span>/5</span></b></span><span class="caption">5 of 5</span></div>
|
|
@@ -1129,6 +1151,7 @@
|
|
|
1129
1151
|
<section class="component" id="badge" data-layer="Core" aria-labelledby="badge-title">
|
|
1130
1152
|
<header><h3 id="badge-title">Badge</h3><span class="badge">Core</span><a href="components.md#badge">Spec</a><button class="quiet-action copy-link" type="button" data-copy-link="badge" aria-label="Copy link to Badge" title="Copy link"><svg class="icon" aria-hidden="true"><use href="#i-link"/></svg></button></header>
|
|
1131
1153
|
<p class="purpose">A short status label.</p>
|
|
1154
|
+
<dl class="guidance"><dt>Do</dt><dd>A one- or two-word status or category on an item, such as “Healthy” or “Beta”, with a status tone only when it is a status.</dd><dt>Don’t</dt><dd>A badge that repeats the title, or one on every row with the same value. Badge the exceptions.</dd></dl>
|
|
1132
1155
|
<div class="row"><h4>Tones</h4><div class="states">
|
|
1133
1156
|
<div class="state"><span class="badge">No data</span><span class="caption">Neutral</span></div>
|
|
1134
1157
|
<div class="state"><span class="badge success">Healthy</span><span class="caption">Success</span></div>
|
|
@@ -1141,6 +1164,7 @@
|
|
|
1141
1164
|
<section class="component" id="alert" data-layer="Core" aria-labelledby="alert-title">
|
|
1142
1165
|
<header><h3 id="alert-title">Alert</h3><span class="badge">Core</span><a href="components.md#alert">Spec</a><button class="quiet-action copy-link" type="button" data-copy-link="alert" aria-label="Copy link to Alert" title="Copy link"><svg class="icon" aria-hidden="true"><use href="#i-link"/></svg></button></header>
|
|
1143
1166
|
<p class="purpose">A real caveat or status message in the page.</p>
|
|
1167
|
+
<dl class="guidance"><dt>Do</dt><dd>Use an alert for a caveat or status message the reader needs before acting. When action is needed, name it, such as “Reconnect the source to resume sync”.</dd><dt>Don’t</dt><dd>An alert for decoration or routine emphasis. A short status label is a badge; explanations and recovery instructions stay in an alert.</dd></dl>
|
|
1144
1168
|
<div class="row"><h4>Tones</h4><div class="states">
|
|
1145
1169
|
<div class="state wide"><div class="alert"><svg class="icon" aria-hidden="true"><use href="#i-help"/></svg><p>Values are sampled every 5 minutes.</p></div><span class="caption">Neutral</span></div>
|
|
1146
1170
|
<div class="state wide"><div class="alert success"><svg class="icon" aria-hidden="true"><use href="#i-check"/></svg><p>The monitor recovered at 14:20.</p></div><span class="caption">Success</span></div>
|
|
@@ -1158,6 +1182,7 @@
|
|
|
1158
1182
|
<section class="component" id="surface-and-card" data-layer="Core" aria-labelledby="card-title">
|
|
1159
1183
|
<header><h3 id="card-title">Surface and card</h3><span class="badge">Core</span><a href="components.md#surface-and-card">Spec</a><button class="quiet-action copy-link" type="button" data-copy-link="surface-and-card" aria-label="Copy link to Surface and card" title="Copy link"><svg class="icon" aria-hidden="true"><use href="#i-link"/></svg></button></header>
|
|
1160
1184
|
<p class="purpose">Panels and cards for parallel, comparable content.</p>
|
|
1185
|
+
<dl class="guidance"><dt>Do</dt><dd>Use cards for a few parallel, self-contained items that a reader compares, such as plans or projects.</dd><dt>Don’t</dt><dd>A panel inside a panel, or cards around ordinary prose.</dd></dl>
|
|
1161
1186
|
<div class="row"><h4>Card</h4><div class="states">
|
|
1162
1187
|
<div class="state wide"><article class="card" aria-labelledby="card-sample-title"><div class="card-head"><h4 id="card-sample-title">API p95 latency</h4><span class="badge danger">Alerting</span></div><div class="card-body">412 ms against a 300 ms threshold for 10 minutes.</div><div class="card-foot"><span>checkout-api</span><span>Updated 2 minutes ago</span></div></article><span class="caption">Header, body, and footer</span></div>
|
|
1163
1188
|
</div></div>
|
|
@@ -1170,12 +1195,14 @@
|
|
|
1170
1195
|
<section class="component" id="figure" data-layer="Core" aria-labelledby="figure-title">
|
|
1171
1196
|
<header><h3 id="figure-title">Figure</h3><span class="badge">Core</span><a href="components.md#figure">Spec</a><button class="quiet-action copy-link" type="button" data-copy-link="figure" aria-label="Copy link to Figure" title="Copy link"><svg class="icon" aria-hidden="true"><use href="#i-link"/></svg></button></header>
|
|
1172
1197
|
<p class="purpose">An image or diagram with a caption.</p>
|
|
1198
|
+
<dl class="guidance"><dt>Do</dt><dd>Caption every figure with what it shows. When the prose refers to one figure by number, number them all.</dd><dt>Don’t</dt><dd>A screenshot of code or of a component. Show code as text, so the reader can copy it, and a component live.</dd></dl>
|
|
1173
1199
|
<figure class="figure"><div class="figure-plate"><div class="cluster" style="display:flex;gap:var(--space-2);flex-wrap:wrap"><span class="badge success">Healthy</span><span class="badge warning">Warning</span><span class="badge danger">Alerting</span></div></div><figcaption><b>Figure 1.</b> A well with its caption below.</figcaption></figure>
|
|
1174
1200
|
</section>
|
|
1175
1201
|
|
|
1176
1202
|
<section class="component" id="dialog" data-layer="Core" aria-labelledby="dialog-title">
|
|
1177
1203
|
<header><h3 id="dialog-title">Dialog</h3><span class="badge">Core</span><a href="components.md#dialog">Spec</a><button class="quiet-action copy-link" type="button" data-copy-link="dialog" aria-label="Copy link to Dialog" title="Copy link"><svg class="icon" aria-hidden="true"><use href="#i-link"/></svg></button></header>
|
|
1178
1204
|
<p class="purpose">A modal task that needs an answer before the page continues.</p>
|
|
1205
|
+
<dl class="guidance"><dt>Do</dt><dd>Use a dialog for a short task the reader must finish or cancel before the page continues, such as confirming a deletion. Title it with that task.</dd><dt>Don’t</dt><dd>A dialog that opens without the reader asking, such as on page load, or one that holds a long form. A long form gets its own page.</dd></dl>
|
|
1179
1206
|
<div class="row"><h4>Live</h4><div class="states">
|
|
1180
1207
|
<div class="state"><button class="btn secondary" type="button" data-open="live-dialog">Open dialog</button><span class="caption">Opens a native modal dialog</span></div>
|
|
1181
1208
|
</div></div>
|
|
@@ -1187,6 +1214,7 @@
|
|
|
1187
1214
|
<section class="component" id="drawer" data-layer="Core" aria-labelledby="drawer-title">
|
|
1188
1215
|
<header><h3 id="drawer-title">Drawer</h3><span class="badge">Core</span><a href="components.md#drawer">Spec</a><button class="quiet-action copy-link" type="button" data-copy-link="drawer" aria-label="Copy link to Drawer" title="Copy link"><svg class="icon" aria-hidden="true"><use href="#i-link"/></svg></button></header>
|
|
1189
1216
|
<p class="purpose">A side panel, such as phone navigation.</p>
|
|
1217
|
+
<dl class="guidance"><dt>Do</dt><dd>Use a drawer for navigation or supporting detail that slides in from the side, such as the phone menu, and open it from a named button.</dd><dt>Don’t</dt><dd>The page’s main task inside a drawer. The drawer holds navigation or detail; the task stays on the page.</dd></dl>
|
|
1190
1218
|
<div class="row"><h4>Live</h4><div class="states">
|
|
1191
1219
|
<div class="state"><button class="btn secondary menu-glyph" type="button" data-size="lg" data-open="live-drawer">Contents</button><span class="caption">Rest, live: a page’s contents trigger opens a side drawer</span></div>
|
|
1192
1220
|
</div></div>
|
|
@@ -1203,6 +1231,7 @@
|
|
|
1203
1231
|
<section class="component" id="navigation-list" data-layer="Core" data-states="hover selected focus" aria-labelledby="nav-title">
|
|
1204
1232
|
<header><h3 id="nav-title">Navigation list</h3><span class="badge">Core</span><a href="components.md#navigation-list">Spec</a><button class="quiet-action copy-link" type="button" data-copy-link="navigation-list" aria-label="Copy link to Navigation list" title="Copy link"><svg class="icon" aria-hidden="true"><use href="#i-link"/></svg></button></header>
|
|
1205
1233
|
<p class="purpose">Rows of links with current page and current location.</p>
|
|
1234
|
+
<dl class="guidance"><dt>Do</dt><dd>Label a page link with the destination page’s title, and an in-page link with its destination section’s heading.</dd><dt>Don’t</dt><dd>Actions such as Delete or Sign out in a navigation list. Every row is a link to a place; an action is a button.</dd></dl>
|
|
1206
1235
|
<div class="row"><h4>Rows</h4><div class="states">
|
|
1207
1236
|
<div class="state"><nav class="navlist" aria-label="Sample routes"><span class="group-label">Guides</span><a href="components.html" aria-current="page">Install</a><a href="#navigation-list">Configure</a><a href="#navigation-list">Release</a></nav><span class="caption">Live; Install is the current page</span></div>
|
|
1208
1237
|
<div class="state" inert><nav class="navlist" aria-label="Sample routes, pinned"><a href="#navigation-list" class="is-hover">Hover</a><a href="components.html" aria-current="page" class="is-hover">Current page, hover</a><a href="#navigation-list" aria-current="location">Current location</a><a href="#navigation-list" class="is-focus">Focus visible</a></nav><span class="caption">Hover, current page with hover, current location, and focus visible</span></div>
|
|
@@ -1221,6 +1250,7 @@
|
|
|
1221
1250
|
<section class="component" id="section-rail" data-layer="Core" aria-labelledby="section-rail-title">
|
|
1222
1251
|
<header><h3 id="section-rail-title">Section rail</h3><span class="badge">Core</span><a href="components.md#section-rail">Spec</a><button class="quiet-action copy-link" type="button" data-copy-link="section-rail" aria-label="Copy link to Section rail" title="Copy link"><svg class="icon" aria-hidden="true"><use href="#i-link"/></svg></button></header>
|
|
1223
1252
|
<p class="purpose">A sticky list of sections that moves into a drawer on phones.</p>
|
|
1253
|
+
<dl class="guidance"><dt>Do</dt><dd>Use a rail for the sections of a long page, or for a site’s pages. A site’s pages may take a navigation strip of 6 links or fewer instead.</dd><dt>Don’t</dt><dd>A rail beside a strip or a contents list that holds the same links. Each level has one list.</dd></dl>
|
|
1224
1254
|
<div class="row"><h4>Desktop rail</h4><div class="states">
|
|
1225
1255
|
<div class="state"><div class="rail-specimen"><div class="find"><svg class="icon" aria-hidden="true"><use href="#i-search"/></svg><input class="input" type="search" aria-label="Find a component, specimen" placeholder="Find a component"><kbd class="key" aria-hidden="true">/</kbd></div>
|
|
1226
1256
|
<nav class="navlist" aria-label="Rail specimen"><span class="group-label">Inputs</span><a href="#section-rail">Select</a><a href="#section-rail" aria-current="location">Slider</a><a href="#section-rail">Field wrapper</a></nav></div><span class="caption">Live; Slider is the current section</span></div>
|
|
@@ -1234,6 +1264,7 @@
|
|
|
1234
1264
|
<section class="component" id="find-field" data-layer="Core" aria-labelledby="find-field-title">
|
|
1235
1265
|
<header><h3 id="find-field-title">Find field</h3><span class="badge">Core</span><a href="components.md#find-field">Spec</a><button class="quiet-action copy-link" type="button" data-copy-link="find-field" aria-label="Copy link to Find field" title="Copy link"><svg class="icon" aria-hidden="true"><use href="#i-link"/></svg></button></header>
|
|
1236
1266
|
<p class="purpose">Filter a navigation list as you type.</p>
|
|
1267
|
+
<dl class="guidance"><dt>Do</dt><dd>Use it at the top of a long navigation list, such as a section rail, to filter its rows by name or purpose.</dd><dt>Don’t</dt><dd>A find field used as a site-wide search. It matches only the rows of the list it filters.</dd></dl>
|
|
1237
1268
|
<div class="row"><h4>States</h4><div class="states">
|
|
1238
1269
|
<div class="state"><div class="find"><svg class="icon" aria-hidden="true"><use href="#i-search"/></svg><input class="input" type="search" aria-label="Find a component, rest specimen" placeholder="Find a component"><kbd class="key" aria-hidden="true">/</kbd></div><span class="caption">Rest, live; the key hint shows the shortcut</span></div>
|
|
1239
1270
|
<div class="state" inert><div class="find"><svg class="icon" aria-hidden="true"><use href="#i-search"/></svg><input class="input is-focus" type="search" aria-label="Find a component, focus specimen" value="tog"></div><span class="find-count">3 matches</span><span class="caption">Focus visible with a query; the hint hides</span></div>
|
|
@@ -1245,6 +1276,7 @@
|
|
|
1245
1276
|
<section class="component" id="breadcrumbs" data-layer="Core" aria-labelledby="breadcrumbs-title">
|
|
1246
1277
|
<header><h3 id="breadcrumbs-title">Breadcrumbs</h3><span class="badge">Core</span><a href="components.md#breadcrumbs">Spec</a><button class="quiet-action copy-link" type="button" data-copy-link="breadcrumbs" aria-label="Copy link to Breadcrumbs" title="Copy link"><svg class="icon" aria-hidden="true"><use href="#i-link"/></svg></button></header>
|
|
1247
1278
|
<p class="purpose">The path from the site to this page.</p>
|
|
1279
|
+
<dl class="guidance"><dt>Do</dt><dd>Use breadcrumbs only at depth 3 or more, or on a page outside its site’s shell.</dd><dt>Don’t</dt><dd>A trail whose only crumb repeats the page’s h1.</dd></dl>
|
|
1248
1280
|
<div class="row"><h4>Trail</h4><div class="states">
|
|
1249
1281
|
<div class="state"><nav class="crumbs" aria-label="Breadcrumb, specimen"><ol><li><a href="#breadcrumbs">Design system</a></li><li><a href="#breadcrumbs">Components</a></li><li><span aria-current="page">Navigation</span></li></ol></nav><span class="caption">Rest, live; the current page is text</span></div>
|
|
1250
1282
|
<div class="state" inert><nav class="crumbs" aria-label="Breadcrumb, pinned"><ol><li><a href="#breadcrumbs" class="is-hover">Design system</a></li><li><a href="#breadcrumbs" class="is-focus">Components</a></li><li><span aria-current="page">Navigation</span></li></ol></nav><span class="caption">Hover on Design system, focus visible on Components</span></div>
|
|
@@ -1255,6 +1287,7 @@
|
|
|
1255
1287
|
<section class="component" id="pager" data-layer="Core" aria-labelledby="pager-title">
|
|
1256
1288
|
<header><h3 id="pager-title">Pager</h3><span class="badge">Core</span><a href="components.md#pager">Spec</a><button class="quiet-action copy-link" type="button" data-copy-link="pager" aria-label="Copy link to Pager" title="Copy link"><svg class="icon" aria-hidden="true"><use href="#i-link"/></svg></button></header>
|
|
1257
1289
|
<p class="purpose">Previous and next pages in a sequence.</p>
|
|
1290
|
+
<dl class="guidance"><dt>Do</dt><dd>Use a pager for pages a reader goes through in order, such as a guide’s chapters or the skills in one group.</dd><dt>Don’t</dt><dd>A pager on pages with no reading order, or one per section on a page with a section rail.</dd></dl>
|
|
1258
1291
|
<div class="row"><h4>Sequence</h4><div class="states">
|
|
1259
1292
|
<div class="state wide"><nav class="pager" aria-label="Pages, specimen"><a href="#pager" rel="prev"><span class="pager-dir"><svg class="icon" aria-hidden="true"><use href="#i-arrow-left"/></svg>Previous</span><span class="pager-title">Foundations</span></a><a href="#pager" rel="next"><span class="pager-dir">Next<svg class="icon" aria-hidden="true"><use href="#i-arrow-right"/></svg></span><span class="pager-title">Application example</span></a></nav><span class="caption">Rest, live; previous and next</span></div>
|
|
1260
1293
|
<div class="state wide" inert><nav class="pager" aria-label="Pages, pinned"><a href="#pager" rel="next" class="is-hover"><span class="pager-dir">Next<svg class="icon" aria-hidden="true"><use href="#i-arrow-right"/></svg></span><span class="pager-title">Components</span></a></nav><span class="caption">First page: next only, still at the end; hover</span></div>
|
|
@@ -1264,6 +1297,7 @@
|
|
|
1264
1297
|
<section class="component" id="tabs" data-layer="Core" data-states="hover selected focus" aria-labelledby="tabs-title">
|
|
1265
1298
|
<header><h3 id="tabs-title">Tabs</h3><span class="badge">Core</span><a href="components.md#tabs">Spec</a><button class="quiet-action copy-link" type="button" data-copy-link="tabs" aria-label="Copy link to Tabs" title="Copy link"><svg class="icon" aria-hidden="true"><use href="#i-link"/></svg></button></header>
|
|
1266
1299
|
<p class="purpose">Switch panels about one object, without leaving the page.</p>
|
|
1300
|
+
<dl class="guidance"><dt>Do</dt><dd>Use tabs for panels about one object, such as a monitor’s Overview and History, when the URL does not change.</dd><dt>Don’t</dt><dd>Links with <code>role="tab"</code>, or one set that mixes pages and panels. Pages take a navigation strip.</dd></dl>
|
|
1267
1301
|
<div class="row"><h4>Live</h4><div class="states">
|
|
1268
1302
|
<div class="state wide" data-tabs data-label="Monitor">
|
|
1269
1303
|
<!-- Without JavaScript every panel shows under its heading; the script builds the tab list. -->
|
|
@@ -1282,6 +1316,7 @@
|
|
|
1282
1316
|
<section class="component" id="skip-link" data-layer="Core" aria-labelledby="skip-link-title">
|
|
1283
1317
|
<header><h3 id="skip-link-title">Skip link</h3><span class="badge">Core</span><a href="components.md#skip-link">Spec</a><button class="quiet-action copy-link" type="button" data-copy-link="skip-link" aria-label="Copy link to Skip link" title="Copy link"><svg class="icon" aria-hidden="true"><use href="#i-link"/></svg></button></header>
|
|
1284
1318
|
<p class="purpose">Jump past the header to the content.</p>
|
|
1319
|
+
<dl class="guidance"><dt>Do</dt><dd>A “Skip to content” link on every page with a header or rail before <code>main</code>; the first Tab shows it.</dd><dt>Don’t</dt><dd>Hiding it with <code>display: none</code>, which also takes it out of the Tab order.</dd></dl>
|
|
1285
1320
|
<div class="row"><h4>Focused</h4><div class="states">
|
|
1286
1321
|
<div class="state" inert><a class="skip is-focus" href="#main">Skip to content</a><span class="caption">Focus visible; hidden above the page until focused</span></div>
|
|
1287
1322
|
</div></div>
|
|
@@ -1290,6 +1325,7 @@
|
|
|
1290
1325
|
<section class="component" id="keyboard-key" data-layer="Core" aria-labelledby="keyboard-key-title">
|
|
1291
1326
|
<header><h3 id="keyboard-key-title">Keyboard key</h3><span class="badge">Core</span><a href="components.md#keyboard-key">Spec</a><button class="quiet-action copy-link" type="button" data-copy-link="keyboard-key" aria-label="Copy link to Keyboard key" title="Copy link"><svg class="icon" aria-hidden="true"><use href="#i-link"/></svg></button></header>
|
|
1292
1327
|
<p class="purpose">Show a key or shortcut in text.</p>
|
|
1328
|
+
<dl class="guidance"><dt>Do</dt><dd>A key or shortcut in running text or shortcut docs, one key per <code><kbd></code>.</dd><dt>Don’t</dt><dd>A key style for code or button names. Code takes <code><code></code>; a button’s name is plain text.</dd></dl>
|
|
1293
1329
|
<div class="row"><h4>Keys</h4><div class="states">
|
|
1294
1330
|
<div class="state"><p class="note">Press <kbd class="key">/</kbd> to find, <kbd class="key">Esc</kbd> to clear, and <kbd class="key">Enter</kbd> to go to the first match.</p><span class="caption">Rest, in running text</span></div>
|
|
1295
1331
|
</div></div>
|
|
@@ -1303,6 +1339,7 @@
|
|
|
1303
1339
|
<section class="component" id="code-block" data-layer="Core" aria-labelledby="code-title">
|
|
1304
1340
|
<header><h3 id="code-title">Code block</h3><span class="badge">Core</span><a href="components.md#code-block">Spec</a><button class="quiet-action copy-link" type="button" data-copy-link="code-block" aria-label="Copy link to Code block" title="Copy link"><svg class="icon" aria-hidden="true"><use href="#i-link"/></svg></button></header>
|
|
1305
1341
|
<p class="purpose">Source code with an optional header and Copy, and a live example above it.</p>
|
|
1342
|
+
<dl class="guidance"><dt>Do</dt><dd>Use a code block for source with no live result. When the reader should see the result too, use the variant with a live example.</dd><dt>Don’t</dt><dd>The same language label on every block of a page. Put useful setup context above the block instead.</dd></dl>
|
|
1306
1343
|
<div class="row"><h4>Source well</h4><div class="states">
|
|
1307
1344
|
<div class="state wide"><div class="code"><div class="code-head"><b>monitor.ts</b><span class="lang">TypeScript</span><button class="quiet-action copy" type="button" data-copy="code-src"><svg class="icon" aria-hidden="true"><use href="#i-copy"/></svg>Copy</button></div><pre tabindex="0" role="region" aria-label="monitor.ts"><code id="code-src"><span class="line"><span class="ln">1</span><span><span class="k">const</span> threshold = <span class="n">300</span> <span class="c">// ms at p95</span></span></span><span class="line"><span class="ln">2</span><span><span class="k">export const</span> name = <span class="s">'API p95 latency'</span></span></span></code></pre></div><span class="caption">Header, line numbers, and Copy, live</span></div>
|
|
1308
1345
|
<div class="state wide" inert><div class="code compact"><pre><code><span class="line"><span>import { threshold } from './monitor'</span></span></code></pre><button class="quiet-action copy is-focus" type="button" aria-label="Copy import"><svg class="icon" aria-hidden="true"><use href="#i-copy"/></svg></button></div><span class="caption">Compact, with focus visible on Copy</span></div>
|
|
@@ -1321,6 +1358,7 @@
|
|
|
1321
1358
|
<section class="component" id="command-plate" data-layer="Identity" aria-labelledby="cmd-title">
|
|
1322
1359
|
<header><h3 id="cmd-title">Command plate</h3><span class="badge">Identity</span><a href="components.md#command-plate">Spec</a><button class="quiet-action copy-link" type="button" data-copy-link="command-plate" aria-label="Copy link to Command plate" title="Copy link"><svg class="icon" aria-hidden="true"><use href="#i-link"/></svg></button></header>
|
|
1323
1360
|
<p class="purpose">A shell command on a hue-tinted plate.</p>
|
|
1361
|
+
<dl class="guidance"><dt>Do</dt><dd>Use it for a shell command the reader runs, one command per line.</dd><dt>Don’t</dt><dd>A <code>$</code> typed into the command. CSS draws the prompt; a typed one is copied with the command.</dd></dl>
|
|
1324
1362
|
<div class="row"><h4>Commands</h4><div class="states">
|
|
1325
1363
|
<div class="state wide"><div class="code command compact"><pre tabindex="0" role="region" aria-label="Install command"><code id="cmd-install"><span class="line"><span>brew install filipgutica/tap/filip-stack</span></span></code></pre><button class="quiet-action copy" type="button" data-copy="cmd-install" aria-label="Copy install command"><svg class="icon" aria-hidden="true"><use href="#i-copy"/></svg></button></div><span class="caption">Compact, live; the <code>$</code> is drawn by CSS</span></div>
|
|
1326
1364
|
<div class="state wide"><div class="code command"><div class="code-head"><b>Set up</b><button class="quiet-action copy" type="button" data-copy="cmd-setup"><svg class="icon" aria-hidden="true"><use href="#i-copy"/></svg>Copy</button></div><pre tabindex="0" role="region" aria-label="Set up commands"><code id="cmd-setup"><span class="line"><span>pnpm install --frozen-lockfile</span></span><span class="line"><span>pnpm check</span></span></code></pre></div><span class="caption">With a header, two lines</span></div>
|
|
@@ -1331,6 +1369,7 @@
|
|
|
1331
1369
|
<section class="component" id="terminal-capture" data-layer="Identity" aria-labelledby="capture-title">
|
|
1332
1370
|
<header><h3 id="capture-title">Terminal capture</h3><span class="badge">Identity</span><a href="components.md#terminal-capture">Spec</a><button class="quiet-action copy-link" type="button" data-copy-link="terminal-capture" aria-label="Copy link to Terminal capture" title="Copy link"><svg class="icon" aria-hidden="true"><use href="#i-link"/></svg></button></header>
|
|
1333
1371
|
<p class="purpose">A recorded terminal screen with a status line.</p>
|
|
1372
|
+
<dl class="guidance"><dt>Do</dt><dd>Use it to show what a command prints, one tab per capture, with the path and branch in the status line.</dd><dt>Don’t</dt><dd>A capture for a screenshot of a graphical app. Use a figure.</dd></dl>
|
|
1334
1373
|
<div class="capture" data-tabs data-label="Captures">
|
|
1335
1374
|
<!-- The script adds the tab list and the Full size button; without it every capture is listed. -->
|
|
1336
1375
|
<div class="capture-head" hidden><button class="quiet-action full" type="button" data-full-size><svg class="icon" aria-hidden="true"><use href="#i-expand"/></svg>Full size</button></div>
|
|
@@ -1343,6 +1382,7 @@
|
|
|
1343
1382
|
<section class="component" id="site-header" data-layer="Identity" aria-labelledby="header-title">
|
|
1344
1383
|
<header><h3 id="header-title">Site header</h3><span class="badge">Identity</span><a href="components.md#site-header">Spec</a><button class="quiet-action copy-link" type="button" data-copy-link="site-header" aria-label="Copy link to Site header" title="Copy link"><svg class="icon" aria-hidden="true"><use href="#i-link"/></svg></button></header>
|
|
1345
1384
|
<p class="purpose">The ~/name header with project switcher and appearance.</p>
|
|
1385
|
+
<dl class="guidance"><dt>Do</dt><dd>Keep the same header and site links, six at most and in one order, on every page of a personal product site.</dd><dt>Don’t</dt><dd>The site header on an application screen. An application keeps its own navigation.</dd></dl>
|
|
1346
1386
|
<div class="row"><h4>Closed</h4><div class="states">
|
|
1347
1387
|
<div class="state wide"><div class="site-header">
|
|
1348
1388
|
<details class="projects"><summary class="quiet-action" aria-label="Project: filip-stack"><span>filip-stack</span><svg class="icon" aria-hidden="true"><use href="#i-chevron-down"/></svg></summary><nav class="navlist" aria-label="Projects"><a href="#site-header">annoterm</a><a href="components.html" aria-current="page">filip-stack</a><a href="#site-header">ui</a></nav></details>
|
|
@@ -1359,6 +1399,7 @@
|
|
|
1359
1399
|
<section class="component" id="page-type-and-helpers" data-layer="Identity" aria-labelledby="page-type-title">
|
|
1360
1400
|
<header><h3 id="page-type-title">Page type and helpers</h3><span class="badge">Identity</span><a href="components.md#page-type-and-helpers">Spec</a><button class="quiet-action copy-link" type="button" data-copy-link="page-type-and-helpers" aria-label="Copy link to Page type and helpers" title="Copy link"><svg class="icon" aria-hidden="true"><use href="#i-link"/></svg></button></header>
|
|
1361
1401
|
<p class="purpose">Mono headings, steps, definitions, facts, and the footer.</p>
|
|
1402
|
+
<dl class="guidance"><dt>Do</dt><dd>Use steps for a sequence the reader follows in order, definitions for terms with short meanings, and facts for short labels and values.</dd><dt>Don’t</dt><dd>The <code>##</code> mark on an application screen, or on h3 and lower.</dd></dl>
|
|
1362
1403
|
<div class="row"><h4>Headings</h4><div class="states">
|
|
1363
1404
|
<div class="state wide"><p class="folio-display">~/annoterm</p><span class="caption">Display title, mono</span></div>
|
|
1364
1405
|
<div class="state wide"><p class="folio-h2">Install</p><span class="caption">Section heading with its <code>##</code> mark</span></div>
|
|
@@ -1490,7 +1531,12 @@
|
|
|
1490
1531
|
document.querySelectorAll('[data-live-toggle]').forEach((t) => t.addEventListener('click', () => t.setAttribute('aria-pressed', String(t.getAttribute('aria-pressed') !== 'true'))));
|
|
1491
1532
|
|
|
1492
1533
|
// Slider fill follows the value.
|
|
1493
|
-
|
|
1534
|
+
// A live slider moves its range fill and its visible value together, from the keyboard or the pointer.
|
|
1535
|
+
document.querySelectorAll('[data-live-range]').forEach((r) => r.addEventListener('input', () => {
|
|
1536
|
+
r.style.setProperty('--value', `${r.value}%`);
|
|
1537
|
+
const value = document.querySelector(`output[for="${r.id}"]`);
|
|
1538
|
+
if (value) value.value = `${r.value}%`;
|
|
1539
|
+
}));
|
|
1494
1540
|
|
|
1495
1541
|
// A list that scrolls sideways names its clipped ends in data-clip, so CSS fades only those edges.
|
|
1496
1542
|
const trackClip = (list) => {
|
package/language/components.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
One section for each component in the design language. Write any framework's version of a component from its section. [`components.html`](components.html) shows each state as static markup, and [`tokens.css`](tokens.css) holds the values. The [decisions](decisions.md) record why each choice was made. `@filipgutica/ui` is the Vue implementation; the `ui:` line in each section names its component, for comparison only.
|
|
4
4
|
|
|
5
|
-
Each section has
|
|
5
|
+
Each section has these parts: anatomy, states, then Do and Don't, keyboard and screen reader, motion, and forced colors. A part that does not apply says "None", with the reason. Do names the choice to make, and Don't names the mistake to avoid; neither repeats the spec. A section may add tokens and parts of its own. Sizes are in CSS pixels at the default 16px root font size. Type, spacing, and control sizes are set in rem (pixels ÷ 16), so they follow the reader's font-size setting; borders, focus rings, and shadows stay in pixels. A percentage mix means `color-mix(in srgb, A n%, B)`.
|
|
6
6
|
|
|
7
7
|
## Layers
|
|
8
8
|
|
|
@@ -58,8 +58,9 @@ Layer: Core. ui: `UiButton`.
|
|
|
58
58
|
| Text | Transparent, `--color-link`, underlined, 4px padding | No change | No change |
|
|
59
59
|
|
|
60
60
|
- **States.** Rest, hover, pressed, focus-visible, disabled, and busy. Pressed also moves the button 1px down, for every variant but text, and applies to `aria-pressed="true"`. Busy sets `aria-busy="true"` and `disabled`, so the button takes no hover or press, with `cursor: wait`. It shows a 14px spinner before the label: a 2px `currentColor` ring with a transparent right edge, turning once every 700ms. Keep the label while busy.
|
|
61
|
+
- **Do.** One primary button in each decision group, labelled with a verb for its result, such as "Save changes". Every other action in the group is secondary, ghost, or text.
|
|
62
|
+
- **Don't.** The danger variant on an action the reader can undo. Danger marks an action that destroys something.
|
|
61
63
|
- **Danger label.** Check the label at 4.5:1 on the rest, hover, and pressed fills. Where the mix misses, use the first of `--color-text`, black, and white that reads on all three.
|
|
62
|
-
- **Use.** One primary action for each decision group. The hue fill marks that action; every other action is secondary, ghost, or text.
|
|
63
64
|
- **Keyboard and screen reader.** Native button behavior: Enter and Space activate it. An icon-only button needs `aria-label`.
|
|
64
65
|
- **Motion.** Fill and shadow transition over `--duration-fast`. Reduced motion slows the spinner to 1.4s instead of stopping it, so the busy state stays visible. The `tokens.css` base holds that exception.
|
|
65
66
|
- **Forced colors.** The transparent border draws as the system button edge.
|
|
@@ -68,9 +69,10 @@ Layer: Core. ui: `UiButton`.
|
|
|
68
69
|
|
|
69
70
|
Layer: Core. ui: the `fg-quiet-action` class.
|
|
70
71
|
|
|
71
|
-
- **Use.** An icon or short text action inside a component: code block and command list Copy, capture Full size, dialog and drawer close, and the project trigger. Use a [button](#button) for an action that stands on its own.
|
|
72
72
|
- **Anatomy.** A native `<button>`, or the `<summary>` of a menu. Transparent fill, a transparent 1px border, `--radius-control`, and `--color-muted`. The content is centred in the box. An icon-only action holds an SVG icon, never a text glyph such as ×, because a font draws a glyph's ink off the centre of its box. Give the shared recipe zero specificity (`:where()`), so each component sets the action's size, place, and resting colour.
|
|
73
73
|
- **States.** Hover turns the text `--color-text` and fills `currentColor` at 12% over transparent. Pressed fills `currentColor` at 18%, with no sink. Focus-visible is the focus ring, inset where the parent clips. An open menu keeps its trigger at the 12% tint, below the press. The code block's Copy keeps the block's text colour on hover. A disabled quiet action follows the shared [disabled](#rules-for-every-control) rule.
|
|
74
|
+
- **Do.** Use it for an action inside a component: Copy in a code block or command list, close in a dialog or drawer, Full size on a capture, and the project trigger.
|
|
75
|
+
- **Don't.** An action that stands on its own in the page, such as Save or Next. That is a button.
|
|
74
76
|
- **Keyboard and screen reader.** Native button behavior. An icon-only action needs `aria-label`.
|
|
75
77
|
- **Motion.** Fill and colour change over `--duration-fast` with `--ease-out`.
|
|
76
78
|
- **Forced colors.** The transparent border draws as the system edge.
|
|
@@ -82,7 +84,10 @@ Layer: Core. ui: `UiCheckbox`. ui has no standalone radio; radio cards cover rad
|
|
|
82
84
|
- **Anatomy.** A `<label>` around the box and its text, with a gap of about 9px. The box is 16px at `sm`, 18px at `md`, and 20px at `lg`. Checkbox corners are `--radius-inline`; a radio is round. The row is at least the control height of its size, and the label takes that size's text: `--text-sm` at `sm`, `--text-md` at `md`, and `--text-lg` at `lg`.
|
|
83
85
|
- **Tokens.** Unchecked: `--color-surface-raised` fill and a 1px `--color-border` edge. Checked: `--color-accent` fill and edge, with a check mark in `--color-accent-text`. A checked radio shows a 5px `--color-accent` ring around a `--color-surface-raised` centre.
|
|
84
86
|
- **States.** Rest, checked, focus-visible (the focus ring on the box), and disabled.
|
|
87
|
+
- **Do.** Checkboxes for options the reader can pick in any combination. Radios for one choice from a short list that stays in view.
|
|
88
|
+
- **Don't.** A label written as a question, such as "Send updates?", or as a negative, such as "Don't email me". Name the option: "Email me updates".
|
|
85
89
|
- **Keyboard and screen reader.** Native `<input type="checkbox">` or `type="radio"`. Space toggles a checkbox. Arrow keys move between radios in a named `radiogroup` or `<fieldset>`.
|
|
90
|
+
- **Motion.** None: the box fills and the mark appears at once, as a native input's do.
|
|
86
91
|
- **Forced colors.** Native inputs keep system colors. A custom-drawn box redraws in `Highlight` when checked.
|
|
87
92
|
|
|
88
93
|
## Radio card group
|
|
@@ -92,6 +97,8 @@ Layer: Core. ui: `UiRadioCardGroup`, `UiRadioCard`.
|
|
|
92
97
|
- **Anatomy.** A grid of cards (`repeat(auto-fit, minmax(160px, 1fr))`, `--space-3` gap). Each card is a `<label>` with a title, an optional muted description, and a 16px round indicator in the top right corner. The native radio stays inside the card.
|
|
93
98
|
- **Tokens.** Unselected: `--color-surface-raised`, `--shadow-raise`, transparent border, `--radius-panel`, `--space-3` padding. Hover: `--color-surface-muted` 45% into `--color-surface-raised`. Selected: `--color-well` fill and `--shadow-sink`, with the indicator filled `--color-accent` and an `--color-accent-text` check. The selected card has no accent ring.
|
|
94
99
|
- **States.** Rest, hover, selected, focus-visible (the focus ring over the card's raise or sink), and disabled.
|
|
100
|
+
- **Do.** Use radio cards when the reader chooses by a description, such as plans or deploy modes. Give each card a title and one line on what differs.
|
|
101
|
+
- **Don't.** Radio cards for options that a title alone explains. Use radios.
|
|
95
102
|
- **Keyboard and screen reader.** One Tab stop for the group; arrow keys change the selection. Name the group.
|
|
96
103
|
- **Motion.** The fill changes over `--duration-fast` with `--ease-out`.
|
|
97
104
|
- **Forced colors.** The selected indicator uses `Highlight` with `HighlightText`.
|
|
@@ -103,6 +110,8 @@ Layer: Core. ui: `UiSwitch`.
|
|
|
103
110
|
- **Anatomy.** A `<button role="switch" aria-checked>` that contains the track, and a separate `<label for>` with an optional description. The button's hit area is at least 32px wide and the control height tall. The track is 44×22 with a pill radius; the knob is 18px, inset 2px. `sm` scales both by 0.8 and `lg` by 1.2.
|
|
104
111
|
- **Tokens.** Off track: `--color-border` 90% into `--color-well`, `--shadow-sink`, transparent 1px border. Knob: `--color-surface-raised` with `--shadow-raise`. On: `--color-accent` track, `--color-accent-text` knob moved 22px to the right.
|
|
105
112
|
- **States.** Off, on, focus-visible (the focus ring goes on the track, not the hit area), and disabled.
|
|
113
|
+
- **Do.** Use a switch for a setting that applies the moment it changes. Its label names the setting, such as "Dark mode", and stays the same when on or off.
|
|
114
|
+
- **Don't.** A switch in a form that applies on submit. Use a checkbox there.
|
|
106
115
|
- **Keyboard and screen reader.** Space and Enter toggle it. The label names it; the description is linked with `aria-describedby`.
|
|
107
116
|
- **Motion.** The knob's transform and the track's fill change over `--duration` with `--ease-out`.
|
|
108
117
|
- **Forced colors.** Track: `ButtonText` edge on `Canvas`, with a `ButtonText` knob. On: `Highlight` track with a `HighlightText` knob.
|
|
@@ -113,6 +122,8 @@ Layer: Core. ui: `UiToggleButton`.
|
|
|
113
122
|
|
|
114
123
|
- **Anatomy.** A `<button aria-pressed>` with a switch track at the start, then a label and an optional `--text-xs` muted description. `--radius-field` corners (a labelled card, so wrapped labels sit square), `--space-2` `--space-3` padding, `--color-surface-raised` fill, a 1px `--color-border-subtle` edge, and no shadow. The visible edge and the missing raise are a named exception; see [decisions](decisions.md).
|
|
115
124
|
- **States.** Rest, hover (`--color-border` edge), pressed (the track turns on as in the switch and carries the state; the card takes `--color-accent` at 8% over `--color-surface-raised` and a hairline of `--color-accent` at 35%), focus-visible, and disabled.
|
|
125
|
+
- **Do.** Use it for an on or off option whose label sits inside the control, such as "Wrap lines" in a viewer's toolbar.
|
|
126
|
+
- **Don't.** A toggle button for an action that runs once, such as Refresh. It stays on until pressed again; an action is a button.
|
|
116
127
|
- **Keyboard and screen reader.** A native button; Space and Enter toggle `aria-pressed`.
|
|
117
128
|
- **Motion.** The card's fill and edge change over `--duration-fast` with `--ease-out`; the track moves as the switch does.
|
|
118
129
|
- **Forced colors.** As for the switch track.
|
|
@@ -121,10 +132,11 @@ Layer: Core. ui: `UiToggleButton`.
|
|
|
121
132
|
|
|
122
133
|
Layer: Core. ui: `UiSegmentedControl`.
|
|
123
134
|
|
|
124
|
-
- **Use.** Two to five short options that apply at once, such as a view mode or the System, Light, and Dark appearance choice. Use a select for longer lists and radio cards for options that need descriptions.
|
|
125
135
|
- **Anatomy.** A `role="group"` with an accessible name, containing one `<button aria-pressed>` for each option. The track is undivided: `--color-well` fill, `--shadow-sink`, a transparent 1px border, and `--radius-control`. Each button is the full control height (`--item`) with `--space-3` padding, and square when icon-only. At tablet width an unsized control sets `--item` to `--control-lg`, so its buttons grow to the touch size and icon-only options stay square. Its thumb is a `::before` layer inset 2px inside the button, behind the label.
|
|
126
136
|
- **Tokens.** Labels are `--color-muted`. The pressed option's thumb is `--color-control-thumb` with `--shadow-raise` and no ring. Its label is `--color-segmented-current-text`: `--color-accent` where it reaches 4.5:1 on the thumb, on the page and on a surface, and otherwise the first of `--color-text`, black, and white that does. An icon-only option needs 3:1. Hover on an unpressed option shows the thumb at 45% and turns the label `--color-text`.
|
|
127
137
|
- **States.** Rest, hover, pressed, focus-visible (an inset ring, so it hugs the thumb instead of crossing into the next option), and disabled.
|
|
138
|
+
- **Do.** Use it for two to five short options that apply at once and change how the same content shows, such as a view mode or the System, Light, and Dark choice.
|
|
139
|
+
- **Don't.** A segmented control that switches between panels of content. Use tabs.
|
|
128
140
|
- **Keyboard and screen reader.** Each option is its own Tab stop; Space and Enter press it. Icon-only options use the label as `aria-label` and `title`.
|
|
129
141
|
- **Motion.** Hover fades the label colour over `--duration-fast` with `--ease-out`. When the reader changes the choice, one thumb glides from the old option to the new one. Start the new thumb's left and right edges where the old thumb was, then animate each edge home with CSS `ease`. The leading edge takes 260ms and the trailing edge 300ms, so the thumb stretches a little on the way. Labels cross-fade their colour over 260ms. If a glide is cut short, start the next one from the thumb's current position. There is no motion on first render, on a value restored from storage, or on a theme change: allow glides only after the first frame. Reduced motion moves the thumb at once.
|
|
130
142
|
- **Forced colors.** The pressed option draws `Highlight` behind `HighlightText`. Its focus ring is `CanvasText`: the option opts out of adjustment, and the ring sits on the track.
|
|
@@ -136,8 +148,10 @@ Layer: Core. ui: `UiInput`. ui has no textarea; a textarea uses the same field r
|
|
|
136
148
|
- **Anatomy.** A native `<input>` or `<textarea>`. Full width, line height 1.35. Input heights follow the control size, and horizontal padding is about 9px, 10px, or 11px.
|
|
137
149
|
- **Tokens.** Fill `--color-field-bg` (`--color-surface-raised` in light, the sunk `--color-well` well in dark), text `--color-text`, placeholder `--color-muted` at full opacity, corners `--radius-field`, border 1px `--color-field-edge` (`--color-border-subtle`), shadow `--shadow-field` (none in light, `--shadow-sink` in dark).
|
|
138
150
|
- **States.** Rest, focus-visible (the accent edge and inset line from [field focus](#rules-for-every-control)), disabled (the `--color-well` well, no shadow), invalid (`--color-error` border), and invalid while focused (`--color-error` border and a `--color-error` inset line). A textarea keeps the same padding at the top and bottom as at the sides, and resizes vertically only.
|
|
151
|
+
- **Do.** A textarea for an answer longer than one line, and `type="search"` for a field that filters.
|
|
152
|
+
- **Don't.** A label or an instruction that lives only in the placeholder. It disappears as the reader types.
|
|
139
153
|
- **Keyboard and screen reader.** Each field has a visible `<label>`. A search field is the one exception: its leading magnifier and an accessible name that names the search (`aria-label`, or a visually hidden `<label>`) stand in for the visible label. A field inside a [field wrapper](#field-wrapper) gets its description and error ids from it.
|
|
140
|
-
- **Motion.** None.
|
|
154
|
+
- **Motion.** None: the focus and invalid edges change at once, so a state shows as soon as it applies.
|
|
141
155
|
- **Search.** `type="search"` keeps the native clear button, quieted to a 12px cross drawn with a `mask` (1.5px round strokes) and filled `--color-muted`, with `--space-2` before it. Hover fills it `--color-text`. The cross sits at the input's trailing edge, so inside a field wrapper with an icon or key hint the input takes the free space (`flex: 1`, `min-width: 0`) and the wrapper carries the width. The wrapper carries the field fill, edge, shadow, and focus, so the input inside it draws nothing. In forced colors the cross opts out of adjustment and fills `CanvasText`, so the mask keeps a visible fill.
|
|
142
156
|
- **Forced colors.** The border draws as the system field edge. The inset line drops, so a focused field draws a `Highlight` outline just inside its edge. The system edge replaces the `--color-error` edge, so the invalid state relies on its error text there; see [known gaps](decisions.md#known-gaps).
|
|
143
157
|
|
|
@@ -148,8 +162,10 @@ Layer: Core. ui: `UiSelect`.
|
|
|
148
162
|
- **Anatomy.** A native `<select>` with the input's field recipe and a chevron on the right. Draw the chevron in `currentColor`, or with an 8px border corner in `--color-muted` turned 45°. Right padding leaves room for it at every size.
|
|
149
163
|
- **Picker.** Where `appearance: base-select` is supported, the open list is a floating layer: `--color-surface-raised`, a transparent 1px border, `--radius-panel`, `--shadow-dialog`, 4px padding, at least the select's width, and at most `min(20rem, 50dvh)` tall. Options are at least 32px tall (44px on coarse pointers), with `--space-2` `--space-3` padding and corners of `--radius-panel` minus 4px. Hover fills `--color-row-hover`. An `--color-accent` check at the end marks the checked option. The check carries the state: the option's `--color-row-selected` fill equals `--color-surface-raised`. Keyboard focus is the focus ring, inset because the list scrolls. Other browsers keep the native picker.
|
|
150
164
|
- **States.** Rest, focus-visible, disabled, invalid, and invalid while focused, as for the input.
|
|
165
|
+
- **Do.** Use a select for one choice from more than five options, in a predictable order: alphabetical, numeric, or by frequency of use.
|
|
166
|
+
- **Don't.** A first option that acts as the label, such as "Choose a region". The label goes above the field.
|
|
151
167
|
- **Keyboard and screen reader.** Native select behavior. A visible `<label>`.
|
|
152
|
-
- **Motion.** None.
|
|
168
|
+
- **Motion.** None: as for the input, and the picker opens at once.
|
|
153
169
|
- **Forced colors.** The closed field as for the input, including the `Highlight` focus outline. The picker is native.
|
|
154
170
|
|
|
155
171
|
## Field wrapper
|
|
@@ -159,15 +175,22 @@ Layer: Core. ui: `UiField`.
|
|
|
159
175
|
- **Anatomy.** A grid with a 6px gap: label, control, then a description or an error. The error replaces the description.
|
|
160
176
|
- **Tokens.** Label `--text-sm` semibold `--color-text`. Description `--text-sm` `--color-muted`. Error `--text-sm` `--color-error`.
|
|
161
177
|
- **States.** Rest, and invalid: the error replaces the description, and the control takes its own invalid state.
|
|
178
|
+
- **Do.** Write the error as the fix, such as "Enter a date after today", and the description as a format or limit, such as "Up to 64 characters".
|
|
179
|
+
- **Don't.** A description that repeats the label, or an error that only says "Invalid".
|
|
162
180
|
- **Keyboard and screen reader.** The label's `for` names the control. The control points `aria-describedby` at the description, and `aria-errormessage` at the error with `aria-invalid="true"`.
|
|
181
|
+
- **Motion.** None: the error replaces the description at once, so it is never half shown.
|
|
182
|
+
- **Forced colors.** The label, description, and error all take the system text colour, so the error's words must say what is wrong.
|
|
163
183
|
|
|
164
184
|
## Slider
|
|
165
185
|
|
|
166
186
|
Layer: Core. ui: `UiSlider`.
|
|
167
187
|
|
|
168
|
-
- **Anatomy.** A 6px track with `--radius-inline` and `--color-surface-muted`, an `--color-accent` range, and a round thumb (16px, 18px, or 20px) with a 2px `--color-accent` edge and a `--color-surface-raised` fill.
|
|
188
|
+
- **Anatomy.** A 6px track with `--radius-inline` and `--color-surface-muted`, an `--color-accent` range, and a round thumb (16px, 18px, or 20px) with a 2px `--color-accent` edge and a `--color-surface-raised` fill. The current value follows the track as `--text-sm` text in tabular numbers, in an `<output>` whose `for` names the slider.
|
|
169
189
|
- **States.** Rest, dragging (`cursor: grabbing`), focus-visible on the thumb, and disabled.
|
|
170
|
-
- **
|
|
190
|
+
- **Do.** Use a slider for an approximate value in a range, such as volume or opacity, and show the current value as text beside it.
|
|
191
|
+
- **Don't.** A slider for a value the reader must set exactly, such as a port or a price. Use a text input.
|
|
192
|
+
- **Keyboard and screen reader.** The thumb has `role="slider"`, `aria-valuemin`, `aria-valuemax`, `aria-valuenow`, and a name. Arrow keys step; Home and End jump to the ends. A native `<input type="range">` styled to match is acceptable. The `<output>` sets `aria-live="off"`, because the slider already announces its value.
|
|
193
|
+
- **Motion.** None: the thumb and the range follow the pointer or the arrow keys at once.
|
|
171
194
|
- **Forced colors.** The range redraws in `Highlight` with `forced-color-adjust: none`. The thumb keeps the system colours.
|
|
172
195
|
|
|
173
196
|
## Progress
|
|
@@ -175,6 +198,9 @@ Layer: Core. ui: `UiSlider`.
|
|
|
175
198
|
Layer: Core. ui: `UiProgress`.
|
|
176
199
|
|
|
177
200
|
- **Anatomy.** A track about 9px tall with a 1px `--color-border-subtle` edge, `--radius-inline`, and `--color-surface-muted`, holding an `--color-accent` indicator moved with `translateX`.
|
|
201
|
+
- **States.** None: a progress bar takes no input, so it has no interaction states. Its value follows `aria-valuenow`.
|
|
202
|
+
- **Do.** Use it for a task with a known end, such as an import, and name it for the task.
|
|
203
|
+
- **Don't.** A progress bar for a measured value, such as disk usage or a rating. It shows a task moving to its end; use text or a score.
|
|
178
204
|
- **Keyboard and screen reader.** `role="progressbar"` with a name and `aria-valuenow`, or a native `<progress>`.
|
|
179
205
|
- **Motion.** The indicator's transform moves over `--duration-fast` with `--ease-out`.
|
|
180
206
|
- **Forced colors.** The indicator redraws in `Highlight` with `forced-color-adjust: none`.
|
|
@@ -184,7 +210,11 @@ Layer: Core. ui: `UiProgress`.
|
|
|
184
210
|
Layer: Core. ui: `UiScore`.
|
|
185
211
|
|
|
186
212
|
- **Anatomy.** A row of 8px pips with 3px gaps, then the value in medium weight and `/max` in muted regular weight, in tabular numbers. Empty pips have a 1px `--color-border` edge; filled pips are `--color-accent`.
|
|
213
|
+
- **States.** None: a score is static, so it has no interaction states.
|
|
214
|
+
- **Do.** Use it for a value out of a fixed maximum, such as 4/5, and keep one maximum across a list so the rows compare.
|
|
215
|
+
- **Don't.** A score for a percentage or an open-ended count. Write the number as text.
|
|
187
216
|
- **Keyboard and screen reader.** The pips are `aria-hidden`; the text value carries the score.
|
|
217
|
+
- **Motion.** None: a score is static.
|
|
188
218
|
- **Forced colors.** Filled pips redraw in `Highlight` with `forced-color-adjust: none`.
|
|
189
219
|
|
|
190
220
|
## Badge
|
|
@@ -193,7 +223,12 @@ Layer: Core. ui: `UiBadge`.
|
|
|
193
223
|
|
|
194
224
|
- **Anatomy.** An inline pill: `--radius-pill`, about 3px by 9px padding, `--text-xs`, medium weight, and a transparent 1px border.
|
|
195
225
|
- **Tokens.** Neutral: `--color-surface-muted` fill, `--color-muted`, no dot. Status tones (success, warning, danger, info): the tone at 22% over `--color-surface-raised`, text of the tone mixed 75% with `--color-text` in light and 85% in dark, and a leading 6px dot in `currentColor`.
|
|
226
|
+
- **States.** None: a badge is static text. Its tone is a variant, not a state.
|
|
227
|
+
- **Do.** A one- or two-word status or category on an item, such as "Healthy" or "Beta", with a status tone only when it is a status.
|
|
228
|
+
- **Don't.** A badge that repeats the title, or one on every row with the same value. Badge the exceptions.
|
|
196
229
|
- **Keyboard and screen reader.** Static text; the label carries the meaning, never the colour alone.
|
|
230
|
+
- **Motion.** None: a badge is static.
|
|
231
|
+
- **Forced colors.** Fills drop and the transparent border draws as the system edge, so each badge reads as an outlined label. The tone dot drops with the fill, so the label carries the status; see [known gaps](decisions.md#known-gaps).
|
|
197
232
|
|
|
198
233
|
## Alert
|
|
199
234
|
|
|
@@ -201,20 +236,36 @@ Layer: Core. ui: `UiAlert`.
|
|
|
201
236
|
|
|
202
237
|
- **Anatomy.** An optional 16px icon and short text. `--space-3` `--space-4` padding, `--radius-panel`, and a transparent 1px border.
|
|
203
238
|
- **Tokens.** Neutral: `--color-surface`. Status tones use their `--color-*-surface` tint with `--color-text`; the icon takes the status colour.
|
|
239
|
+
- **States.** None: an alert is static content. Its tone is a variant, not a state.
|
|
240
|
+
- **Do.** Use an alert for a caveat or status message the reader needs before acting. When action is needed, name it, such as "Reconnect the source to resume sync".
|
|
241
|
+
- **Don't.** An alert for decoration or routine emphasis. A short status label is a badge; explanations and recovery instructions stay in an alert.
|
|
204
242
|
- **Keyboard and screen reader.** Static content. Use `role="status"` or `role="alert"` only for a message that appears while the reader works.
|
|
243
|
+
- **Motion.** None: an alert shows at once, with no entrance animation.
|
|
244
|
+
- **Forced colors.** Fills drop and the transparent border draws as the system edge. The icon keeps its status colour, and the text carries the message; see [known gaps](decisions.md#known-gaps).
|
|
205
245
|
|
|
206
246
|
## Surface and card
|
|
207
247
|
|
|
208
248
|
Layer: Core. ui: `UiSurface`, `UiCard`.
|
|
209
249
|
|
|
210
250
|
- **Anatomy.** A panel: `--color-surface-raised`, transparent 1px border, `--radius-panel`, and `--shadow-surface`. A card adds a header (title in `--text-md` medium weight, with actions at the end), a body, and an optional footer above a `--color-border-subtle` rule in `--text-sm` muted text. Header and body padding is `--space-4`; padding is compact (`--space-3`) or default (`--space-4`).
|
|
211
|
-
- **
|
|
251
|
+
- **States.** None: a panel is static. Controls inside it keep their own states.
|
|
252
|
+
- **Do.** Use cards for a few parallel, self-contained items that a reader compares, such as plans or projects.
|
|
253
|
+
- **Don't.** A panel inside a panel, or cards around ordinary prose.
|
|
254
|
+
- **Keyboard and screen reader.** A card's title is a heading at the next level of the page outline.
|
|
255
|
+
- **Motion.** None: panels do not lift on hover or animate in.
|
|
256
|
+
- **Forced colors.** The shadow drops and the transparent border draws as the system edge, so each panel keeps its outline.
|
|
212
257
|
|
|
213
258
|
## Figure
|
|
214
259
|
|
|
215
260
|
Layer: Core. ui: `UiFigure`.
|
|
216
261
|
|
|
217
262
|
- **Anatomy.** A well (`--color-surface`, 1px `--color-border-subtle`, `--radius-panel`, `--space-5` padding, or `--space-4` on phones) with a caption below it in `--text-sm` muted text. Wide content scrolls inside the well. A figure number is `--color-text` in medium weight.
|
|
263
|
+
- **States.** None: a figure is static.
|
|
264
|
+
- **Do.** Caption every figure with what it shows. When the prose refers to one figure by number, number them all.
|
|
265
|
+
- **Don't.** A screenshot of code or of a component. Show code as text, so the reader can copy it, and a component live.
|
|
266
|
+
- **Keyboard and screen reader.** A `<figure>` with a `<figcaption>`, so the caption names the figure.
|
|
267
|
+
- **Motion.** None: a figure is static.
|
|
268
|
+
- **Forced colors.** The well's fill drops, and its edge draws in the system colour.
|
|
218
269
|
- **Identity.** On folio sites the caption is mono.
|
|
219
270
|
|
|
220
271
|
## Dialog
|
|
@@ -223,8 +274,12 @@ Layer: Core. ui: `UiDialog`.
|
|
|
223
274
|
|
|
224
275
|
- **Anatomy.** A floating layer centred on an `--color-overlay` backdrop, at most 512px wide and 672px tall. It has a header (title in 18px semibold with an optional muted description, and a 44px close button), a body that scrolls, and an optional footer on `--color-surface` with its actions at the end. Rules between the parts are `--color-border-subtle`. On phones it becomes a bottom sheet with rounded top corners.
|
|
225
276
|
- **Tokens.** `--color-surface-raised`, a transparent 1px border, `--radius-panel`, `--shadow-dialog`. The close button is a [quiet action](#quiet-action).
|
|
277
|
+
- **States.** Closed and open. When focus lands on the dialog itself, it shows the focus ring.
|
|
278
|
+
- **Do.** Use a dialog for a short task the reader must finish or cancel before the page continues, such as confirming a deletion. Title it with that task.
|
|
279
|
+
- **Don't.** A dialog that opens without the reader asking, such as on page load, or one that holds a long form. A long form gets its own page.
|
|
226
280
|
- **Keyboard and screen reader.** `role="dialog"`, `aria-modal="true"`, named by its title. Focus moves in on open and is trapped. Escape closes it, and focus returns to the trigger. A native `<dialog>` opened with `showModal()` provides most of this.
|
|
227
|
-
- **Motion.** None
|
|
281
|
+
- **Motion.** None: it opens and closes at once. Only the drawer slides, because it enters from an edge.
|
|
282
|
+
- **Forced colors.** The shadow drops and the transparent border draws as the system edge, so the dialog keeps its outline over the page.
|
|
228
283
|
|
|
229
284
|
## Drawer
|
|
230
285
|
|
|
@@ -232,9 +287,13 @@ Layer: Core. ui: `UiDrawer`.
|
|
|
232
287
|
|
|
233
288
|
- **Anatomy.** A dialog fixed to the left edge, full height, `min(--sidebar + 48px, 100vw - 48px)` wide, with a header (title and close button) and a body that scrolls on its own. It is a floating layer with square corners: `--color-surface-raised`, a transparent 1px border, and `--shadow-dialog`. The close button is a [quiet action](#quiet-action).
|
|
234
289
|
- **Navigation drawer.** A drawer that holds navigation opens on the current row, scrolled to the centre of the body. A keyboard open moves focus to that row; a tap moves focus to the body, so no ring shows and no on-screen keyboard opens. An open from a Find button moves focus to the [find field](#find-field), which stays pinned at the top of the body while the list scrolls under it.
|
|
290
|
+
- **States.** Closed, open, and closing: `data-closing` keeps it open while it slides out.
|
|
291
|
+
- **Do.** Use a drawer for navigation or supporting detail that slides in from the side, such as the phone menu, and open it from a named button.
|
|
292
|
+
- **Don't.** The page's main task inside a drawer. The drawer holds navigation or detail; the task stays on the page.
|
|
235
293
|
- **Keyboard and screen reader.** As for the dialog. Following an in-page link inside the drawer closes it and moves focus to the link's destination (given `tabindex="-1"` if it is not focusable), not back to the trigger. Modified clicks (a new tab or window) leave it open.
|
|
236
294
|
- **Page behind.** While the drawer is open, until it has slid out, the page behind it does not scroll: the root takes `overflow: hidden`, which keeps the reader's position. The page reserves the scrollbar gutter all the time (`scrollbar-gutter: stable` on the root), so hiding a classic scrollbar does not reflow it.
|
|
237
295
|
- **Motion.** It slides in over `--duration` and out over `--duration-fast`, with `--ease-out`, while the overlay fades. Reduced motion shows and hides it at once.
|
|
296
|
+
- **Forced colors.** As for the dialog: the shadow drops and the edge draws in the system colour.
|
|
238
297
|
|
|
239
298
|
## Navigation list
|
|
240
299
|
|
|
@@ -243,6 +302,8 @@ Layer: Core. The mono font on rail rows is identity. ui: the rows in `UiSiteNav`
|
|
|
243
302
|
- **Anatomy.** A `<nav>` with a name, holding links in rows: at least `--row` tall (`--control-lg` at tablet width), `0 --space-3` padding, `--radius-inline` corners, `--text-sm`, and `--color-muted`. A row may hold a leading 16px icon and a trailing muted count. A text-only row centres its label on the cap height: where `text-box` is supported, it is a block with `align-content: center`, `--space-2` block padding, and `text-box: trim-both cap alphabetic`, and the location pip centres itself. The padding keeps a wrapped label's first and last lines clear of the fill's edges and the focus ring. Rows with an icon or a count, and browsers without `text-box`, centre the line box, which leaves a label without descenders about 1px above centre. Groups have a `--text-xs` semibold muted label and 2px gaps between rows.
|
|
244
303
|
- **Groups.** Name groups by purpose, with 2 to 8 rows each. Collapse groups only in a list of more than about 40 rows. A collapsible group's label is a `<button aria-expanded>` in the label type, with `--radius-inline` corners and a chevron that turns −90° when the group is closed. Never collapse the group that holds the current row.
|
|
245
304
|
- **States.** Hover: `--color-row-hover` fill and `--color-text`. Current page (`aria-current="page"`): `--color-nav-current` fill, `--shadow-nav-current`, `--color-nav-current-text`, and medium weight; hover keeps that fill. `--color-nav-current` is an accent tint: `--color-accent` at 14% over `--color-surface-raised` in light, and `--color-accent` at 20% over transparent in dark. `--color-nav-current-text` is the first of `--color-accent`, `--color-text`, black, and white that reaches 4.5:1 over the tinted fill, both on the page and on a surface (composite a translucent fill over each first). Selected tabs and selected list rows use the same fill and rule. Current location in the page (`aria-current="location"`): `--color-text` in medium weight, with a 3×14 `--color-accent` pip at the leading edge, inset 4px, and no fill, in strips and contents lists. In a [section rail](#section-rail) the current section takes the current-page look instead and keeps `aria-current="location"`. A link carries one marker, and page outranks location; the [`aria-current` rules](DESIGN.md#navigation) say which applies, and the [tracking rule](DESIGN.md#navigation) says which section is current. Focus-visible: the focus ring, inset because the rail and the drawer scroll.
|
|
305
|
+
- **Do.** Label a page link with the destination page's title, and an in-page link with its destination section's heading.
|
|
306
|
+
- **Don't.** Actions such as Delete or Sign out in a navigation list. Every row is a link to a place; an action is a button.
|
|
246
307
|
- **Phone triggers.** Two triggers open a navigation drawer, and each has its place. The site shell uses the header's icon-only Menu button: at tablet width its [section rail](#section-rail) moves into that drawer. A page-level contents drawer, such as a docs page's "On this page", keeps a labelled trigger: a secondary button at `--control-lg` with a three-line menu glyph (14×10, 1.5px lines) before the label. A page with the site shell's Menu does not add a second, labelled trigger. Without JavaScript the list opens in place, so the trigger is a `<details>` summary with the secondary button classes and a chevron after the label. Only the chevron is local.
|
|
247
308
|
- **Horizontal strip.** A row of 6 links or fewer; beyond that, use a drawer. It uses these rows and states unchanged: the current page takes the lifted fill, and a location keeps its pip. It scrolls sideways with 2px padding, so the current row's shadow stays whole, and a clipped edge fades over 24px, as [tabs](#tabs) do.
|
|
248
309
|
- **Keyboard and screen reader.** Plain links in Tab order.
|
|
@@ -254,9 +315,10 @@ Layer: Core. The mono font on rail rows is identity. ui: the rows in `UiSiteNav`
|
|
|
254
315
|
|
|
255
316
|
Layer: Core. ui: `UiSiteNav`.
|
|
256
317
|
|
|
257
|
-
- **
|
|
258
|
-
- **Anatomy.** A named `<aside>`, so the find field and the footer sit in a landmark, with `position: sticky; top: 0`, `height: 100dvh`, and a column flex layout with `--space-3` gaps. An optional [find field](#find-field) sits at the top. Below it, a named `<nav>` holds grouped [navigation list](#navigation-list) rows and scrolls on its own (`overflow-y: auto`, `overscroll-behavior: contain`). An optional footer for rail settings, such as the single-key shortcut switch, sits last, above a `--color-border-subtle` rule. The element that draws a divider never scrolls.
|
|
318
|
+
- **Anatomy.** A named `<aside>`, so the find field and the footer sit in a landmark, with `position: sticky; top: 0`, `height: 100dvh`, and a column flex layout with `--space-3` gaps. An optional [find field](#find-field) sits at the top. Below it, a named `<nav>` holds grouped [navigation list](#navigation-list) rows and scrolls on its own (`overflow-y: auto`, `overscroll-behavior: contain`). An optional footer for rail settings, such as the single-key shortcut switch, sits last, above a `--color-border-subtle` rule. The element that draws a divider never scrolls. The rail's rows follow the page order.
|
|
259
319
|
- **States.** Rows take the navigation list states. The current section keeps `aria-current="location"` but takes the current-page look: `--color-nav-current` fill, `--shadow-nav-current`, and `--color-nav-current-text` in medium weight, with no pip. When the location changes, the rail scrolls its own list, never the page, to centre the current row if it is out of view. It leaves the list alone while the pointer is over the rail or focus is inside it.
|
|
320
|
+
- **Do.** Use a rail for the sections of a long page, or for a site's pages. A site's pages may take a navigation strip of 6 links or fewer instead.
|
|
321
|
+
- **Don't.** A rail beside a strip or a contents list that holds the same links. Each level has one list.
|
|
260
322
|
- **Tablet and phone.** At `max-width: 800px`, with JavaScript, the page header becomes one sticky row on `--color-bg`: the site name or a back link, then two icon-only secondary buttons at `--control-lg`, Find (a search icon) and Menu (a menu icon). Menu opens a [drawer](#drawer) titled "Menu" that holds, in order, the find field, the site's pages, the appearance control, and the rail's groups. Find opens the same drawer with the field focused. Both buttons set a negative `scroll-margin-top` equal to the page's scroll offset, so focusing one does not scroll the page. Without JavaScript nothing moves: the header keeps its links, and the rail stays in place above `main` with every row shown and the find field hidden.
|
|
261
323
|
- **Keyboard and screen reader.** Both buttons have `aria-haspopup="dialog"` and an `aria-label` ("Find a component", "Menu"). Location changes are not announced. The current section follows the [location tracking rule](DESIGN.md#navigation).
|
|
262
324
|
- **Motion.** The rail scrolls its list at once. Rows change as in the navigation list.
|
|
@@ -266,41 +328,50 @@ Layer: Core. ui: `UiSiteNav`.
|
|
|
266
328
|
|
|
267
329
|
Layer: Core. ui: none yet.
|
|
268
330
|
|
|
269
|
-
- **Use.** Filter a long navigation list, such as a section rail, by name or purpose. It filters the list only, never the page, so deep links and the page order stay stable.
|
|
270
331
|
- **Anatomy.** An `<input type="search">` in the [field](#text-input-and-textarea) recipe, with a leading 16px search icon in `--color-muted` (32px start padding) and a trailing [keyboard key](#keyboard-key) hint showing `/` (36px end padding). A visually hidden `role="status"` element, named in the field's `aria-describedby`, holds the match count.
|
|
271
332
|
- **States.** Rest, focus-visible (field focus), and a query. The key hint hides while the field has focus or a value, when shortcuts are off, and under `(hover: none)`. With no matches, the list shows "No component matches <q>…</q>." in `--text-sm` `--color-muted`, and a text-button Clear.
|
|
272
|
-
- **
|
|
333
|
+
- **Do.** Use it at the top of a long navigation list, such as a section rail, to filter its rows by name or purpose.
|
|
334
|
+
- **Don't.** A find field used as a site-wide search. It matches only the rows of the list it filters.
|
|
335
|
+
- **Matching.** It filters the list only, never the page, so deep links and the page order stay stable. Every word of the query must appear in a row's terms: its name, group, purpose, and aliases, held in `data-terms`. Rows that do not match hide, and so do groups with no visible rows. The count is announced after a 500ms pause ("3 matches", "No matches"). A page whose Find also filters its own content, such as a token table, decides which rows stay and announces its own count and noun ("3 tokens", "No tokens").
|
|
273
336
|
- **Keyboard and screen reader.** `/` focuses the field and selects its text, under the [single-key shortcut](DESIGN.md#navigation) rules; the field carries `aria-keyshortcuts="/"` while shortcuts are on. Escape clears a value; the next Escape leaves the field, or closes the drawer. Enter goes to the first match and focuses the destination. ArrowDown moves focus to the first match.
|
|
337
|
+
- **Motion.** None: rows hide and show at once as the query changes.
|
|
338
|
+
- **Forced colors.** As for the search field. The key hint's edge is `CanvasText`.
|
|
274
339
|
- **No JavaScript.** The field is `hidden` until the script runs.
|
|
275
340
|
|
|
276
341
|
## Breadcrumbs
|
|
277
342
|
|
|
278
343
|
Layer: Core. ui: none yet.
|
|
279
344
|
|
|
280
|
-
- **Use.** Only at depth 3 or more, or for a page outside its site's shell. Do not repeat the page `h1` as the only crumb.
|
|
281
345
|
- **Anatomy.** `<nav aria-label="Breadcrumb">` holding an `<ol>` in `--text-sm`. Separators are a `--color-muted` `/` drawn with `content: "/" / ""`, so they are not read. The crumbs, separators included, centre on the cap height like navigation rows, so they line up with the header strip. Ancestors are `--color-muted` links with no underline, at least `--control-sm` tall (`--control-lg` at tablet width), with `--radius-inline` corners. The current page is plain text with `aria-current="page"`, in `--color-text` and medium weight. On folio sites the trail is mono (identity).
|
|
282
346
|
- **States.** Hover: `--color-text` and an underline. Focus-visible: the focus ring.
|
|
347
|
+
- **Do.** Use breadcrumbs only at depth 3 or more, or on a page outside its site's shell.
|
|
348
|
+
- **Don't.** A trail whose only crumb repeats the page's h1.
|
|
283
349
|
- **Phone.** At `max-width: 640px` only the parent shows, as a back link: "‹ Parent".
|
|
350
|
+
- **Keyboard and screen reader.** Ancestors are links in Tab order. The current page is text, so it takes no Tab stop.
|
|
351
|
+
- **Motion.** None: hover changes the colour and underline at once.
|
|
284
352
|
- **Forced colors.** No change: links and text take the system colours.
|
|
285
353
|
|
|
286
354
|
## Pager
|
|
287
355
|
|
|
288
356
|
Layer: Core. ui: none yet.
|
|
289
357
|
|
|
290
|
-
- **
|
|
291
|
-
- **Anatomy.** `<nav aria-label="…">` with two equal columns and a `--space-4` gap, below a `--color-border-subtle` rule with `--space-6` padding. Each link is a block row with `--space-3` `--space-4` padding, `--radius-field` corners, and a transparent 1px border: a `--text-xs` `--color-muted` direction with an arrow ("Previous", "Next"), then a medium `--color-text` title. Links take `rel="prev"` and `rel="next"`. Next sits in the end column, end-aligned, even when it is alone.
|
|
358
|
+
- **Anatomy.** `<nav aria-label="…">` at the end of `main`, with two equal columns and a `--space-4` gap, below a `--color-border-subtle` rule with `--space-6` padding. Each link is a block row with `--space-3` `--space-4` padding, `--radius-field` corners, and a transparent 1px border: a `--text-xs` `--color-muted` direction with an arrow ("Previous", "Next"), then a medium `--color-text` title. Links take `rel="prev"` and `rel="next"`. Next sits in the end column, end-aligned, even when it is alone.
|
|
292
359
|
- **States.** Hover: `--color-row-hover` fill. Focus-visible: the focus ring. There is no current state.
|
|
360
|
+
- **Do.** Use a pager for pages a reader goes through in order, such as a guide's chapters or the skills in one group.
|
|
361
|
+
- **Don't.** A pager on pages with no reading order, or one per section on a page with a section rail.
|
|
293
362
|
- **Phone.** At `max-width: 640px`, one column in source order.
|
|
294
363
|
- **Keyboard and screen reader.** The direction and the title are both inside the link, so it reads as one name, such as "Next Application example".
|
|
295
364
|
- **Motion.** The fill changes over `--duration-fast` with `--ease-out`.
|
|
365
|
+
- **Forced colors.** Each link's transparent border draws in the system link colour, so both links read as boxes, and the hover fill drops.
|
|
296
366
|
|
|
297
367
|
## Tabs
|
|
298
368
|
|
|
299
369
|
Layer: Core. ui: `UiTabs`.
|
|
300
370
|
|
|
301
|
-
- **Use.** Panels about one object, when no URL changes. Never mix tabs that change the URL with tabs that switch panels in one set, and never give links `role="tab"`: a set of pages takes a [navigation strip](#navigation-list) instead.
|
|
302
371
|
- **Anatomy.** A `role="tablist"` with no rule below it and a 12px gap below it. It scrolls sideways when needed, and a 24px mask fades each clipped edge. Scrolling clips on every side, so the list has 4px (`--space-1`) padding all round: it keeps the selected tab's shadow whole and its fill off the frame edge. Each tab is a borderless button at least `--control-md` tall (`--control-lg` on phones), with `--space-2` `--space-3` padding, `--radius-inline` corners, medium weight, and `--color-muted`. The selected tab's fill is a `::before` layer behind the label, inset 0, with the tab's corners; the list sets `isolation: isolate`, so the layer stays inside it.
|
|
303
372
|
- **States.** Hover fills `--color-row-hover` and turns the text `--color-text`. The selected tab takes the [navigation row](#navigation-list)'s current-page recipe: `--color-nav-current` fill and `--shadow-nav-current`, with no underline. Its text is `--color-nav-current-text`: the first of `--color-accent`, `--color-text`, black, and white that reaches 4.5:1 over the tinted fill, both on the page and on a surface (composite a translucent fill over each first). Focus-visible is the focus ring, inset because the list scrolls.
|
|
373
|
+
- **Do.** Use tabs for panels about one object, such as a monitor's Overview and History, when the URL does not change.
|
|
374
|
+
- **Don't.** Links with `role="tab"`, or one set that mixes pages and panels. Pages take a navigation strip.
|
|
304
375
|
- **Motion.** Hover fades over `--duration-fast` with `--ease-out`. When the reader changes the tab, the fill glides from the old tab to the new one as the [segmented control](#segmented-control)'s thumb does: start the new fill's left and right edges where the old fill was, then animate each edge home with the `glide-left` and `glide-right` keyframes and CSS `ease`, the leading edge over 260ms and the trailing edge over 300ms. Labels cross-fade their colour over 260ms. An interrupted glide starts from the fill's current position. There is no glide on first render or under reduced motion, where the fill moves at once.
|
|
305
376
|
- **Keyboard and screen reader.** Roving `tabindex`: arrow keys move between tabs, Home and End go to the ends, and focus selects the tab. Each tab has `aria-controls` and `aria-selected`; each panel has `role="tabpanel"`. Without JavaScript, show every panel under its own heading. Apply the tab roles and hide the headings and unselected panels only when the script enhances the markup.
|
|
306
377
|
- **Forced colors.** The fill layer is removed (`content: none`), so the selected tab takes a 2px `Highlight` border, and its padding shrinks by 2px to keep its size.
|
|
@@ -310,15 +381,24 @@ Layer: Core. ui: `UiTabs`.
|
|
|
310
381
|
Layer: Core. ui: the `fg-site-skip` class.
|
|
311
382
|
|
|
312
383
|
- **Anatomy.** The first focusable element on the page, linking to `main` (`id="main"`) and named "Skip to content". It sits above the page until it takes focus, then shows at the top left as a floating layer: `--color-surface-raised`, a transparent 1px border, `--radius-field`, `--shadow-dialog`, `--space-2` `--space-3` padding, and the focus ring.
|
|
384
|
+
- **States.** Hidden above the page at rest, and shown at the top left while it has focus.
|
|
385
|
+
- **Do.** A "Skip to content" link on every page with a header or rail before `main`; the first Tab shows it.
|
|
386
|
+
- **Don't.** Hiding it with `display: none`, which also takes it out of the Tab order.
|
|
313
387
|
- **Second link.** When a [section rail](#section-rail) comes before `main` and holds more than about 20 rows, a second link, "Skip to contents", follows the first and moves focus to the rail's list. It is hidden at tablet width, where the rail sits in the drawer.
|
|
314
388
|
- **Keyboard and screen reader.** Activating a skip link moves focus to its target, which takes `tabindex="-1"` at that moment.
|
|
389
|
+
- **Motion.** None: it appears at once when it takes focus.
|
|
390
|
+
- **Forced colors.** The shadow drops, and the transparent border draws in the system link colour.
|
|
315
391
|
|
|
316
392
|
## Keyboard key
|
|
317
393
|
|
|
318
394
|
Layer: Core. ui: none yet.
|
|
319
395
|
|
|
320
|
-
- **Use.** A key or shortcut in running text or shortcut docs, and the [find field](#find-field)'s hint. The hint is `aria-hidden`, because the field carries `aria-keyshortcuts`.
|
|
321
396
|
- **Anatomy.** A `<kbd>`: `--font-mono` `--text-xs` medium in `--color-muted`, on a `--color-surface` fill with a 1px `--color-border` edge and `--radius-inline` corners, 20px tall, at least 20px wide, with 5px inline padding and no shadow.
|
|
397
|
+
- **States.** None: a key is static text.
|
|
398
|
+
- **Do.** A key or shortcut in running text or shortcut docs, one key per `<kbd>`.
|
|
399
|
+
- **Don't.** A key style for code or button names. Code takes `<code>`; a button's name is plain text.
|
|
400
|
+
- **Keyboard and screen reader.** A `<kbd>` reads as its text. The [find field](#find-field)'s hint is `aria-hidden`, because the field carries `aria-keyshortcuts`.
|
|
401
|
+
- **Motion.** None: a key is static.
|
|
322
402
|
- **Forced colors.** The edge is `CanvasText`.
|
|
323
403
|
|
|
324
404
|
## Code block
|
|
@@ -328,13 +408,17 @@ Layer: Core. ui: `UiCodeBlock`.
|
|
|
328
408
|
- **Anatomy.** A source code well: `--color-code`, transparent 1px border, `--radius-panel`, `--shadow-surface`. An optional header (at least 40px, `--color-surface-raised`, `--text-xs`, a `--color-border-subtle` rule below) holds the title in semibold, the language in muted text, and a Copy button. The `<pre>` has `--space-4` padding, scrolls in both directions, is at most 32rem tall, and sets `--font-mono` at `--text-code` with a line height of 1.65. Line numbers are muted and right-aligned. Syntax uses the `--color-syntax-*` tokens. A compact variant puts the code and the Copy button on one row, with no header.
|
|
329
409
|
- **Phone text.** Set `text-size-adjust: 100%` (and `-webkit-text-size-adjust`) on the block, and align each line's items to the baseline, so iOS Safari does not enlarge one line.
|
|
330
410
|
- **Copy.** Copies the code text only: no line numbers or prompts, and one line per row joined with newlines. A [quiet action](#quiet-action) at least 44×44 with an accessible name. Announce the result in a polite live region; in the compact variant the success message is visually hidden.
|
|
411
|
+
- **States.** Rest, and focus-visible on Copy and on the `<pre>` when it scrolls. Copy takes the quiet action states and announces "Copied." or a failure.
|
|
412
|
+
- **Do.** Use a code block for source with no live result. When the reader should see the result too, use the variant with a live example.
|
|
413
|
+
- **Don't.** The same language label on every block of a page. Put useful setup context above the block instead.
|
|
331
414
|
- **Keyboard and screen reader.** The `<pre>` is focusable when it scrolls. Its focus ring and the Copy button's ring are inset, because the block clips its content.
|
|
415
|
+
- **Motion.** None: the block is static, and Copy changes as a quiet action does.
|
|
416
|
+
- **Forced colors.** The shadow drops and the transparent border draws as the system edge. Syntax colours take the system text colour, so code reads as plain text.
|
|
332
417
|
|
|
333
418
|
### With a live example
|
|
334
419
|
|
|
335
420
|
ui: `UiExample`.
|
|
336
421
|
|
|
337
|
-
- **Use.** Documentation that shows a live component above the code that makes it. Use the plain code block for code with no live result, and a [figure](#figure) for a static picture.
|
|
338
422
|
- **Anatomy.** One frame: a `<figure>` with a 1px `--color-border-subtle` edge, `--radius-panel`, no shadow, and its content clipped to the corners. The stage comes first and holds the live preview, centred, at least 8rem tall, with `--space-8` padding. The code block follows directly below the stage, after one `--color-border-subtle` hairline. There is no header row and no language label. An optional caption follows the frame, as a [figure](#figure) caption does.
|
|
339
423
|
- **Tokens.** Frame edge `--color-border-subtle` and corners `--radius-panel`. Stage `--color-bg`. Hairline `--color-border-subtle`.
|
|
340
424
|
- **Stage.** The stage sits on the page background, not in a well or a panel. This is a named exception to the container [depth](DESIGN.md#depth) tier: a preview shows each component on the surface it sits on in a page; see [decisions](decisions.md).
|
|
@@ -351,6 +435,12 @@ ui: `UiExample`.
|
|
|
351
435
|
Layer: Identity. ui: `UiCodeBlock` with a shell language or the compact variant.
|
|
352
436
|
|
|
353
437
|
- **Anatomy.** A code block for a shell command, drawn as a dark plate in both themes: `--color-command-bg` with a `--color-command-border` edge (transparent in light). Text, syntax, and the caption all use `--color-terminal-text` or `--color-terminal-caption-text`. Each line starts with a `$ ` prompt in `--color-project-dark`, drawn with `content: "$ " / ""` and `user-select: none`, so copied and spoken text omit it. The plate sets `--color-focus: var(--color-project-dark)`, the dark-theme accent, so every ring on it, Copy's included, reads at 3:1 or more on the dark plate in both page themes.
|
|
438
|
+
- **States.** As for the code block.
|
|
439
|
+
- **Do.** Use it for a shell command the reader runs, one command per line.
|
|
440
|
+
- **Don't.** A `$` typed into the command. CSS draws the prompt; a typed one is copied with the command.
|
|
441
|
+
- **Keyboard and screen reader.** As for the code block.
|
|
442
|
+
- **Motion.** None: as for the code block.
|
|
443
|
+
- **Forced colors.** The dark plate drops to the system background, with system text and edge, and the prompt takes the system text colour.
|
|
354
444
|
- **Contrast.** Plate text at least 4.5:1 and the prompt at least 3:1 on `--color-command-bg`, for each project hue.
|
|
355
445
|
|
|
356
446
|
## Terminal capture
|
|
@@ -358,24 +448,41 @@ Layer: Identity. ui: `UiCodeBlock` with a shell language or the compact variant.
|
|
|
358
448
|
Layer: Identity. ui: `UiCapture`.
|
|
359
449
|
|
|
360
450
|
- **Anatomy.** A panel whose header holds mono tabs (one for each capture) and a Full size [quiet action](#quiet-action) at the end. The screen is the neutral `--color-terminal` plate, and a mono status-line caption sits below it on `--color-terminal-caption` with `--color-terminal-caption-text`. Full size opens the capture in a dialog.
|
|
451
|
+
- **States.** Tabs take the tab states in the capture's palette, and Full size takes the quiet action states.
|
|
452
|
+
- **Do.** Use it to show what a command prints, one tab per capture, with the path and branch in the status line.
|
|
453
|
+
- **Don't.** A capture for a screenshot of a graphical app. Use a figure.
|
|
361
454
|
- **Keyboard and screen reader.** Tabs follow the tabs spec. Full size opens the selected capture in a modal dialog named after it, and focus returns to the button when the dialog closes. Without JavaScript the button is hidden. Focus rings are inset, because the panel clips its content. Without JavaScript, every capture is listed under its own heading.
|
|
362
455
|
- **Header.** The whole panel, header included, is the `--color-terminal` plate in both page appearances, with a 1px `--color-terminal-border` edge. It scopes its own palette so the tabs read on it: current fill `--color-project-dark` at 20% over transparent, with a `--shadow-nav-current-dark` lift, hover `--color-terminal-text` at 4%, selected text, accent, and focus `--color-project-dark`, text `--color-terminal-text`, muted text `--color-terminal-caption-text`, and dividers `--color-terminal-border`. The tab list keeps its 4px block padding, and the Full size control stays centred on the tab row.
|
|
456
|
+
- **Motion.** Tabs glide as in the tabs spec; the panel has no motion of its own.
|
|
457
|
+
- **Forced colors.** The plate and the caption drop to the system background and text, the edge draws in the system colour, and the tabs follow the tabs rule.
|
|
363
458
|
|
|
364
459
|
## Site header
|
|
365
460
|
|
|
366
461
|
Layer: Identity. ui: `UiSiteHeader`, `UiSiteAppearancePicker`.
|
|
367
462
|
|
|
368
463
|
- **Anatomy.** A static header at least 64px tall on `--color-bg` with a solid 1px `--color-text` rule below it. At the start is the project switcher: a `<details>` whose summary, a [quiet action](#quiet-action), shows the mono, semibold project name after a `~/` mark in `--color-project` (drawn by CSS, so it is not read), then a chevron. Its menu is a floating layer, with the dialog's tokens, listing the shared project registry in the order it defines, as navigation rows, with the current project marked `aria-current="page"`. At the end are the site links and the appearance picker: an icon-only segmented control at `lg`. The site links are a [navigation strip](#navigation-list) of rows 44px tall (`--control-lg`). A link to a page inside the site takes `aria-current="page"` on that page, with the current-page recipe.
|
|
464
|
+
- **States.** The project menu is closed or open; while open, its summary keeps the quiet action's hover tint. Site links take the navigation row states.
|
|
465
|
+
- **Do.** Keep the same header and site links, six at most and in one order, on every page of a personal product site.
|
|
466
|
+
- **Don't.** The site header on an application screen. An application keeps its own navigation.
|
|
369
467
|
- **Phone.** The first row holds the identity and the picker. With three or more links, the links take a second row. A long identity becomes a [breadcrumb](#breadcrumbs) back link.
|
|
370
|
-
- **Keyboard and screen reader.** The summary is named "Project: <name>". Escape closes the menu and returns focus to the summary; moving focus out of it closes it.
|
|
468
|
+
- **Keyboard and screen reader.** The summary is named "Project: <name>". Escape closes the menu and returns focus to the summary; moving focus out of it closes it.
|
|
469
|
+
- **Motion.** The chevron turns 180° while the menu is open, over `--duration-fast` with `--ease-out`. The menu itself opens at once.
|
|
470
|
+
- **Forced colors.** The rule below the header takes the system text colour, and the menu and the site links follow the navigation list rules.
|
|
371
471
|
|
|
372
472
|
## Page type and helpers
|
|
373
473
|
|
|
374
474
|
Layer: Identity. ui: `site.css` helpers.
|
|
375
475
|
|
|
476
|
+
- **Anatomy.** Type and layout helpers for identity pages: headings, steps, definitions, facts, a command list, and the footer, each below.
|
|
376
477
|
- **Headings.** Documentation, CLI tool, article, and product page titles (`--text-3xl`) use `--font-mono`; application titles use `--font-ui` at `--text-2xl` or smaller. On documentation, CLI tool, article, and product pages, a page-level section heading (h2) uses `--font-mono` at `--text-xl` (a product page may set it larger, up to `--text-3xl`), starts with a `## ` mark in `--color-accent`, drawn with `content: "## " / ""`, and has a `--color-border-subtle` rule above the section. Application and inline-visualization section headings use `--font-ui`, semibold, at `--text-xl` or smaller, with no mark and no rule; h3 and lower never take the mark. A product page or tool home may use a mono `--text-display` title (`--text-display-sm` on phones).
|
|
377
478
|
- **Steps.** An ordered list in which each step hangs from a mono number in `--color-accent` on a ruled leading column, with an h3 title per step.
|
|
378
479
|
- **Definitions.** A definition list of terms and short meanings: medium-weight terms and muted meanings in two columns, one column on phones. Flags such as `--all` do not break.
|
|
379
480
|
- **Facts.** A mono definition list of short labels and values, such as a repository path. Values wrap anywhere.
|
|
380
481
|
- **Command list.** A table of commands (mono) and descriptions (muted), with a Copy [quiet action](#quiet-action) for each row. On phones each row becomes a two-column grid.
|
|
381
482
|
- **Footer.** Mono, with an attribution link at the start and project links at the end.
|
|
483
|
+
- **States.** None: the helpers are static type. The command list's Copy takes the quiet action states.
|
|
484
|
+
- **Do.** Use steps for a sequence the reader follows in order, definitions for terms with short meanings, and facts for short labels and values.
|
|
485
|
+
- **Don't.** The `##` mark on an application screen, or on h3 and lower.
|
|
486
|
+
- **Keyboard and screen reader.** Headings keep their outline levels, and the `## ` mark has empty alternative text, so it is not read. Steps are an ordered list; definitions and facts are definition lists.
|
|
487
|
+
- **Motion.** None: the helpers are static.
|
|
488
|
+
- **Forced colors.** No change: text, rules, and marks take the system colours.
|
package/language/decisions.md
CHANGED
|
@@ -135,3 +135,5 @@ Prose patterns moved with the names: `--*-soft` is now `--color-*-surface`, and
|
|
|
135
135
|
|
|
136
136
|
- Field focus is a 1px `--color-accent` edge with a faint 2px inset line. The edge reaches 3:1 for a focus indicator (WCAG 1.4.11): 6.61:1 against the light field fill and 6.26:1 against `--color-bg`, and 8.43:1 and 8.31:1 in dark. It is thinner than the 2px perimeter that the WCAG 2.2 AAA focus appearance criterion (2.4.13) asks for; the inset line, at 18% of the accent, does not reach 3:1 on its own.
|
|
137
137
|
- In forced colors (high contrast), an invalid field shows the system edge, not the `--color-error` edge, focused or not; the error text carries the state. A visible high-contrast invalid edge needs an error colour validated against high-contrast fills.
|
|
138
|
+
- In forced colors, a badge's tone dot is a background fill, so it takes the system background and disappears; the label carries the status. Keeping the dot needs it to opt out of adjustment with a system colour.
|
|
139
|
+
- In forced colors, an alert's SVG icon keeps its authored status colour: Chromium gives SVG `forced-color-adjust: preserve-parent-color`, and the icon sets its own colour. Its contrast against a dark high-contrast background is unchecked; the text carries the message.
|