fluentui-design 0.1.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/CHANGELOG.md +50 -0
- package/LICENSE +21 -0
- package/README.md +129 -0
- package/dist/bin.d.ts +18 -0
- package/dist/bin.js +71 -0
- package/dist/bin.js.map +1 -0
- package/dist/skill/install-skill.d.ts +256 -0
- package/dist/skill/install-skill.js +546 -0
- package/dist/skill/install-skill.js.map +1 -0
- package/package.json +90 -0
- package/skills/fluentui-design/SKILL.md +184 -0
- package/skills/fluentui-design/references/checklists/accessibility-review.md +51 -0
- package/skills/fluentui-design/references/checklists/design-before-code.md +53 -0
- package/skills/fluentui-design/references/checklists/visual-review.md +45 -0
- package/skills/fluentui-design/references/foundation/accessibility.md +70 -0
- package/skills/fluentui-design/references/foundation/composition-and-state.md +92 -0
- package/skills/fluentui-design/references/foundation/responsive-and-localization.md +63 -0
- package/skills/fluentui-design/references/foundation/styling-and-tokens.md +71 -0
- package/skills/fluentui-design/references/index.md +42 -0
- package/skills/fluentui-design/references/maintenance/refresh-and-repin.md +68 -0
- package/skills/fluentui-design/references/patterns/PAT-001-application-shell.md +77 -0
- package/skills/fluentui-design/references/patterns/PAT-002-list-page.md +85 -0
- package/skills/fluentui-design/references/patterns/PAT-003-record-detail.md +74 -0
- package/skills/fluentui-design/references/patterns/PAT-004-form-page.md +78 -0
- package/skills/fluentui-design/references/patterns/PAT-005-contextual-edit.md +75 -0
- package/skills/fluentui-design/references/patterns/PAT-006-settings-page.md +78 -0
- package/skills/fluentui-design/references/patterns/PAT-007-multi-step-task.md +79 -0
- package/skills/fluentui-design/references/patterns/PAT-008-dashboard.md +78 -0
- package/skills/fluentui-design/references/rules/index.md +97 -0
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: fluentui-design
|
|
3
|
+
description: Design, implement, and review coherent Fluent UI React v9 web applications. Use when composing pages, choosing surfaces (page, drawer, or dialog), arranging navigation, commands, forms, DataGrid or Table, tabs, feedback, and empty, loading, and error states for business and admin apps. Cross-links the API-focused fluentui skill for exact props and imports instead of copying API documentation.
|
|
4
|
+
license: MIT
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Fluent UI Design
|
|
8
|
+
|
|
9
|
+
This skill is the composition layer for Fluent UI React v9. It answers where a
|
|
10
|
+
surface belongs, which regions a page needs, who owns state, and how the parts
|
|
11
|
+
work together. It does not restate component props or imports; the sibling
|
|
12
|
+
`fluentui` skill owns those exact API facts.
|
|
13
|
+
|
|
14
|
+
Read this entry point first, then open only the references the task needs.
|
|
15
|
+
|
|
16
|
+
## Triggers and non-triggers
|
|
17
|
+
|
|
18
|
+
Use this skill when the task is about composition:
|
|
19
|
+
|
|
20
|
+
- Choosing a surface: a page, a drawer, a dialog, or an inline editor.
|
|
21
|
+
- Arranging navigation, page chrome, commands, and content regions.
|
|
22
|
+
- Deciding state ownership, save model, or submit feedback.
|
|
23
|
+
- Laying out forms, data grids, tabs, or multi-step task flows.
|
|
24
|
+
- Reviewing accessibility, responsive behavior, or visual coherence.
|
|
25
|
+
|
|
26
|
+
Do not use it for pure API lookup:
|
|
27
|
+
|
|
28
|
+
- The exact props, types, imports, or slots of one component.
|
|
29
|
+
- Token names or theme shape without a design question.
|
|
30
|
+
- Version-specific API changes.
|
|
31
|
+
|
|
32
|
+
For those, use the sibling `fluentui` skill. The entry point states that
|
|
33
|
+
dependency in its description on purpose: the two skills are co-installed.
|
|
34
|
+
|
|
35
|
+
## Reconnaissance
|
|
36
|
+
|
|
37
|
+
Before proposing a design, inspect the project instead of assuming:
|
|
38
|
+
|
|
39
|
+
- The installed `@fluentui/react-components` version, and whether it matches
|
|
40
|
+
the baseline in [Compatibility](#compatibility).
|
|
41
|
+
- The React version. v9 peers on React `>=16.14.0` and `<20.0.0`.
|
|
42
|
+
- Where `FluentProvider` is mounted and which theme it applies.
|
|
43
|
+
- Existing page shells, layout patterns, and naming the app already uses.
|
|
44
|
+
- Whether the sibling `fluentui` skill is available for exact API facts.
|
|
45
|
+
|
|
46
|
+
If a project deviates from the baseline, say so and re-verify the rules you use.
|
|
47
|
+
|
|
48
|
+
## Task classification
|
|
49
|
+
|
|
50
|
+
Classify the request by the decision it contains, then load that reference.
|
|
51
|
+
The generated [reference index](references/index.md) maps every decision to the
|
|
52
|
+
patterns that resolve it.
|
|
53
|
+
|
|
54
|
+
| The task sounds like | Load |
|
|
55
|
+
| --- | --- |
|
|
56
|
+
| "Build a new area of the app" | [PAT-001 application shell](references/patterns/PAT-001-application-shell.md) |
|
|
57
|
+
| "Show a filterable list" | [PAT-002 list page](references/patterns/PAT-002-list-page.md) |
|
|
58
|
+
| "Show one record and its actions" | [PAT-003 record detail](references/patterns/PAT-003-record-detail.md) |
|
|
59
|
+
| "Create or edit an entity" | [PAT-004 form page](references/patterns/PAT-004-form-page.md) |
|
|
60
|
+
| "Edit without leaving the list" | [PAT-005 contextual edit](references/patterns/PAT-005-contextual-edit.md) |
|
|
61
|
+
| "Configure options" | [PAT-006 settings page](references/patterns/PAT-006-settings-page.md) |
|
|
62
|
+
| "Walk through a wizard" | [PAT-007 multi-step task](references/patterns/PAT-007-multi-step-task.md) |
|
|
63
|
+
| "Show metrics and trends" | [PAT-008 dashboard](references/patterns/PAT-008-dashboard.md) |
|
|
64
|
+
|
|
65
|
+
Cross-cutting questions have their own references: composition and state in
|
|
66
|
+
[foundation/composition-and-state.md](references/foundation/composition-and-state.md),
|
|
67
|
+
styling in [foundation/styling-and-tokens.md](references/foundation/styling-and-tokens.md),
|
|
68
|
+
accessibility in [foundation/accessibility.md](references/foundation/accessibility.md),
|
|
69
|
+
and responsive and localization behavior in
|
|
70
|
+
[foundation/responsive-and-localization.md](references/foundation/responsive-and-localization.md).
|
|
71
|
+
|
|
72
|
+
When a request names an exact component prop, that part is a `fluentui` skill
|
|
73
|
+
question. Answer the composition here, then hand off the API detail.
|
|
74
|
+
|
|
75
|
+
## Design-before-code checklist
|
|
76
|
+
|
|
77
|
+
Run the short sequence in
|
|
78
|
+
[checklists/design-before-code.md](references/checklists/design-before-code.md)
|
|
79
|
+
before writing components. In brief:
|
|
80
|
+
|
|
81
|
+
1. Name the user task in one sentence.
|
|
82
|
+
2. Choose the surface and say why the alternatives are worse.
|
|
83
|
+
3. List the page regions in reading order.
|
|
84
|
+
4. Decide state ownership and the save model.
|
|
85
|
+
5. Decide the feedback for loading, empty, error, and success.
|
|
86
|
+
6. Decide the responsive collapse and the permission state.
|
|
87
|
+
7. Confirm the accessibility path for every action.
|
|
88
|
+
|
|
89
|
+
A design that cannot answer all seven is not ready to implement.
|
|
90
|
+
|
|
91
|
+
## Surface decision workflow
|
|
92
|
+
|
|
93
|
+
Work from the task outward, not from a component inward.
|
|
94
|
+
|
|
95
|
+
- **Page versus drawer versus dialog.** A full page owns a stable URL and
|
|
96
|
+
survives a refresh. A drawer keeps list context and suits a short edit. A
|
|
97
|
+
dialog interrupts for a small, focused decision. State the reason in the
|
|
98
|
+
pattern you choose.
|
|
99
|
+
- **Data surface.** A `DataGrid` is for interactive, columnar data with
|
|
100
|
+
selection and sorting. A `Table` is for a small, mostly read-only set. The
|
|
101
|
+
rule ids are listed in the [rule index](references/rules/index.md).
|
|
102
|
+
- **Region order.** Order regions as the user reads them: page header, command
|
|
103
|
+
bar, filters, content, then details. Each pattern states its region order.
|
|
104
|
+
- **State ownership.** Keep server state in the data layer and view state in the
|
|
105
|
+
page. Lift state only to the lowest common owner. The patterns state where
|
|
106
|
+
each piece of state lives.
|
|
107
|
+
- **Derived decisions.** Every pattern lists what the application still owns,
|
|
108
|
+
such as routing, validation, fetching, authorization, and persistence.
|
|
109
|
+
|
|
110
|
+
## Implementation constraints
|
|
111
|
+
|
|
112
|
+
- Use only exports that exist in the pinned package. The
|
|
113
|
+
[rule index](references/rules/index.md) is grounded in a verified allowlist;
|
|
114
|
+
when in doubt, confirm the export before using it.
|
|
115
|
+
- Prefer semantic HTML and the component's own slots over DOM overrides.
|
|
116
|
+
- Style with tokens and `makeStyles`. Do not hardcode colors, spacing, or
|
|
117
|
+
shadows that the theme should own.
|
|
118
|
+
- Do not inject unsanitized HTML, and never suggest bypassing validation.
|
|
119
|
+
- Keep API specifics out of this package. Link the `fluentui` skill instead of
|
|
120
|
+
copying a prop table.
|
|
121
|
+
|
|
122
|
+
## Accessibility and visual review
|
|
123
|
+
|
|
124
|
+
Accessibility is part of the design, not a later pass.
|
|
125
|
+
|
|
126
|
+
- Every interactive element is reachable and operable by keyboard.
|
|
127
|
+
- Opening and closing an overlay returns focus to the trigger.
|
|
128
|
+
- Async results are announced, not only drawn.
|
|
129
|
+
- Contrast, motion, zoom, and reflow are checked in the active theme.
|
|
130
|
+
- Run the focused review in
|
|
131
|
+
[checklists/accessibility-review.md](references/checklists/accessibility-review.md)
|
|
132
|
+
and the visual pass in
|
|
133
|
+
[checklists/visual-review.md](references/checklists/visual-review.md).
|
|
134
|
+
|
|
135
|
+
The [accessibility foundation](references/foundation/accessibility.md) explains
|
|
136
|
+
the reasoning shared by every pattern.
|
|
137
|
+
|
|
138
|
+
## Tradeoff explanation
|
|
139
|
+
|
|
140
|
+
When a design choice has a real cost, say so plainly:
|
|
141
|
+
|
|
142
|
+
- State the choice and the alternative you rejected.
|
|
143
|
+
- Give the reason and the evidence, naming the rule that supports it.
|
|
144
|
+
- State confidence and the condition that would change the answer.
|
|
145
|
+
- Never present a convention as a requirement when it is only a preference.
|
|
146
|
+
|
|
147
|
+
A pattern file lists the derived decisions so a tradeoff is attributed to the
|
|
148
|
+
application, not to the component library.
|
|
149
|
+
|
|
150
|
+
## Evidence fallback
|
|
151
|
+
|
|
152
|
+
Evidence can be missing, outdated, or contradictory. Handle each case:
|
|
153
|
+
|
|
154
|
+
- **Missing.** Say which fact is unverified, answer from the bundled rules and
|
|
155
|
+
patterns, and do not invent props.
|
|
156
|
+
- **Outdated.** Compare the project version with [Compatibility](#compatibility)
|
|
157
|
+
and treat a newer install as unverified until re-pinned.
|
|
158
|
+
- **Contradictory.** Prefer the rule with a higher confidence and a named
|
|
159
|
+
source, and surface the conflict instead of hiding it.
|
|
160
|
+
- **Sibling skill absent.** Answer composition from this package, and state that
|
|
161
|
+
exact API facts could not be confirmed.
|
|
162
|
+
|
|
163
|
+
To refresh the bundled facts, follow
|
|
164
|
+
[maintenance/refresh-and-repin.md](references/maintenance/refresh-and-repin.md).
|
|
165
|
+
|
|
166
|
+
## Compatibility
|
|
167
|
+
|
|
168
|
+
| Item | Baseline |
|
|
169
|
+
| --- | --- |
|
|
170
|
+
| `@fluentui/react-components` | 9.74.7 |
|
|
171
|
+
| React peer range | `>=16.14.0 <20.0.0` |
|
|
172
|
+
| Pinned API-fact commit | `d595d79` |
|
|
173
|
+
|
|
174
|
+
Rules and patterns are written against this baseline. A different installed
|
|
175
|
+
version may still work, but its exports are not verified here until re-pinned.
|
|
176
|
+
|
|
177
|
+
## When to re-browse and re-verify
|
|
178
|
+
|
|
179
|
+
Re-verify when the installed Fluent UI version differs from the baseline, when a
|
|
180
|
+
rule is disputed in review, or when a design depends on a fact that this package
|
|
181
|
+
marks as unverified. Follow
|
|
182
|
+
[maintenance/refresh-and-repin.md](references/maintenance/refresh-and-repin.md):
|
|
183
|
+
refresh the sources, re-pin the facts commit, regenerate the indexes, and re-run
|
|
184
|
+
the gates. Do not silently adjust a rule to match a newer library.
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
# Accessibility Review
|
|
2
|
+
|
|
3
|
+
Run this pass after the feature works, and again before release. It covers the
|
|
4
|
+
states that are easy to miss, not only the happy path.
|
|
5
|
+
|
|
6
|
+
## Keyboard
|
|
7
|
+
|
|
8
|
+
- Reach every action with the keyboard alone, in visual order.
|
|
9
|
+
- Enter or Space activates the focused control, and Escape closes an overlay.
|
|
10
|
+
- A grid, menu, or tab set behaves as one composite widget (RULE-021): one tab
|
|
11
|
+
stop enters it and arrows move within it.
|
|
12
|
+
|
|
13
|
+
## Focus
|
|
14
|
+
|
|
15
|
+
- Focus is always visible and never hidden behind a sticky header or overlay
|
|
16
|
+
(RULE-020).
|
|
17
|
+
- Opening an overlay moves focus inside; closing it returns focus to the trigger.
|
|
18
|
+
- Deleting or filtering an item moves focus to a sensible neighbour.
|
|
19
|
+
- A route change moves focus to the new page heading.
|
|
20
|
+
|
|
21
|
+
## Names and roles
|
|
22
|
+
|
|
23
|
+
- Every icon-only control has an accessible name (RULE-022).
|
|
24
|
+
- Every input has a programmatic label and, where needed, helper text
|
|
25
|
+
(RULE-005).
|
|
26
|
+
- Errors are associated with the field they describe.
|
|
27
|
+
|
|
28
|
+
## Announcements
|
|
29
|
+
|
|
30
|
+
- A save, a filter change, and a failed submission are announced (RULE-016).
|
|
31
|
+
- A loading state exposes a busy or status indication.
|
|
32
|
+
|
|
33
|
+
## Visual
|
|
34
|
+
|
|
35
|
+
- Text and non-text contrast pass in light, dark, and high-contrast themes.
|
|
36
|
+
- Motion respects the reduced-motion preference (RULE-019).
|
|
37
|
+
- The layout reflows under zoom and at a narrow width (RULE-023).
|
|
38
|
+
- Truncated content exposes its full value (RULE-025).
|
|
39
|
+
|
|
40
|
+
## States to exercise
|
|
41
|
+
|
|
42
|
+
Test each of these, because each can break an assumption:
|
|
43
|
+
|
|
44
|
+
- First load with no data.
|
|
45
|
+
- Filter with no matches, distinct from no data.
|
|
46
|
+
- A failed request with a retry.
|
|
47
|
+
- A user without permission for an action.
|
|
48
|
+
- A very long value in every column and field.
|
|
49
|
+
|
|
50
|
+
See [accessibility foundation](../foundation/accessibility.md) for the reasoning
|
|
51
|
+
behind each check.
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
# Design Before Code
|
|
2
|
+
|
|
3
|
+
Answer these questions before writing components. Each one has a home in a
|
|
4
|
+
pattern or foundation reference; unresolved questions become rework.
|
|
5
|
+
|
|
6
|
+
## 1. Name the task
|
|
7
|
+
|
|
8
|
+
Write the user task in one sentence, in the user's words. If the sentence needs
|
|
9
|
+
"and", the task is probably two tasks and should split.
|
|
10
|
+
|
|
11
|
+
## 2. Choose the surface
|
|
12
|
+
|
|
13
|
+
Pick a page, a drawer, a dialog, or an inline edit, and say why the others are
|
|
14
|
+
worse. A page owns a URL and survives a refresh. A drawer keeps list context. A
|
|
15
|
+
dialog interrupts for one small decision. See
|
|
16
|
+
[PAT-004 form page](../patterns/PAT-004-form-page.md) and
|
|
17
|
+
[PAT-005 contextual edit](../patterns/PAT-005-contextual-edit.md).
|
|
18
|
+
|
|
19
|
+
## 3. List the regions
|
|
20
|
+
|
|
21
|
+
List the page regions in reading order: header, command bar, filters, content,
|
|
22
|
+
details. Each pattern names its regions and their order.
|
|
23
|
+
|
|
24
|
+
## 4. Decide state ownership
|
|
25
|
+
|
|
26
|
+
Decide who owns the draft, the selection, and the open overlay, using
|
|
27
|
+
[composition-and-state](../foundation/composition-and-state.md). Lift state only
|
|
28
|
+
to the lowest common owner.
|
|
29
|
+
|
|
30
|
+
## 5. Decide the save model
|
|
31
|
+
|
|
32
|
+
Choose explicit save, immediate apply, or a hybrid, and state the feedback for
|
|
33
|
+
each outcome. Guard unsaved changes before they can be lost (RULE-029) and
|
|
34
|
+
prevent duplicate submission (RULE-030).
|
|
35
|
+
|
|
36
|
+
## 6. Decide the four states
|
|
37
|
+
|
|
38
|
+
Design loading, empty, search-empty, and error explicitly (RULE-016). Decide
|
|
39
|
+
where each appears inside the regions you listed.
|
|
40
|
+
|
|
41
|
+
## 7. Decide the collapse and the permission state
|
|
42
|
+
|
|
43
|
+
Decide how the layout reflows at a narrow width (RULE-023) and what a user
|
|
44
|
+
without permission sees. A hidden action and a disabled action are different
|
|
45
|
+
designs; choose deliberately.
|
|
46
|
+
|
|
47
|
+
## 8. Confirm the accessibility path
|
|
48
|
+
|
|
49
|
+
For every action, confirm the keyboard path, the accessible name, and the
|
|
50
|
+
announcement of its result. Run
|
|
51
|
+
[accessibility-review](accessibility-review.md) as the design exit check.
|
|
52
|
+
|
|
53
|
+
When all eight are answered, the design is ready to implement.
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
# Visual Review
|
|
2
|
+
|
|
3
|
+
Run this pass at two widths, in light and dark, before calling a page done.
|
|
4
|
+
Visual coherence is what makes independently built pages look like one product.
|
|
5
|
+
|
|
6
|
+
## Layout
|
|
7
|
+
|
|
8
|
+
- Regions appear in the order the design lists them.
|
|
9
|
+
- Spacing uses the token scale, not hand-set values.
|
|
10
|
+
- Alignment is consistent between the header, the content, and the actions.
|
|
11
|
+
- The page does not scroll horizontally at the narrow width.
|
|
12
|
+
|
|
13
|
+
## Typography
|
|
14
|
+
|
|
15
|
+
- Headings use the type ramp (RULE-018), with one heading per page that names
|
|
16
|
+
its task (RULE-003).
|
|
17
|
+
- Body text and captions are legible in both themes.
|
|
18
|
+
|
|
19
|
+
## Color and theme
|
|
20
|
+
|
|
21
|
+
- Surfaces and text come from alias tokens, not hard-coded values (RULE-017).
|
|
22
|
+
- The page is correct in light, dark, and high-contrast themes.
|
|
23
|
+
- Emphasis uses one accent consistently, not several competing colors.
|
|
24
|
+
|
|
25
|
+
## Commands and states
|
|
26
|
+
|
|
27
|
+
- One primary action is visually dominant; the rest sit in a toolbar (RULE-004).
|
|
28
|
+
- Disabled, loading, empty, search-empty, and error states all look intentional.
|
|
29
|
+
- A pending action shows progress and prevents a second submission (RULE-030).
|
|
30
|
+
|
|
31
|
+
## Motion
|
|
32
|
+
|
|
33
|
+
- Transitions explain a change and are subtle.
|
|
34
|
+
- Reduced motion removes animation rather than shortening it (RULE-019).
|
|
35
|
+
|
|
36
|
+
## Direction and content
|
|
37
|
+
|
|
38
|
+
- The layout mirrors correctly under right-to-left direction (RULE-024).
|
|
39
|
+
- Long values wrap or truncate deliberately, and truncated values stay
|
|
40
|
+
reachable (RULE-025).
|
|
41
|
+
- Translated text has room to grow.
|
|
42
|
+
|
|
43
|
+
See [styling and tokens](../foundation/styling-and-tokens.md) and
|
|
44
|
+
[responsive and localization](../foundation/responsive-and-localization.md) for
|
|
45
|
+
the reasoning behind each check.
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
# Accessibility
|
|
2
|
+
|
|
3
|
+
Accessibility is a property of the composition, not a checklist applied at the
|
|
4
|
+
end. This reference explains the reasoning every pattern shares. For exact ARIA
|
|
5
|
+
attributes and component props, use the sibling `fluentui` skill:
|
|
6
|
+
[Dialog](fluentui:references/components/dialog.md).
|
|
7
|
+
|
|
8
|
+
## Keyboard first
|
|
9
|
+
|
|
10
|
+
Every action must be reachable and operable from the keyboard, in an order that
|
|
11
|
+
follows the visual order. Test the path before shipping: open a surface, move
|
|
12
|
+
through its actions, and close it without reaching for a pointer. A component
|
|
13
|
+
that only works under a mouse is not finished.
|
|
14
|
+
|
|
15
|
+
## Focus
|
|
16
|
+
|
|
17
|
+
Keep focus visible and never obscure the focused control (RULE-020). Focus is
|
|
18
|
+
the user's position in the page, so moving it without cause loses their place.
|
|
19
|
+
The rules that matter most:
|
|
20
|
+
|
|
21
|
+
- Opening an overlay moves focus into it; closing it returns focus to the
|
|
22
|
+
trigger.
|
|
23
|
+
- Removing an item moves focus to a sensible neighbour, not to the top of the
|
|
24
|
+
page.
|
|
25
|
+
- A route change moves focus to the new page heading.
|
|
26
|
+
|
|
27
|
+
Follow the composite-widget keyboard model for grids, menus, and tabs
|
|
28
|
+
(RULE-021): one tab stop enters the widget and arrow keys move within it.
|
|
29
|
+
|
|
30
|
+
## Names, roles, and instructions
|
|
31
|
+
|
|
32
|
+
Provide names, roles, and instructions for non-text content (RULE-022). An icon
|
|
33
|
+
button needs an accessible name. A form field needs a programmatic label, not
|
|
34
|
+
only a nearby visual one (RULE-005). An unfamiliar control needs an instruction
|
|
35
|
+
that a screen reader can reach.
|
|
36
|
+
|
|
37
|
+
## Announce asynchronous results
|
|
38
|
+
|
|
39
|
+
A change that is drawn but not announced is invisible to a screen reader. When a
|
|
40
|
+
save completes, a filter reduces the result count, or a submission fails, expose
|
|
41
|
+
the result through a live region or a status message (RULE-016). The feedback
|
|
42
|
+
channel is a design decision; the announcement is the accessibility obligation.
|
|
43
|
+
|
|
44
|
+
## Overlays
|
|
45
|
+
|
|
46
|
+
An overlay traps focus while it is open, is dismissible by Escape, and returns
|
|
47
|
+
focus on close. Dialog suits a short, focused decision (RULE-008); a drawer
|
|
48
|
+
suits a longer contextual edit (RULE-009). Both must behave the same way for the
|
|
49
|
+
keyboard user.
|
|
50
|
+
|
|
51
|
+
## Contrast, motion, zoom, and reflow
|
|
52
|
+
|
|
53
|
+
- Check text and non-text contrast in light, dark, and high-contrast themes.
|
|
54
|
+
- Respect reduced motion (RULE-019).
|
|
55
|
+
- Ensure the layout survives zoom and a narrow viewport by reflowing rather than
|
|
56
|
+
clipping (RULE-023).
|
|
57
|
+
- Give truncated content an accessible full value (RULE-025).
|
|
58
|
+
|
|
59
|
+
## Review
|
|
60
|
+
|
|
61
|
+
Use [checklists/accessibility-review.md](../checklists/accessibility-review.md)
|
|
62
|
+
for the focused pass. It lists the states to exercise, including the ones that
|
|
63
|
+
are easy to forget: empty, loading, error, and permission-denied.
|
|
64
|
+
|
|
65
|
+
## Related references
|
|
66
|
+
|
|
67
|
+
- [Responsive and localization](responsive-and-localization.md) for reflow and
|
|
68
|
+
direction.
|
|
69
|
+
- [Composition and state](composition-and-state.md) for focus ownership across
|
|
70
|
+
regions.
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
# Composition and State
|
|
2
|
+
|
|
3
|
+
Composition is the part of the design that Fluent UI React v9 does not decide for
|
|
4
|
+
you. The library provides parts; your application decides how the parts form a
|
|
5
|
+
page, who owns each piece of state, and what happens when the data is not ready.
|
|
6
|
+
|
|
7
|
+
This reference supports
|
|
8
|
+
[PAT-001 application shell](../patterns/PAT-001-application-shell.md) and the
|
|
9
|
+
derived decisions every pattern lists. For exact component APIs, use the sibling
|
|
10
|
+
`fluentui` skill: [Nav](fluentui:references/components/nav.md).
|
|
11
|
+
|
|
12
|
+
## The shell is application-owned
|
|
13
|
+
|
|
14
|
+
Fluent UI React v9 ships components, not an application shell. The shell — the
|
|
15
|
+
persistent frame around every page — is a composition you own (RULE-001). A shell
|
|
16
|
+
usually contains:
|
|
17
|
+
|
|
18
|
+
- One `FluentProvider` at the root with an explicit theme and text direction
|
|
19
|
+
(RULE-026). Mount it once; do not nest providers to change one subtree.
|
|
20
|
+
- Primary navigation for the top level of the hierarchy, and a breadcrumb or
|
|
21
|
+
page header for position within it (RULE-002).
|
|
22
|
+
- A content region whose layout each page pattern defines.
|
|
23
|
+
|
|
24
|
+
Because the shell is not a single export, treat it as an application-owned
|
|
25
|
+
composition and keep it small. A shell that grows business rules has stopped
|
|
26
|
+
being a shell.
|
|
27
|
+
|
|
28
|
+
## Compose with public parts
|
|
29
|
+
|
|
30
|
+
Build layout with `makeStyles` and the component's own slots (RULE-028). Reach
|
|
31
|
+
for the DOM or internal class names only when the public surface cannot express
|
|
32
|
+
the layout, and record why. Composing from public parts keeps a design readable
|
|
33
|
+
and upgradeable.
|
|
34
|
+
|
|
35
|
+
## State ownership
|
|
36
|
+
|
|
37
|
+
Keep application state in the application (RULE-027). Fluent components own
|
|
38
|
+
only the state a widget needs to function, such as whether a menu is open.
|
|
39
|
+
Everything that outlives a widget belongs in your layer:
|
|
40
|
+
|
|
41
|
+
| State | Owner |
|
|
42
|
+
| --- | --- |
|
|
43
|
+
| Fetched records and their cache | Data or query layer |
|
|
44
|
+
| Form draft and validation | The form's page or hook |
|
|
45
|
+
| Selection and sort in a grid | The list page |
|
|
46
|
+
| Open overlay and its focus | The overlay's host component |
|
|
47
|
+
| Theme and direction | The root provider |
|
|
48
|
+
|
|
49
|
+
Lift state only to the lowest common owner. Moving state higher than necessary
|
|
50
|
+
couples unrelated regions and makes both harder to test.
|
|
51
|
+
|
|
52
|
+
## Decide the save model
|
|
53
|
+
|
|
54
|
+
State the save model before building the form. The common shapes are:
|
|
55
|
+
|
|
56
|
+
- **Explicit save** for a page form. The user edits a draft and commits with a
|
|
57
|
+
primary action.
|
|
58
|
+
- **Immediate apply** for a setting. The change saves as it is made, and success
|
|
59
|
+
or failure is reported at once.
|
|
60
|
+
- **Hybrid** for a settings page: immediate for cheap toggles, explicit save for
|
|
61
|
+
a group that must change together.
|
|
62
|
+
|
|
63
|
+
Each pattern states which model it assumes and what the application still owns.
|
|
64
|
+
|
|
65
|
+
## Server state versus view state
|
|
66
|
+
|
|
67
|
+
Separate the two deliberately. Server state is fetched, cached, and possibly
|
|
68
|
+
stale. View state is local and cheap. A grid that sorts server data re-queries
|
|
69
|
+
when the sort changes (RULE-011); it does not sort only the loaded page. Keeping
|
|
70
|
+
that distinction explicit is what makes paging, filtering, and selection
|
|
71
|
+
predictable.
|
|
72
|
+
|
|
73
|
+
## What the application owns
|
|
74
|
+
|
|
75
|
+
Every pattern ends with the same reminder in different words: routing, data
|
|
76
|
+
fetching, validation, authorization, and persistence are application
|
|
77
|
+
responsibilities. Fluent UI React v9 renders them well; it does not implement
|
|
78
|
+
them. When you explain a tradeoff, attribute those decisions to the application
|
|
79
|
+
so no one looks for a component that does not exist.
|
|
80
|
+
|
|
81
|
+
## Failure and readiness
|
|
82
|
+
|
|
83
|
+
Design the state of the surface, not only its happy path. Loading, empty,
|
|
84
|
+
search-empty, and error are four different states and each needs an explicit
|
|
85
|
+
treatment (RULE-016). The composition decision is where each one appears: inside
|
|
86
|
+
the content region, replacing the grid, or in a message region above it.
|
|
87
|
+
|
|
88
|
+
## Related references
|
|
89
|
+
|
|
90
|
+
- [Styling and tokens](styling-and-tokens.md) for the two-layer token model.
|
|
91
|
+
- [Accessibility](accessibility.md) for focus and keyboard composition.
|
|
92
|
+
- [Responsive and localization](responsive-and-localization.md) for reflow.
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
# Responsive and Localization
|
|
2
|
+
|
|
3
|
+
A layout that only works at one width and one language is unfinished. This
|
|
4
|
+
reference supports
|
|
5
|
+
[PAT-002 list page](../patterns/PAT-002-list-page.md) and
|
|
6
|
+
[PAT-008 dashboard](../patterns/PAT-008-dashboard.md).
|
|
7
|
+
|
|
8
|
+
For the exact breakpoint and direction props, use the sibling `fluentui` skill:
|
|
9
|
+
[FluentProvider](fluentui:references/components/fluentprovider.md).
|
|
10
|
+
|
|
11
|
+
## Reflow, do not shrink
|
|
12
|
+
|
|
13
|
+
Reflow content rather than shrinking it (RULE-023). Shrinking produces illegible
|
|
14
|
+
text and unreachable controls. Reflowing changes the arrangement:
|
|
15
|
+
|
|
16
|
+
- Columns collapse into a stacked detail view.
|
|
17
|
+
- A filter bar collapses into a single control that opens a panel.
|
|
18
|
+
- A wide grid becomes a list of records with a details region.
|
|
19
|
+
|
|
20
|
+
Choose the collapse behaviour when you design the region, not when you discover
|
|
21
|
+
the narrow width.
|
|
22
|
+
|
|
23
|
+
## Logical properties for direction
|
|
24
|
+
|
|
25
|
+
Use logical properties so a layout mirrors under right-to-left direction
|
|
26
|
+
(RULE-024). Prefer inline-start and inline-end over left and right in margins,
|
|
27
|
+
padding, and borders. A layout built with physical sides looks correct in one
|
|
28
|
+
direction and broken in the other.
|
|
29
|
+
|
|
30
|
+
Set the text direction once, at the root provider (RULE-026). Do not flip
|
|
31
|
+
individual components; mirroring at the root is what keeps icons, alignment, and
|
|
32
|
+
scrollbars consistent.
|
|
33
|
+
|
|
34
|
+
## Long content and truncation
|
|
35
|
+
|
|
36
|
+
Plan for long content and truncation with an accessible full value (RULE-025). A
|
|
37
|
+
long name, a long email, and a long description all happen in real data. Decide
|
|
38
|
+
per column:
|
|
39
|
+
|
|
40
|
+
- Wrap when the value is short and the row can grow.
|
|
41
|
+
- Truncate with an accessible full value when the row height must stay fixed.
|
|
42
|
+
- Move the full value into a details view when the column cannot show it.
|
|
43
|
+
|
|
44
|
+
Truncation without a way to read the full value is data loss, not a layout fix.
|
|
45
|
+
|
|
46
|
+
## Content length across languages
|
|
47
|
+
|
|
48
|
+
Translated text is often longer than the English source. Leave room for growth,
|
|
49
|
+
and avoid layouts that depend on an exact string width. A button, a tab, or a
|
|
50
|
+
column sized to the English label will break in another language. Size to the
|
|
51
|
+
container and let the content wrap or truncate deliberately.
|
|
52
|
+
|
|
53
|
+
## Verify at the edges
|
|
54
|
+
|
|
55
|
+
Check at least two widths in every theme, and check the direction opposite to
|
|
56
|
+
the one you designed in. The
|
|
57
|
+
[visual review checklist](../checklists/visual-review.md) lists the states to
|
|
58
|
+
cover, including the narrow and mirrored ones.
|
|
59
|
+
|
|
60
|
+
## Related references
|
|
61
|
+
|
|
62
|
+
- [Styling and tokens](styling-and-tokens.md) for theme-level values.
|
|
63
|
+
- [Accessibility](accessibility.md) for zoom and reflow obligations.
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
# Styling and Tokens
|
|
2
|
+
|
|
3
|
+
Fluent UI React v9 draws its visual consistency from a two-layer token model.
|
|
4
|
+
Styling that respects that model adapts to theme, contrast, and brand without
|
|
5
|
+
per-component overrides. This reference supports
|
|
6
|
+
[PAT-006 settings page](../patterns/PAT-006-settings-page.md) and any pattern
|
|
7
|
+
that renders chrome.
|
|
8
|
+
|
|
9
|
+
For the exact token names and the `makeStyles` signature, use the sibling
|
|
10
|
+
`fluentui` skill: [tokens](fluentui:references/tokens.md).
|
|
11
|
+
|
|
12
|
+
## The two-layer token model
|
|
13
|
+
|
|
14
|
+
There are two layers, and using the right one is the whole discipline
|
|
15
|
+
(RULE-017):
|
|
16
|
+
|
|
17
|
+
1. **Global tokens** hold raw values: a specific gray, a specific radius. They
|
|
18
|
+
are the palette.
|
|
19
|
+
2. **Alias tokens** map a role to a palette value: a neutral background, a
|
|
20
|
+
brand stroke, a subtle shadow. Components use these.
|
|
21
|
+
|
|
22
|
+
Style against alias tokens. A hard-coded color, spacing, or shadow bypasses the
|
|
23
|
+
theme, so it survives a theme switch as a visible bug. When no alias fits, the
|
|
24
|
+
answer is usually a design conversation, not a literal value.
|
|
25
|
+
|
|
26
|
+
## Type
|
|
27
|
+
|
|
28
|
+
Use the type ramp instead of ad-hoc font sizes (RULE-018). The ramp keeps
|
|
29
|
+
heading, body, and caption sizes consistent across pages, and it already
|
|
30
|
+
accounts for line height. A page that sets its own sizes drifts from every other
|
|
31
|
+
page the moment the theme changes.
|
|
32
|
+
|
|
33
|
+
## Motion
|
|
34
|
+
|
|
35
|
+
Respect reduced motion (RULE-019). When a user asks for less motion, replace an
|
|
36
|
+
animated transition with an instant change rather than a shorter animation.
|
|
37
|
+
Motion should explain a change — an overlay appearing, a row leaving — never
|
|
38
|
+
decorate it.
|
|
39
|
+
|
|
40
|
+
## Dark and high-contrast themes
|
|
41
|
+
|
|
42
|
+
Because alias tokens are resolved per theme, a design built from them works in
|
|
43
|
+
light, dark, and high-contrast themes without changes. Check the three states
|
|
44
|
+
that commonly break:
|
|
45
|
+
|
|
46
|
+
- A hard-coded white surface disappears in a light theme.
|
|
47
|
+
- A low-contrast border disappears against a dark surface.
|
|
48
|
+
- A custom shadow reads as a smudge in high contrast.
|
|
49
|
+
|
|
50
|
+
If a component genuinely needs a new role, add an alias in the theme rather than
|
|
51
|
+
a literal in the component.
|
|
52
|
+
|
|
53
|
+
## Layout spacing
|
|
54
|
+
|
|
55
|
+
Prefer the layout components and tokenized gaps over hand-set margins. A
|
|
56
|
+
consistent spacing scale is what makes two independently built pages look like
|
|
57
|
+
one application. When you must choose a value, choose the token closest to the
|
|
58
|
+
intent, and let the theme own it.
|
|
59
|
+
|
|
60
|
+
## Boundaries with the API skill
|
|
61
|
+
|
|
62
|
+
This reference explains which layer to use and why. It does not list token
|
|
63
|
+
names, the `makeStyles` options, or the theme shape — those are API facts and
|
|
64
|
+
belong to the sibling `fluentui` skill. Link them rather than copying them.
|
|
65
|
+
|
|
66
|
+
## Related references
|
|
67
|
+
|
|
68
|
+
- [Composition and state](composition-and-state.md) for where styling decisions
|
|
69
|
+
live.
|
|
70
|
+
- [Responsive and localization](responsive-and-localization.md) for logical
|
|
71
|
+
properties and reflow.
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
<!-- GENERATED FILE — DO NOT EDIT; source: skill/references/patterns + rules/rules.json -->
|
|
2
|
+
|
|
3
|
+
# Reference Index
|
|
4
|
+
|
|
5
|
+
This index is generated. Route by the decision you face, then open the pattern.
|
|
6
|
+
For exact component props and imports, use the sibling `fluentui` skill
|
|
7
|
+
(for example [Button](fluentui:references/components/button.md)).
|
|
8
|
+
|
|
9
|
+
## Decisions
|
|
10
|
+
|
|
11
|
+
| Decision | Patterns | Rules |
|
|
12
|
+
| --- | --- | --- |
|
|
13
|
+
| `command-scope` | PAT-001 | RULE-001, RULE-002, RULE-003 |
|
|
14
|
+
| `data-processing-location` | PAT-002 | RULE-010, RULE-011, RULE-012, RULE-016 |
|
|
15
|
+
| `data-resilience` | PAT-002, PAT-008 | RULE-003, RULE-010, RULE-011, RULE-012, RULE-015, RULE-016 |
|
|
16
|
+
| `data-surface` | PAT-002 | RULE-010, RULE-011, RULE-012, RULE-016 |
|
|
17
|
+
| `edit-surface` | PAT-005 | RULE-008, RULE-009, RULE-029 |
|
|
18
|
+
| `feedback-channel` | PAT-008 | RULE-003, RULE-015, RULE-016 |
|
|
19
|
+
| `field-annotation` | PAT-004 | RULE-005, RULE-006, RULE-007, RULE-029, RULE-030 |
|
|
20
|
+
| `form-layout` | PAT-004 | RULE-005, RULE-006, RULE-007, RULE-029, RULE-030 |
|
|
21
|
+
| `modal-behavior` | PAT-005 | RULE-008, RULE-009, RULE-029 |
|
|
22
|
+
| `navigation-model` | PAT-001, PAT-006 | RULE-001, RULE-002, RULE-003, RULE-013, RULE-014 |
|
|
23
|
+
| `permission-state` | PAT-003, PAT-008 | RULE-003, RULE-015, RULE-016, RULE-029 |
|
|
24
|
+
| `progressive-disclosure` | PAT-006 | RULE-013, RULE-014 |
|
|
25
|
+
| `row-activation` | PAT-002 | RULE-010, RULE-011, RULE-012, RULE-016 |
|
|
26
|
+
| `save-model` | PAT-007 | RULE-029, RULE-030 |
|
|
27
|
+
| `selection-scope` | PAT-002 | RULE-010, RULE-011, RULE-012, RULE-016 |
|
|
28
|
+
| `submit-feedback` | PAT-004, PAT-007 | RULE-005, RULE-006, RULE-007, RULE-029, RULE-030 |
|
|
29
|
+
| `virtualization` | PAT-002 | RULE-010, RULE-011, RULE-012, RULE-016 |
|
|
30
|
+
|
|
31
|
+
## Application patterns
|
|
32
|
+
|
|
33
|
+
| Pattern | Title | Decisions |
|
|
34
|
+
| --- | --- | --- |
|
|
35
|
+
| [PAT-001](patterns/PAT-001-application-shell.md) | Application shell | command-scope, navigation-model |
|
|
36
|
+
| [PAT-002](patterns/PAT-002-list-page.md) | Searchable and filterable list page | data-surface, data-processing-location, selection-scope, row-activation, data-resilience, virtualization |
|
|
37
|
+
| [PAT-003](patterns/PAT-003-record-detail.md) | Record detail page | permission-state |
|
|
38
|
+
| [PAT-004](patterns/PAT-004-form-page.md) | Create and edit form page | form-layout, field-annotation, submit-feedback |
|
|
39
|
+
| [PAT-005](patterns/PAT-005-contextual-edit.md) | Short contextual edit in a drawer or focused dialog | edit-surface, modal-behavior |
|
|
40
|
+
| [PAT-006](patterns/PAT-006-settings-page.md) | Settings page with optional advanced sections | progressive-disclosure, navigation-model |
|
|
41
|
+
| [PAT-007](patterns/PAT-007-multi-step-task.md) | Multi-step task with review and preserved state | save-model, submit-feedback |
|
|
42
|
+
| [PAT-008](patterns/PAT-008-dashboard.md) | Dashboard whose content reflects actual tasks and data | feedback-channel, data-resilience, permission-state |
|