microsoft/fluentui
Patterns for FluentUI React v9 components in VS Code webviews. Use when working with any FluentUI component (Toolbar, Overflow, Menu, Button, Dialog, etc.), debugging layout or styling issues with FluentUI, implementing toolbar overflow (collapsing items into a "..." menu), or integrating FluentUI components in webview panels.
npx skills add https://github.com/microsoft/vscode-documentdb --skill fluentui
Proven patterns and project-specific knowledge for using FluentUI React v9 components in VS Code webviews.
FluentUI provides LLM-compatible documentation. Use these URLs with fetch_webpage to look up any component:
https://storybooks.fluentui.dev/react/llms.txthttps://storybooks.fluentui.dev/react/llms/components-{name}.txtcomponents-overflow.txt, components-toolbar.txt, components-menu-menu.txt, components-button-button.txtWhen working with a FluentUI component you're unfamiliar with, fetch its documentation first.
This skill covers multiple FluentUI topics. Load the relevant reference when needed:
<Overflow> toolbar alongside other elements in a layoutThe <Overflow> component measures its child's clientWidth to decide which items to hide. If the child can grow unconstrained, overflow never triggers.
The child of <Overflow> (usually <Toolbar>) MUST have:
flex-wrap: nowrap;
min-width: 0;
overflow: hidden;
Use CSS Grid, not Flexbox, when placing an overflow toolbar next to pinned elements:
.toolbarContainer {
display: grid;
grid-template-columns: auto minmax(0, 1fr);
align-items: center;
gap: 10px;
}
auto): pinned toolbar — takes its natural widthminmax(0, 1fr)): overflow toolbar — constrained to remaining spaceWhy not Flexbox? Flexbox with margin-right: auto on the first child or flex-grow: 1 on the second child fails in practice. The <Overflow> component's clientWidth measurement doesn't shrink correctly in a flex context, even with min-width: 0. CSS Grid's minmax(0, 1fr) provides a hard width constraint that the overflow manager can observe via ResizeObserver.
To push overflow items to the right edge of their column:
.toolbarContainer .fui-Overflow {
justify-content: flex-end;
}
Higher priority = overflows later (stays visible longer):
<OverflowItem id="shell" priority={1}> {/* hides first */}
<OverflowItem id="playground" priority={2}>
<OverflowItem id="copy" priority={3}>
<OverflowItem id="import" priority={6}> {/* hides last */}
Each menu item must be a separate React component to call useIsOverflowItemVisible (hook rules):
const OverflowMenuItem = ({ id, children }: { id: string; children: JSX.Element | null }) => {
const isVisible = useIsOverflowItemVisible(id);
return isVisible ? null : children;
};
display styles on OverflowItem children — The overflow manager sets display: none via the [data-overflowing] attribute. If you set display: inline-flex via an inline style={} prop, React will fight the overflow manager on re-render. Use a CSS class instead, with an explicit &[data-overflowing] { display: none; } override.<Overflow> renders no wrapper element — It clones its single child, merging a ref and the fui-Overflow class. There is no intermediate DOM node.<Toolbar> adds display: flex; align-items: center via Griffel — You don't need to add these yourself. You only need to add flex-wrap: nowrap; min-width: 0; overflow: hidden for the overflow behavior.Take microsoft/fluentui from the repository into ~/.claude/skills for personal
use, or into .claude/skills inside a project.
The agent identifies a skill by the name field in its header. Two skills with the
same name cannot sit side by side — one of them will be ignored.