Skip to content

docs(public-docsite-v9): add documentation for base state hooks and authoring patterns#35891

Open
dmytrokirpa wants to merge 2 commits intomicrosoft:masterfrom
dmytrokirpa:docs/public-docsite-9/base-hooks
Open

docs(public-docsite-v9): add documentation for base state hooks and authoring patterns#35891
dmytrokirpa wants to merge 2 commits intomicrosoft:masterfrom
dmytrokirpa:docs/public-docsite-9/base-hooks

Conversation

@dmytrokirpa
Copy link
Copy Markdown
Contributor

This pull request introduces comprehensive documentation for "Base state hooks" in Fluent UI React v9, clarifying their purpose, use cases, and authoring patterns. It also adds cross-references to this new documentation from related customization and styling concept pages, making it easier for developers to understand when and how to use base state hooks versus other customization options.

@dmytrokirpa dmytrokirpa self-assigned this Mar 22, 2026
@dmytrokirpa dmytrokirpa requested review from a team as code owners March 22, 2026 19:01
@github-actions
Copy link
Copy Markdown

github-actions bot commented Mar 22, 2026

📊 Bundle size report

✅ No changes found

@github-actions
Copy link
Copy Markdown

Pull request demo site: URL

Copy link
Copy Markdown
Contributor

@Hotell Hotell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

needs some tweaks, overall looks good, ty


Visit the **[Styling handbook](https://github.com/microsoft/fluentui/blob/master/docs/react-v9/contributing/rfcs/react-components/styles-handbook.md)** for a comprehensive styling guide, as this article only introduces basics to get you started quickly.

If you need to build a custom component architecture (not just style existing components), see [Base state hooks](?path=/docs/concepts-developer-base-state-hooks--docs).
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should probably be a blockquote right like you did in apps/public-docsite-v9/src/Concepts/AdvancedStylingTechniques.mdx ?

- Keep user `className` precedence by appending existing slot class names last.
- Validate all states visually (`:hover`, `:active`, `:focus-visible`, disabled).
- Test keyboard and screen reader behavior after custom rendering changes.
- Prefer small wrappers (`useXxxState`, `useXxxStyles`, `renderXxx`) for maintainability.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we come up with something better than xxx ?


### Stability and API lifecycle

Base state hooks use the `_unstable` suffix and are intended for advanced consumers who can absorb lower-level API evolution over time.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sure what are we saying with this one ? that we are going to do BC for them (" can absorb lower-level API evolution over time" ?

can we re-phrase this to align with existing patterns ? eg. "we follow our _unstable suffix pattern etc etc..."

});
```

#### 2) Full example: replacing slot logic and conditionally omitting slot rendering
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe we can narrow down to only 1 example, the only "major" diff with 1st example seems to be the conditional slot rendering, probably can keep only this 2nd example as showcase


They let you reuse Fluent UI behavior primitives (ARIA patterns, keyboard handling, semantic structure) while owning rendering and styling completely.

For most apps, the styled component APIs are still the right default.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should re-phrase this one to something like:

"For Fluent DS extensions existing component composition hooks are the right default."


## Base state hooks

Base state hooks are an advanced, opt-in API for teams building custom component libraries that significantly diverge from Fluent 2 visual design.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there is no notion of "Fluent 2" in our docs so this might be confusing to users. can we improve this ?


## Base state hooks

Base state hooks are an advanced, opt-in API for teams building custom component libraries that significantly diverge from Fluent 2 visual design.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lets unify here, low level vs advanced api, we should probably go with former ?


### Quick decision guide

Use styled components (`Button`, `Input`, etc.) when you want:
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should probably compare agains existing hooks instead of full fedged components ? it feels missleading

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants