fluentui-react-native
AGENTS.md1.4k starsChanged 6 months agoMITView on GitHub
The shared Copilot CLI defaults are implemented by the repository hook, not by prose instructions alone. After trusting this repository, start a new CLI session to load the hook. Node.js must be on PATH; no dependency installation is needed for the hook itself. - Read and write files inside this repository. - Run all Yarn commands, including yarn and yarn install. - Inspect Git state, stage changes, create new local commits, list branches, and fetch from origin. Do not amend…
Trending
Quiet since March.about the whole repository
Who's talking about microsoft/fluentui-react-native
- microsoft/rushstack“[rush] Why does many Microsoft open-source projects not use rush.”GitHub · Oct 31, 2021 · 3 reactions
- microsoft/react-native-macos“chore: migrate to changesets”GitHub · Feb 25, 2026 · 1 reactions
- @migueldv90.bsky.social“Microsoft is developing a UI library, but it’s still in Alpha.”Bluesky · Dec 21, 2024 · 1 likes
- microsoft/react-native-macos“docs: add explainer for gotchas with NSView based native components”GitHub · Aug 11, 2023 · 1 reactions
- microsoft/.github“ci: Add 2 bots to CLA policies”GitHub · Mar 5, 2026
The biggest 5 of 24 mentions linking to the repository that our crawl found. Each line is their own headline.
See all 24
Talked about on GitHub and Bluesky (24 times).
On GitHub · 23
- Oct 31, 2021[rush] Why does many Microsoft open-source projects not use rush. — microsoft/rushstack3 reactions · 6 comments
- Feb 25, 2026chore: migrate to changesets — microsoft/react-native-macos1 reaction · 1 comment
- Aug 11, 2023docs: add explainer for gotchas with NSView based native components — microsoft/react-native-macos1 reaction · 1 comment
- Mar 5, 2026ci: Add 2 bots to CLA policies — microsoft/.github0 reactions · 1 comment
- Sep 16, 2025Update Fabric branch to main — chrisglein/artificial-chat0 reactions
18 more on GitHub
- Dec 18, 2024Update to 0.76 — chrisglein/artificial-chat0 reactions
- Apr 24, 2024Add FURN (fluent-ui-react-native) to Gallery — microsoft/react-native-gallery0 reactions · 2 comments
- Aug 11, 2023bug: Cannot install drivers when using workspace:* with yarn 3 — appium/appium0 reactions · 5 comments
- Aug 8, 2023Files are generated under the wrong folder if no `node_modules` folder exists — microsoft/react-native-test-app0 reactions
- May 9, 2023Retarget Community Module's TargetPlatformMinVersion — microsoft/react-native-gallery0 reactions · 1 comment
- May 3, 2023Change the UI library to TUI or another — ZOPH3/WhatsThat_TS0 reactions
- May 2, 2023Move react-native-svg from dependencies to peerDependencies — microsoft/fluentui-system-icons0 reactions · 3 comments
- Apr 3, 2023Add fluent-ui-react-native controls and update various visual styles — chrisglein/artificial-chat0 reactions · 2 comments
- Mar 31, 2023Use fluent-ui-react-native controls — chrisglein/artificial-chat0 reactions · 2 comments
- Dec 31, 2022keyUpEvents/keyDownEvents check `code`, not `key` — microsoft/react-native-windows0 reactions · 8 comments
- Dec 14, 2022Setting the testID on the view does not prevent it from being removed from the view hierarchy — microsoft/react-native-windows0 reactions
- Dec 14, 2022Setting the testID on the view does not prevent it from being removed from the view hierarchy — microsoft/react-native-macos0 reactions · 1 comment
- Nov 15, 2022Remove faulty logic in ScrollView — microsoft/react-native-macos0 reactions · 2 comments
- Oct 31, 2022Aligning Avatar color hash color algorithm with web — microsoft/fluentui-apple0 reactions · 6 comments
- Oct 25, 2022fix(jest-preset): `@office-iss/react-native-win32` needs to be transformed — microsoft/rnx-kit0 reactions
- Oct 14, 2022Pressable unnecessarily re-renders if `disabled` prop is true — react/react-native0 reactions · 4 comments
- Aug 5, 2021Bumping Lage from 0.31.0 to 0.32.0 broke our monorepo's pipeline — microsoft/lage0 reactions · 3 comments
- May 14, 2020Setup E2ETest for React Native Win32/NetUI — microsoft/react-native-windows0 reactions · 4 comments
On Bluesky · 1
- Dec 21, 2024Microsoft is developing a UI library, but it’s still in Alpha. — @migueldv90.bsky.social1 likes and repost
Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about checking a change actually works.
Of the AGENTS.md files we read, the 11,773 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.
In this repository17 other files it gives its agents.
- apps/storybook/AGENTS.mdAGENTS.md
- packages/agentic/components/AGENTS.mdAGENTS.md
- packages/agentic/components/src/AGENTS.mdAGENTS.md
- packages/agentic/components/src/components/AGENTS.mdAGENTS.md
- packages/agentic/components/src/primitives/AGENTS.mdAGENTS.md
- packages/agentic/desktop-driver/AGENTS.mdAGENTS.md
- packages/deprecated/foundation-compose/AGENTS.mdAGENTS.md
- packages/framework-base/AGENTS.mdAGENTS.md
- packages/framework-base/src/accessibility/AGENTS.mdAGENTS.md
- packages/framework/framework/AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- .github/copilot-instructions.mdCopilot instructions
- agentic-component-authoringSkill
- agentic-component-contract-authoringSkill
- agentic-component-optimizationSkill
- agentic-storybook-developmentSkill
- fix-security-issuesSkill
The file
Show its rules and text
We split this AGENTS.md into the rules it gives an agent
42 rules. About 1 is common, 9 are distinctive, and 32 are very specific to this project.
≈1
Common · estimate
Many files like this have a rule of this kind.
≈9
Distinctive · estimate
This author's own choices. Worth a look.
32
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 9
After trusting this repository, start a new CLI session to load the hook.
- Distinctive: line 12
Read and write files inside this repository.
- Very specific: line 13
Run all Yarn commands, including yarn and yarn install.
- Distinctive: line 15
Do not amend commits, discard other people's changes, or rewrite history without explicit authorization.
- Very specific: line 16
Read GitHub issues, pull requests, workflow definitions, and pipeline runs using gh.
- Very specific: line 21
Run pod install (including --repo-update and --clean-install) or named pod update <Pod>...
- Very specific: line 59
Keep evidence scoped to the registered target and ignored artifact directories.
- Common: line 67
Do not commit personal permission files, account names, or credentials.
- Very specific: line 72
Run yarn test:agent-permissions after changing the policy.
- Very specific: line 163
After a major rework (e.g.
- Very specific: line 164
Before checking in moved or renamed files, run yarn lage test-links and update any repository links that still reference the old paths.
- Very specific: line 180
Run commands through the owning workspace's declared scripts.
- Very specific: line 183
Run working-directory-sensitive native tools from the owning app workspace.
- Distinctive: line 188
After fixing a failed validation step, rerun that step and its downstream checks.
- Very specific: line 190
Prefer committed *.types.test.ts coverage for compile-time contracts.
- Distinctive: line 194
Keep sessions scoped to one reviewable outcome.
- Very specific: line 235
Run yarn to install dependencies
- Very specific: line 236
Run yarn build to build all packages
- Very specific: line 257
Using Composition Framework: Use @fluentui-react-native/composition for new components.
- Distinctive: line 259
JSX Runtime: All components use the modern automatic JSX runtime:
- Very specific: line 261
Add / @jsxImportSource @fluentui-react-native/framework-base */ at the top of .tsx files
- Very specific: line 263
No need to import withSlots - it's handled automatically by the runtime
- Very specific: line 270
When checking for win32 platform: Platform.OS === ('win32' as any) - TypeScript doesn't recognize 'win32' but react-native-windows supports …
- Very specific: line 282
Use codegenNativeComponent for new architecture compatibility
- Very specific: line 294
Create the package under /packages/components/<ComponentName> or /packages/experimental/<ComponentName> while it is under development.
- Very specific: line 297
Update package.json with correct name and dependencies (use workspace:* for internal packages)
- Very specific: line 298
Add the new package's tsconfig.json to the root tsconfig.json references so it joins the unified build
- Very specific: line 299
Create source files in src/
- Very specific: line 300
Add test page to FluentTester at /apps/fluent-tester/src/TestComponents/<ComponentName>/
- Distinctive: line 302
Add E2E tests (see E2E Testing section)
- Very specific: line 303
Run yarn and yarn build from root
- Very specific: line 321
Manual Testing: Use FluentUI Tester app (/apps/fluent-tester/) for interactive component testing.
- Distinctive: line 330
Test pages must include:
- Very specific: line 333
Run E2E tests: yarn e2etest:<platform> from /apps/E2E/
- Very specific: line 343
Run pod install after adding dependencies
- Very specific: line 364
Run yarn change to create a change file when modifying packages
- Very specific: line 376
Uses modern automatic JSX runtime: - all components should use @jsxImportSource @fluentui-react-native/framework-base
- Distinctive: line 379
Follow existing component patterns for consistency
- Distinctive: line 380
Test components using FluentUI Tester app before submitting PRs
- Very specific: line 382
Use the newer composition framework (@fluentui-react-native/composition) for new components, not the deprecated foundation frameworks
- Very specific: line 383
When importing V1 components, consider aliasing: import { ButtonV1 as Button }
- Very specific: line 385
Avoid barrel exports (export * from '...').
≈ “Common” is an estimate: at least 1 in 5 of the 16,595 AGENTS.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
AGENTS.md
This file provides guidance to coding agents (Claude Code and others) when working with code in this repository.
Agent permissions
The shared Copilot CLI defaults are implemented by
the repository hook, not by prose instructions alone.
After trusting this repository, start a new CLI session to load the hook. Node.js must be on PATH;
no dependency installation is needed for the hook itself.
- Read and write files inside this repository.
- Run all Yarn commands, including
yarnandyarn install. - Inspect Git state, stage changes, create new local commits, list branches, and fetch from
origin. Do not amend commits, discard other people's changes, or rewrite history without explicit authorization. - Read GitHub issues, pull requests, workflow definitions, and pipeline runs using
gh. RESTgh apicalls to user, repository, and search endpoints are approved only for GET requests, without request-body/field flags. GraphQL and API mutations require separate approval. - Inspect the active account with
gh auth statusandgh api user --jq .login, and usegh auth switchto select an existing authenticated account when needed. Never print authentication tokens. - Run
pod install(including--repo-updateand--clean-install) or namedpod update <Pod>...operations, optionally throughbundle exec, from the owning app or itsios/macosdirectory. A project-directory argument must resolve to that app's native directory and existing Podfile. Root-level Pod invocations, updates of every pod, global cache cleanup, andpod deintegraterequire separate approval. - Inspect processes/listeners with constrained
psandlsofcommands in Bash. Probe loopback/statusand/index.jsonusingcurl -q(disable user curl configuration), GET/HEAD, and the instance's reported port. Uploads, redirects, output files, arbitrary endpoints, and process termination are not pre-approved.
The hook accepts simple Bash/PowerShell commands and && sequences when every command is approved.
cd ./<workspace> && ... is allowed only within the repository (use ./ to avoid Bash CDPATH).
In Bash, native-driver variables listed in the hook may prefix Yarn commands, directly for unquoted values
or through env, for example FURN_NATIVE_DRIVER_TEST=1 yarn test or
env "FURN_DESKTOP_DRIVER_MACOS_SIGNING_IDENTITY=FURN Development" yarn storybook build-driver --macos.
Arbitrary environment overrides, pipelines, redirections, shell expansions, unrecognized
options, remote writes, and destructive Git operations fall through to the CLI's normal permission handling;
they are not blanket-denied. Run commands separately when practical. File approvals resolve symlinks and
are limited to this repository. These defaults are not a sandbox: Yarn scripts and Git hooks can execute
arbitrary code, and explicit approvals intentionally trust them.
Native Storybook diagnostics
The existing Yarn approval covers the supported macOS, Windows, and Win32 workflows; extra blanket approvals
for Xcode, Swift, PowerShell scripts, Metro, or screen capture are unnecessary. From apps/storybook:
| Need | Preferred command |
| Project generation and Pod installation | yarn storybook prep --macos |
| Bundle failures | yarn storybook --verbose bundle --<platform> |
| Native build failures | yarn storybook --verbose build --<platform> (not Win32) |
| Driver identity, signing, and macOS privacy diagnostics | yarn desktop-driver doctor --platform macos --permissions |
| Actual listener ports and target identity | yarn storybook instance --<platform> |
| Target-scoped screenshots | yarn desktop-driver agent screenshot --platform <platform-name> --url <driver-url> --target <target-id> --artifacts artifacts/<platform> --name <name> |
| Runtime trees and crash reproduction | yarn desktop-driver agent describe ... and yarn storybook --verbose smoke --<platform> |
For agent commands, use --platform macos on macOS and --platform windows for both Windows and Win32.
Inspect retained command logs under artifacts/storybook-commands and platform artifacts rather than redirecting
output to arbitrary locations. Screenshots require a running driver/app and the operating system's own screen
recording permission; CLI approval does not grant Accessibility or Screen Recording access.
Keep evidence scoped to the registered target and ignored artifact directories. Unrestricted screencapture,
osascript, debugger attachment, external crash-report directories, certificate trust changes, and TCC resets
remain separately authorized. Do not grant these broadly to work around a failed native capability check.
Contributors can add permissions through the CLI's "don't ask again in this repo" prompt, which saves
repo-scoped approvals in their local ~/.copilot/permissions-config.json, or through --allow-tool flags.
Additional personal hooks can be defined in the gitignored .github/copilot/settings.local.json.
To opt out of hooks locally, set disableAllHooks: true there (this disables all non-policy hooks).
Do not commit personal permission files, account names, or credentials. Hook approvals precede normal
tool permission checks; disable the hook if you need CLI deny rules to govern these approved operations.
See the Copilot hooks reference and
saved permissions schema.
Run yarn test:agent-permissions after changing the policy.
Project Overview
This is the FluentUI React Native repository, a monorepo containing React Native components that implement Microsoft's Fluent Design System. The repository supports multiple platforms including iOS, Android, macOS, Windows, and Win32.
Repository Architecture
High-Level Structure
/apps/ - Demo and test applications
/fluent-tester/ - Main test app for component development
/E2E/ - End-to-end testing setup using Appium/WebDriverIO
/win32/ - Win32-specific test app
/component-generator/ - Tool to generate new components
/packages/ - Core library packages
/agentic/native-core/ - Shared modern native components and TurboModules
/components/ - UI component implementations (Button, Checkbox, Avatar, etc.)
/shim/ - Compatibility entrypoints (Callout, FocusZone, theming, etc.)
/framework/ - Core theming and composition framework
/composition/ - Component composition factory (current approach)
/theme/ - Theme system
/use-tokens/ - Token-based styling hooks
/use-slots/ - Slot-based component composition
/theming/ - Theme definitions for different platforms
/android-theme/
/apple-theme/
/default-theme/
/win32-theme/
/experimental/ - Components under active development
/deprecated/ - Old framework code (foundation-compose, foundation-composable)
/utils/ - Shared utilities and tools
/scripts/ - Build and development scripts (fluentui-scripts CLI)
/docs/ - Component and theming documentationKey Framework Concepts
Composition Framework: The repository uses @fluentui-react-native/composition (located at packages/framework/composition/) for building components. This is the current approach and is simpler than the older foundation-compose/foundation-composable frameworks in /deprecated/.
Slots: The slot pattern is used to compose higher-order components. A slot represents an inner component (actual entry in the render tree). For example, a Button might have slots for root, icon, and content. This allows advanced customization scenarios. Components wrapping a single native component typically have one slot.
Tokens: Design tokens handle styling and customization. Tokens are design-time values set via theme or component customization (e.g., "brandColor"). Tokens can also be props (specified via "TokensThatAreAlsoProps"). This system enables simpler customization and better memoization. For Flex token authoring, use packages/agentic/design/src/tokens/mappings/flex-token-map.yaml as the canonical mapping from generic CSS and Fluent token sources to grouped React Native Flex token paths. When mapping an agentic component to an existing V1 component, use the Win32, macOS, or Windows implementation as the canonical compatibility reference; do not use iOS as the cross-platform canonical value unless the work explicitly targets iOS.
Color utilities: Runtime-safe parsing, conversion, compositing, contrast, and interaction generation live behind the opt-in @fluentui-react-native/design/color-lib subpath. Keep its public exports intentionally narrow and add APIs only for demonstrated production needs. Color validation policy, semantic pairings, audit helpers, and conformance fixtures belong under packages/agentic/design/src/testing/ and are exported, when generally useful to tests, from @fluentui-react-native/design/testing. Production code must not depend on the testing subpath, and testing-only validation does not need bundle-size scenarios.
Theme-specific styles: Cache StyleSheet.create results that depend only on ThemeState with a module-scoped getter created by themedStyleSheetFactory. Treat them as immutable, and apply props, interaction state, and user styles separately so the cached sheet is safe to share between component instances.
Platform-Specific Files: Components use platform-specific files with extensions like .ios.ts, .android.ts, .win32.ts, .macos.ts for platform-specific implementations.
Legacy vs V1: Many components have both legacy and V1 implementations (e.g., Button and ButtonV1). The V1 versions use the newer composition framework and are preferred.
Build System & Commands
The repository builds as a single unified TypeScript project-references graph compiled by tsc (typescript). The root tsconfig.json lists every package's tsconfig.json under references, and yarn build runs tsc -b over that graph, building each package in dependency order. Lage orchestrates the non-build tasks (bundle, test, lint, clean), and Yarn 4 (Berry) in pnpm mode manages dependencies (configured in .yarnrc.yml).
Primary Commands (from the repo root)
yarn build # Unified TypeScript build of all packages (tsc -b); emits each package's lib/
yarn build --clean # Remove build outputs (tsc -b --clean); follow with `yarn build` for a full rebuild
yarn lage test # Build + run tests across packages
yarn lage lint # Lint across packages
yarn lint-fix # Lint with autofix (cross-env FURN_FIX_MODE=true lage lint)
yarn bundle:repo # Bundle all packages (lage bundle)
yarn lage buildci # CI aggregate graph: lint-repo, check-publishing, build, test, lint
yarn clean # Clean build artifacts (lage clean)
yarn format # Format code with oxfmt
yarn format:check # Check formatting without writingRepo-Level Checks & Housekeeping
yarn lint-repo # Repo-wide structural lint (scripts/src/tasks/lintRepo.ts)
yarn lint-lockfile # Validate the Yarn lockfile
yarn lage test-links # Validate links in repository Markdown files
yarn check-publishing # Validate package publishing configuration
yarn change # Create a change file for the current branch
yarn change:check # Verify required change files exist
yarn docs # Start the documentation siteLage Configuration
The task pipeline is defined in lage.config.mjs:
- Tasks declare dependency ordering (e.g.
testdependsOnbuild) buildciis the aggregate CI alias (lint-repo, check-publishing, build, test, lint)- Lage caches task outputs; add
--no-cacheto bypass caching and--verbosefor detailed output - After a major rework (e.g. moving packages, large refactors, or renaming exports), run
yarn lage test --no-cachefrom the root once to force every test to re-run without relying on stale cached results. This also resets the Lage cache, so subsequent plainyarn lage testruns will work incrementally again. - Before checking in moved or renamed files, run
yarn lage test-linksand update any repository links that still reference the old paths.
Package-Level Commands
Each package's own build script is tsc -b (it builds that package together with its referenced dependencies). Other per-package tasks run through the fluentui-scripts CLI (in /scripts/):
yarn build- tsc project-references build (emits tolib/)yarn lint- ESLint (fluentui-scripts lint)yarn test- Jest tests where present (fluentui-scripts jest)yarn depcheck- Unused-dependency check (fluentui-scripts depcheck)yarn format/yarn format:fix- Check / fix formatting
fluentui-scripts also retains a build command that can emit dual ESM (lib/) and CommonJS (lib-commonjs/) output driven by per-package build config, but packages on this branch build with tsc -b directly.
Agent validation and investigation discipline
- Run commands through the owning workspace's declared scripts. Inspect its
package.jsonbefore invoking an underlying runner directly; do not assume scripts such asjestorcheckexist, and do not bypass project references with ad-hoctscfile arguments. - Run working-directory-sensitive native tools from the owning app workspace. Flags such as CocoaPods'
--project-directoryselect project files but do not necessarily change subprocess resolution roots. - During iteration, use the smallest relevant test and run package lint/build early after type-heavy edits. For final validation, run format, lint, package build, package tests, then the root build when public types, manifests, or project references changed.
- After fixing a failed validation step, rerun that step and its downstream checks. Avoid repeatedly running the entire validation chain before the immediate failure is resolved.
- Prefer committed
*.types.test.tscoverage for compile-time contracts. Keep exploratory probes outside package source, or remove them before running package validation. - Review small, localized diffs directly. Use an independent review agent only after focused validation passes and only when the change still has a genuinely ambiguous or cross-cutting contract.
- Keep sessions scoped to one reviewable outcome. After capturing a durable result, start unrelated work in a fresh session so stale context and generated output do not dominate later investigation.
TypeScript Configuration
The repo uses TypeScript 7.0.2 via tsc, which is automatically added as a dev dependency to every package that has a tsconfig.json through dynamic package extensions (scripts/dynamic.extensions.mts).
The whole repo compiles as one composite project-references graph: the root tsconfig.json lists every package under references, tsc -b builds them in dependency order, and each package caches incremental state in .cache/tsconfig.tsbuildinfo.
Key TypeScript Settings
- Base config:
scripts/configs/tsconfig/tsconfig.json→ extendstsconfig.strict.json→@rnx-kit/tsconfig/tsconfig.nodenext.json target/lib:esnextmodule:esnext,moduleResolution:bundler(ESM)jsx:react-jsxrewriteRelativeImportExtensions: true(ESM relative-import extension rewriting)composite: true(required for project references),outDir: lib- Strict mode, relaxed for legacy compatibility (
strictNullChecks,noImplicitAny, andstrictBindCallApplyare disabled in the base config)
Compatibility Notes
suppressImplicitAnyIndexErrorswas removed in TS 5.8+Platform.OSdoesn't include'win32'in the React Native types even though react-native-windows supports it at runtime — usePlatform.OS === ('win32' as any)- The platform React Native forks (
react-native,react-native-windows,react-native-macos,@office-iss/react-native-win32) have overlapping but divergent type definitions. Do not import more than one fork into a single program's type graph (it produces order-dependent type confusion under the unified build). Keep fork imports in.win32.ts/.windows.ts/.macos.tsfiles, or redeclare the needed shapes platform-neutrally.
Framework Type System
The composition framework uses precise types for better type safety:
SlotFn<TProps>: Slot functions returnReact.ReactElement | null(notReactNode)- This reflects the actual behavior: slots always return elements via staged render or
React.createElement - Provides better type inference when accessing slot props (e.g.,
Slots.root({}).props)
- This reflects the actual behavior: slots always return elements via staged render or
FinalRender<TProps>: Final render functions in staged components returnJSX.Element | null- Used in composition framework's
useRenderfunctions - Ensures type compatibility between staged components and the composition system
- Used in composition framework's
Development Workflow
Setting Up Development Environment
- Clone repository
- Run
yarnto install dependencies - Run
yarn buildto build all packages - Launch FluentUI Tester app for component testing (see
/apps/fluent-tester/README.md)
Component Development
Component Location: Stable JavaScript components are in /packages/components/, components under development are in
/packages/experimental/, and compatibility packages are in /packages/shim/. Modern native components and modules share
/packages/agentic/native-core/; follow its organization plan.
Component Structure: Each component typically has:
package.json- Package definition with workspace dependenciessrc/index.ts- Main export filesrc/<Component>.tsx- Component implementation (requires/** @jsxImportSource @fluentui-react-native/framework-base */pragma)src/<Component>.types.ts- TypeScript type definitionssrc/<Component>.styling.ts- Styling and token definitionssrc/<Component>.<platform>.ts- Platform-specific implementationsSPEC.md- Component specification and usage documentationMIGRATION.md- Migration guide (for V1 components)tsconfig.json,babel.config.js,jest.config.js,eslint.config.js
Using Composition Framework: Use @fluentui-react-native/composition for new components. For simpler components without slots/tokens, use the stagedComponent pattern from @fluentui-react-native/framework-base.
JSX Runtime: All components use the modern automatic JSX runtime:
- Add
/** @jsxImportSource @fluentui-react-native/framework-base */at the top of.tsxfiles - The custom jsx-runtime intercepts JSX calls to optimize slot rendering
- No need to import
withSlots- it's handled automatically by the runtime - Components using React Fragments (
<>...</>) work automatically (Fragment is re-exported from the jsx-runtime) - Packages using the jsx-runtime need
@fluentui-react-native/framework-baseindevDependencies
TypeScript Patterns:
- Slot functions automatically return
React.ReactElement, so you can access.propsdirectly without type assertions - When checking for win32 platform:
Platform.OS === ('win32' as any)- TypeScript doesn't recognize 'win32' but react-native-windows supports it - Final render functions should return
FinalRender<TProps>with children as rest parameters:(props: TProps, ...children: React.ReactNode[])
Module Exports:
- Do not use barrel exports (
export * from '...') - wildcard re-exports break tree-shaking because bundlers cannot statically determine which symbols are used, so unused code is retained in consumers' bundles. Always use explicit named re-exports instead, e.g.export { Foo, Bar } from './module'andexport type { Baz } from './module'.
Native Modules: Callout and FocusZone implementations live in @fluentui-react-native/native-core; their former packages
are JS-only compatibility shims under /packages/shim/. Their JavaScript wrappers live in src/legacy and are exported
only from @fluentui-react-native/native-core/legacy, not native-core's root entrypoint. Components with native code:
- Typically have one root slot wrapping the native component
- Use
codegenNativeComponentfor new architecture compatibility - May use
constantsToExportfor default values from native side - iOS/macOS: Include
.podspecfiles - Native applications must directly depend on native-core for native project discovery and autolinking
For new modern native components and modules, use @fluentui-react-native/native-core rather than creating another standalone
package. Its Windows components are Fabric-only; macOS components support Paper and Fabric initially. Export shared APIs
from the root and scope platform APIs to macos, windows (React Native Windows), win (Windows/Win32), or win32.
Callout and FocusZone retain their existing public APIs and native registration names after migration.
Creating a New Component
- Create the package under
/packages/components/<ComponentName>or/packages/experimental/<ComponentName>while it is under development. Add modern native components/modules to the existing/packages/agentic/native-core/package instead. - Copy structure from existing component (e.g., Shimmer, Button)
- Update
package.jsonwith correct name and dependencies (useworkspace:*for internal packages) - Add the new package's
tsconfig.jsonto the roottsconfig.jsonreferencesso it joins the unified build - Create source files in
src/ - Add test page to FluentTester at
/apps/fluent-tester/src/TestComponents/<ComponentName>/ - Register test page in
testPages.tsxand platform-specifictestPages.<platform>.tsx - Add E2E tests (see E2E Testing section)
- Run
yarnandyarn buildfrom root - For Apple platforms: run
pod installin test app directories
Theming
Platform-specific themes are in /packages/theming/:
android-theme/- Android themingapple-theme/- iOS and macOS themingwin32-theme/- Win32 themingdefault-theme/- Cross-platform defaultstheme-tokens/- Token definitionstheme-types/- TypeScript types for themes
Components require ThemeProvider from @fluentui-react-native/design/theming to work properly.
Testing
Manual Testing: Use FluentUI Tester app (/apps/fluent-tester/) for interactive component testing. Test pages are in /apps/fluent-tester/src/TestComponents/.
E2E Testing: Required for all new components. Uses Appium + WebDriverIO.
- E2E tests live in
/apps/E2E/src/<ComponentName>/ - Each component needs:
- Page Object (
<Component>PageObject.<platform>.ts) - Interface to interact with test page - Spec Document (
<Component>Spec.<platform>.ts) - Jasmine test cases - Constants file in test component (
/apps/fluent-tester/src/TestComponents/<Component>/consts.ts)
- Page Object (
- Test pages must include:
testIDon first section matching page object's_pageName- Optional
e2eSectionsprop for dedicated E2E test elements
- Run E2E tests:
yarn e2etest:<platform>from/apps/E2E/
Unit Tests: Component-specific Jest tests where present, typically in src/ directories. Run them with yarn test in a package or yarn lage test from the root. After a major rework, run yarn lage test --no-cache once at the root to ensure all tests re-run and pass without stale cache hits; this resets the Lage cache so a normal incremental yarn lage test works afterward.
Platform-Specific Development
iOS/macOS:
- May wrap native controls from FluentUI Apple
- Requires
.podspecfiles for native modules - Run
pod installafter adding dependencies
Android:
- Platform-specific styling and tokens
- Uses
accessibilityLabelfor E2E selectors (other platforms usetestID)
Win32:
- Separate test app at
/apps/win32/ - Uses WinAppDriver for E2E testing
Windows (UWP):
- Separate test app configuration
- Legacy support
Version Management
Changesets: Used for change logs and versioning.
- Run
yarn changeto create a change file when modifying packages - Change files are required before merging PRs (validated in CI via
yarn change:check) - Changesets config in
.changeset/config.json - Major versions are disallowed (validated in CI via
.github/scripts/validate-changesets.mts) - Version bump PRs are created automatically by GitHub Actions;
yarn changeset:versionapplies version bumps - Publishing happens in Azure Pipelines using
.ado/azure-pipelines.publish.yml
Important Notes
- This is an alpha-stage library under active development
- Requires TypeScript 7.0.2 (
typescript, compiled viatsc); the unified build runstsc -bover the root project-references graph - Uses Yarn 4 in pnpm mode for dependency management (configured in
.yarnrc.yml) - Uses modern automatic JSX runtime - all components should use
@jsxImportSource @fluentui-react-native/framework-base - Dynamic package extensions: Common dev dependencies (TypeScript, Jest, ESLint, Prettier) are automatically added via
scripts/dynamic.extensions.mts - New packages must be added to the root
tsconfig.jsonreferencesto join the unified build - Follow existing component patterns for consistency
- Test components using FluentUI Tester app before submitting PRs
- Platform differences should be documented in component
SPEC.mdfiles - Use the newer composition framework (
@fluentui-react-native/composition) for new components, not the deprecated foundation frameworks - When importing V1 components, consider aliasing:
import { ButtonV1 as Button } - Slot functions return
React.ReactElement- you can safely access.propswithout type assertions - Avoid barrel exports (
export * from '...'); use explicit named re-exports to preserve tree-shaking
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

