Communitygithub.com

fluent-2

Comprehensive guide and design system specification for building, styling, and refactoring applications with Microsoft's Fluent 2 Design System and Fluent UI React v9 (@fluentui/react-components, Griffel makeStyles, and @fluentui/react-icons). Use when designing, implementing, reviewing, or migrating web or desktop UIs (React, Tauri, Electron, Next.js, Vite) using Fluent 2 tokens, theming, Griffel CSS-in-JS, component patterns, icons, or accessibility standards.

fluent-2 とは?

fluent-2 is a Claude Code agent skill that comprehensive guide and design system specification for building, styling, and refactoring applications with Microsoft's Fluent 2 Design System and Fluent UI React v9 (@fluentui/react-components, Griffel makeStyles, and @fluentui/react-icons). Use when designing, implementing, reviewing, or migrating web or desktop UIs (React, Tauri, Electron, Next.js, Vite) using Fluent 2 tokens, theming, Griffel CSS-in-JS, component patterns, icons, or accessibility standards.

対応~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/fernanda-alvarez/fluent2designsystem/tree/HEAD

お気に入りのAIに質問する

このエージェントスキルを事前に読み込んだ状態で新しいチャットを開きます。

ドキュメント

Fluent 2 Design System (Fluent UI React v9)

This skill defines the authoritative architecture, styling rules, component patterns, and accessibility standards for Microsoft's Fluent 2 Design System (fluent2.microsoft.design) and Fluent UI React v9 (@fluentui/react-components).

CRITICAL RULE: Always target Fluent UI React v9 (@fluentui/react-components) and Griffel (makeStyles, mergeClasses, shorthands). Never introduce legacy v8 (@fluentui/react / Office UI Fabric) imports, styles prop objects, or hardcoded hex/pixel values when a Fluent 2 design token exists.


Fluent 2 Core Design Principles (fluent2.microsoft.design/design-principles)

Every UI decision must embody the four official Fluent 2 pillars:

  1. Natural on every platform: Adapt fluidly to the target environment (Web, Windows, macOS) using familiar conventions while maintaining cohesive token foundations.
  2. Built for focus: Keep interfaces calm, clean, and purposeful. Rely on proximity, surface layering (Background3 -> Background2 -> Background1), and whitespace (4px grid) rather than excessive divider lines or visual clutter.
  3. One for all, all for one: Ground every interaction in Inclusive Design — WCAG 2.1 AA contrast, full keyboard operability, and High-Contrast (forced-colors) resilience.
  4. Unmistakably Microsoft: Craft trustworthy, responsive experiences through Segoe UI Variable typography, subtle elevation (shadow2..shadow64), physics-grounded motion (curveDecelerate* / curveAccelerate*), and crisp Regular -> Filled icon state transitions.

Progressive Disclosure & Reference Map

To keep context focused, read only the reference file(s) relevant to your immediate task:

Task / DomainReference FileWhen to Read
Tokens & Themingdesign-tokens.mdChoosing semantic colors (colorNeutral*, colorBrand*), typography (typographyStyles), spacing (spacingHorizontal*/Vertical*), elevation (shadow*), corners (borderRadius*), motion (duration*/curve*), or configuring FluentProvider for Light, Dark, and High-Contrast modes.
Griffel Stylinggriffel-styling.mdWriting or refactoring makeStyles, makeResetStyles, mergeClasses, and shorthands. Resolving CSS shorthand conflicts, specificity bugs, pseudo-selectors, media queries, or replacing inline styles/CSS files.
Components & Patternscomponents-and-patterns.mdSelecting and composing v9 components (Button, Card, Dialog, Drawer, DataGrid/Table, TabList, Toolbar, Menu, Popover, Toast/Toaster, Field/Input/Combobox, MessageBar), layout hierarchy, density, or desktop chrome (Tauri/Electron).
Icons & Assetsicons-and-assets.mdUsing @fluentui/react-icons: Regular vs Filled states, bundleIcon, standard sizes (16/20/24/28/48), and mandatory per-icon named imports for bundler tree-shaking.
A11y & Anti-Patternsaccessibility-and-anti-patterns.mdAuditing WCAG AA contrast, custom focus rings (createFocusOutlineStyle), keyboard navigation (Tab/Arrow/Esc), icon-only aria-label rules, or checking the pre-delivery checklist and anti-pattern catalog.

Core Non-Negotiables (Quick Checklist)

  1. Wrap Root in <FluentProvider theme={...}>

    • Every Fluent 2 tree must sit inside a FluentProvider (e.g., webLightTheme, webDarkTheme, teamsLightTheme, teamsDarkTheme, teamsHighContrastTheme, or custom brand themes built via createLightTheme(brandVariants) / createDarkTheme(brandVariants)).
    • Never hardcode light-only colors; rely on tokens.* CSS custom properties injected by FluentProvider.
  2. Use Semantic Design Tokens (tokens.*), Never Raw Values

    • Import tokens and typographyStyles from @fluentui/react-components.
    • Use surface hierarchy (colorNeutralBackground1 -> Background2 -> Background3), semantic foregrounds (colorNeutralForeground1..4), and strokes (colorNeutralStroke1..2).
    • Spread ...typographyStyles.body1, subtitle1, title2, etc., instead of ad-hoc fontSize/lineHeight pairs.
  3. Idiomatic Griffel (makeStyles + mergeClasses)

    • Define static styles at module scope with makeStyles({ ... }).
    • Combine class names exclusively with mergeClasses(styles.base, isActive && styles.active, className) — never string concatenation (${styles.a} ${styles.b}) or clsx/classnames (Griffel requires atomic property deduplication via mergeClasses).
    • Prefer longhand properties (paddingTop, borderRadius, borderTopWidth) or shorthands.* helpers to avoid Griffel CSS shorthand collision bugs.
  4. Strict Component & Form Composition

    • Always wrap form controls (Input, Combobox, Dropdown, Select, Textarea, Switch, Checkbox, RadioGroup) inside <Field label="..." validationMessage="..." validationState="..."> for automatic accessibility wiring (id, aria-labelledby, aria-describedby, aria-invalid).
    • Use Dialog -> DialogTrigger -> DialogSurface -> DialogBody -> DialogTitle + DialogContent + DialogActions.
    • Use Toast + Toaster + useToastController for transient notifications, and MessageBar for persistent inline status alerts.
  5. Tree-Shakeable Icon Imports & State Pairing

    • Import individual icons directly (import { HomeRegular, HomeFilled, bundleIcon } from '@fluentui/react-icons'). Never use import * as Icons.
    • Use Regular icons for default/resting states and Filled icons (via bundleIcon(Filled, Regular)) for active/selected/hovered navigation states.
  6. Built-In Accessibility First

    • Every icon-only Button or ToolbarButton must have an explicit aria-label (and ideally a <Tooltip content="..." relationship="label">).
    • Custom interactive elements must use createFocusOutlineStyle() so keyboard focus indicators adapt automatically across Light, Dark, and High-Contrast themes.

Standard Workflow for Agent Tasks

  1. Inspect Existing Setup: Check package.json for @fluentui/react-components and @fluentui/react-icons versions, and locate the root FluentProvider and theme definition.
  2. Consult Targeted References: Read the relevant files in ./references/ before writing or refactoring code.
  3. Implement with Tokens & Griffel: Build components using v9 slots, tokens, typographyStyles, and makeStyles + mergeClasses.
  4. Verify Quality: Cross-check your implementation against accessibility-and-anti-patterns.md before finalizing.

関連スキル