packages/web-components/src/_docs/developer/migration.mdx
import { Meta } from '@storybook/addon-docs/blocks';
<Meta title="Concepts/Developer/V2 → V3 Migration Guide" />We're happy to announce Fluent Web Components v3 is now available. This document provides a high-level overview of the differences and API changes between previous versions. Please reach out if you have any questions.
Here's a snapshot of what's new and improved in v3.
A high-level look at the differences between components in v2 and v3
anchor = use link or anchor-buttonprogress = use progress-barselect = use dropdowntext-area = textareatext-field = text-inputanchored-regionslider-label = use field, labeltabs = use tablisttab-panel = use role="tabpanel"<fluent-field> wrapper to handle label spacing and errorsAPI changes, renames, and deprecations are itemized in the table below.
| Component | V2 | V3 | Notes |
|---|---|---|---|
| accordion | ✅ | ✅ | |
| accordion-item | ✅ | ✅ | ⚠️ API Change → Attributes changed to better match web platform |
| anchor | ✅ | ⚠️ | ⛔️ Renamed → See `link`, `anchor-button` |
| anchor-button | 🆕 | ||
| anchored-region | ✅ | ⚠️ | ⛔️ Deprecated |
| avatar | 🆕 | ||
| badge | ✅ | ✅ | |
| breadcrumb | ✅ | ||
| breadcrumb-item | ✅ | ||
| button | ✅ | ✅ | |
| calendar | ✅ | ||
| card | ✅ | 🚧 In Progress | |
| checkbox | ✅ | ✅ | |
| color | ✅ | ||
| combobox | ✅ | ✅ | |
| compound-button | 🆕 | ||
| data-grid | ✅ | 🚧 In Progress | |
| dialog | ✅ | ✅ | ⚠️ API Change → Split into two components to allow for more expressive modals. |
| dialog-body | 🆕 | ||
| divider | ✅ | ✅ | |
| drawer | 🆕 | ||
| drawer-body | 🆕 | ||
| dropdown | ✅ | ||
| field | 🆕 | ||
| flipper | ✅ | ||
| horizontal-scroll | ✅ | ||
| image | 🆕 | ||
| listbox | ✅ | ✅ | |
| listbox-option | ✅ | ✅ | |
| label | 🆕 | ||
| link | ✅ | (Renamed) | |
| menu | ✅ | ✅ | |
| menu-button | 🆕 | ||
| menu-item | ✅ | ✅ | |
| menu-list | 🆕 | ||
| message-bar | 🆕 | ||
| number-field | ✅ | ||
| popover | ✅ | ||
| progress | ✅ | 🔀 | ⛔️ Renamed → See `progress-bar` |
| progress-bar | ✅ | (Renamed) | |
| progress-ring | ✅ | ||
| radio | ✅ | ✅ | |
| radio-group | ✅ | ✅ | |
| search | ✅ | ||
| select | ✅ | ✅ | 🚧 In Progress |
| skeleton | ✅ | ||
| slider | ✅ | ✅ | |
| slider-label | ✅ | ⚠️ | ⛔️ Deprecated → See `label`, `field` |
| spinner | 🆕 | ||
| switch | ✅ | ✅ | |
| tab | ✅ | ✅ | |
| tabs | ✅ | ⚠️ | ⛔️ Deprecated → See `tablist` |
| tab-panel | ✅ | ⚠️ | ⛔️ Deprecated |
| tablist | 🆕 | ||
| text | 🆕 | ||
| text-area | ✅ | 🔀 | ⛔️ Renamed → See textarea |
| textarea | ✅ | (Renamed) | |
| text-field | ✅ | 🔀 | ⛔️ Renamed→ See text-input |
| text-input | ✅ | (Renamed) | |
| toolbar | ✅ | ||
| tooltip | ✅ | ✅ | ⚠️ API is different from React implementation |
| tree-item | ✅ | ✅ | 🚧 In Progress |
| tree-view | ✅ | ✅ | 🚧 In Progress |
Here's an overview of the more significant changes in the project. Other smaller changes (like attribute renaming) will be reflected in the improved Storybook docs.
Anchor is deprecated in favor of <fluent-link> (for text links) and <fluent-anchor-button> (for links that look like buttons).
The previous dialog didn't allow for expressive dialogs without the default padding and presentation (like full-width imagery). This introduction of the <fluent-dialog-body> element allows for more custom compositions.
<!-- V2 -->
<fluent-dialog>
<h1 slot="title">Title goes here</h1>
Contents go here
</fluent-dialog>
<!-- V3 -->
<fluent-dialog>
<fluent-dialog-body>
<h1 slot="title">Title goes here</h1>
Contents go here
</fluent-dialog-body>
</fluent-dialog>
We have a new form Field component to control label placement and validation errors for form controls.
<fluent-field label-position="after">
<fluent-checkbox slot="input"></fluent-checkbox>
<label slot="label" for="checkbox">Label goes here</label>
</fluent-field>
This is also used by <fluent-radio-group> (see below).
Due to web platform labelling constraints of the ShadowDOM, the labelling API for <fluent-text-input> and <fluent-textarea> is slightly different. Note that <fluent-text-input> uses the default slot for label, while <fluent-textarea> uses the label slot due to its default slot is reserved for the content inside the text area.
<fluent-text-input>
<fluent-label>Label goes here</fluent-label>
</fluent-text-input>
<fluent-textarea>
<fluent-label slot="label">Label goes here</fluent-label>
</fluent-textarea>
<fluent-radio-group id="radio-group">
<fluent-radio value="apple">Apple</fluent-radio>
<fluent-radio value="banana">Banana</fluent-radio>
</fluent-radio-group>
<fluent-field>
<label slot="label" for="radio-group">Favorite Fruit</label>
<fluent-radio-group
slot="input"
id="radio-group"
aria-labelledby="radio-group--label"
orientation="vertical"
name="favorite-fruit"
>
<fluent-field label-position="after">
<label slot="label" for="radio-group--apple">Apple</label>
<fluent-radio slot="input" id="radio-group--apple" name="favorite-fruit" value="apple"></fluent-radio>
</fluent-field>
<fluent-field label-position="after">
<label slot="label" for="radio-group--banana">Banana</label>
<fluent-radio slot="input" id="radio-group--banana" name="favorite-fruit" value="banana"></fluent-radio>
</fluent-field>
</fluent-radio-group>
</fluent-field>
A more powerful and simpler set-theme API that allows setting themes at the element level.
setThemeFor() is deprecated in favor of setTheme( theme, element )setTheme() can unset themes with setTheme(null) or setTheme( null, element )