|
| 1 | +# Fluent UI React v9 Skill |
| 2 | + |
| 3 | +Fluent UI React v9 is Microsoft's official React component library implementing the Fluent Design System. This skill provides comprehensive documentation for 100+ production-ready components, theming, accessibility, and migration guides. |
| 4 | + |
| 5 | +## Installation |
| 6 | + |
| 7 | +```bash |
| 8 | +npm install @fluentui/react-components |
| 9 | + |
| 10 | +# or |
| 11 | + |
| 12 | +yarn add @fluentui/react-components |
| 13 | +``` |
| 14 | + |
| 15 | +## Quick Start |
| 16 | + |
| 17 | +```tsx |
| 18 | +import { FluentProvider, webLightTheme, Button } from '@fluentui/react-components'; |
| 19 | + |
| 20 | +function App() { |
| 21 | + return ( |
| 22 | + <FluentProvider theme={webLightTheme}> |
| 23 | + <Button appearance="primary">Click me</Button> |
| 24 | + </FluentProvider> |
| 25 | + ); |
| 26 | +} |
| 27 | +``` |
| 28 | + |
| 29 | +## Documentation Structure |
| 30 | + |
| 31 | +The documentation is organized into these categories: |
| 32 | + |
| 33 | +### 1. Components (components-\*) |
| 34 | + |
| 35 | +Browse component documentation by searching for `components-[name]` files. Each component includes: |
| 36 | + |
| 37 | +- Props and API reference |
| 38 | +- Multiple usage examples with code |
| 39 | +- Best practices and accessibility guidelines |
| 40 | +- Common patterns and variations |
| 41 | + |
| 42 | +**Common components**: Button, Input, Dialog, Menu, Dropdown, Checkbox, RadioGroup, Table, DataGrid, Accordion, Avatar, Badge, Card, Combobox, Divider, Label, Link, MessageBar, Popover, Select, Spinner, Switch, Tabs, Tag, Textarea, Toast, Toolbar, Tooltip, Tree |
| 43 | + |
| 44 | +### 2. Concepts (concepts-\*) |
| 45 | + |
| 46 | +Foundational documentation covering: |
| 47 | + |
| 48 | +- **Quick Start** (concepts-developer-quick-start): Getting started guide |
| 49 | +- **Styling** (concepts-developer-styling-components): How to style components with Griffel CSS-in-JS |
| 50 | +- **Theming** (concepts-developer-theming): Customizing themes and design tokens |
| 51 | +- **Positioning** (concepts-developer-positioning-components): Positioning utilities |
| 52 | +- **SSR** (concepts-developer-server-side-rendering-\*): Next.js, Remix, React Router setup |
| 53 | +- **Accessibility** (concepts-developer-accessibility-\*): WCAG 2.1 AA patterns and best practices |
| 54 | +- **Advanced** (concepts-developer-advanced-\*): Advanced configuration, styling techniques, slots |
| 55 | + |
| 56 | +### 3. Migration Guides (concepts-migration-\*) |
| 57 | + |
| 58 | +Step-by-step migration guides: |
| 59 | + |
| 60 | +- **From v8**: Component mapping, color mapping, breaking changes |
| 61 | +- **From v0 (Northstar)**: Component-by-component migration guides |
| 62 | +- Search for specific components: `concepts-migration-from-v8-components-[name]-migration` |
| 63 | + |
| 64 | +### 4. Utilities (utilities-\*) |
| 65 | + |
| 66 | +Helper utilities for focus management, theme utilities, and more. |
| 67 | + |
| 68 | +### 5. Motion (motion-\*) |
| 69 | + |
| 70 | +Animation components and APIs for creating smooth transitions and effects. |
| 71 | + |
| 72 | +## How to Use This Skill |
| 73 | + |
| 74 | +### Finding Component Documentation |
| 75 | + |
| 76 | +1. **To use a component**: Search for `components-[component-name]` (e.g., `components-button`) |
| 77 | +2. **For subcomponents**: Search for `components-[parent]-[child]` (e.g., `components-table-tablecell`) |
| 78 | +3. **Read the props table**: Every component doc includes comprehensive props with types, defaults, and descriptions |
| 79 | +4. **Review examples**: Multiple examples show common usage patterns |
| 80 | + |
| 81 | +### Common Tasks |
| 82 | + |
| 83 | +**Styling a component:** |
| 84 | + |
| 85 | +```tsx |
| 86 | +import { makeStyles, Button } from '@fluentui/react-components'; |
| 87 | + |
| 88 | +const useStyles = makeStyles({ |
| 89 | + customButton: { |
| 90 | + backgroundColor: 'red', |
| 91 | + ':hover': { backgroundColor: 'darkred' }, |
| 92 | + }, |
| 93 | +}); |
| 94 | + |
| 95 | +function MyButton() { |
| 96 | + const styles = useStyles(); |
| 97 | + return <Button className={styles.customButton}>Styled Button</Button>; |
| 98 | +} |
| 99 | +``` |
| 100 | + |
| 101 | +See: concepts-developer-styling-components |
| 102 | + |
| 103 | +**Creating a custom theme:** |
| 104 | + |
| 105 | +```tsx |
| 106 | +import { FluentProvider, createLightTheme, BrandVariants } from '@fluentui/react-components'; |
| 107 | + |
| 108 | +const myBrand: BrandVariants = { |
| 109 | + 10: '#020305', // ... define all tokens |
| 110 | +}; |
| 111 | + |
| 112 | +const myTheme = createLightTheme(myBrand); |
| 113 | +``` |
| 114 | + |
| 115 | +See: concepts-developer-theming |
| 116 | + |
| 117 | +**Migrating from v8:** |
| 118 | + |
| 119 | +1. Check component mapping: concepts-migration-from-v8-component-mapping |
| 120 | +2. Find specific migration guide: concepts-migration-from-v8-components-[name]-migration |
| 121 | +3. Review breaking changes: concepts-migration-handling-breaking-changes |
| 122 | + |
| 123 | +**SSR Setup:** |
| 124 | + |
| 125 | +- Next.js App Router: concepts-developer-server-side-rendering-next-js-appdir-setup |
| 126 | +- Next.js Pages: concepts-developer-server-side-rendering-next-js-pages-setup |
| 127 | +- React Router/Remix: concepts-developer-server-side-rendering-react-router-7-and-remix-setup |
| 128 | + |
| 129 | +**Accessibility:** |
| 130 | + |
| 131 | +- Component labelling: concepts-developer-accessibility-component-labelling |
| 132 | +- Focus indicators: concepts-developer-accessibility-focus-indicator |
| 133 | +- Component-specific a11y: concepts-developer-accessibility-components-[name] |
| 134 | + |
| 135 | +## Best Practices |
| 136 | + |
| 137 | +1. **Always wrap your app in FluentProvider** with a theme |
| 138 | +2. **Use semantic HTML**: Fluent components use proper ARIA attributes |
| 139 | +3. **Prefer built-in variants**: Use `appearance`, `size`, `shape` props before custom styling |
| 140 | +4. **Follow WCAG 2.1 AA**: All components are compliant by default, maintain this in customizations |
| 141 | +5. **Use design tokens**: Reference theme tokens instead of hard-coding colors |
| 142 | +6. **Test SSR**: If using SSR, follow framework-specific setup guides |
| 143 | + |
| 144 | +## When to Use This Skill |
| 145 | + |
| 146 | +- Building React applications with Fluent UI |
| 147 | +- Implementing Microsoft Fluent Design System |
| 148 | +- Migrating from @fluentui/react (v8) or @fluentui/react-northstar (v0) |
| 149 | +- Need accessible, themeable UI components |
| 150 | +- Working with Next.js, Remix, or React Router SSR |
| 151 | +- Customizing Microsoft design language |
| 152 | +- Building enterprise React applications |
0 commit comments