# fluentui-svelte Fluent UI 2 components for Svelte 5, published on npm as `fluentui-svelte`. The components use runes, snippets and plain event attributes (`onclick`), so write consumer code the same way: no `export let`, no slots, no `on:click`. The styles rely on CSS that only Chromium ships today (`field-sizing`, unprefixed `mask`, `backdrop-filter`). In Firefox and Safari some visuals degrade; behaviour and accessibility do not. Written for fluentui-svelte `0.7.2`. When the installed version (`node_modules/fluentui-svelte/package.json`) differs, the guides inside `node_modules` win. ## Before writing code 1. Find the component in the [index](#components) at the end of this file. 2. Read its guide before using it. The installed package ships one per component, matching its version: `node_modules/fluentui-svelte/dist/components//docs/llms.md`. Without the package installed, fetch `https://fluentui-svelte.dev/docs/components/.md`. 3. Use only the props the guide lists. Do not carry props over from Fluent UI React, WinUI or other Svelte libraries: the names and behaviour differ. ## Setup ```sh npm i -D fluentui-svelte ``` Import the stylesheets once, in the root layout (`src/routes/+layout.svelte` in SvelteKit), and wrap the app in `FluentUISvelte`. The provider starts the keyboard navigation engine: without it the components render, but arrow keys do not move focus inside lists, menus, trees and tables. ```svelte {@render children()} ``` - Dark mode: pick **one** of `class-darkmode.css` (a `dark` class on ``, which `` from `mode-watcher` sets; switch it with `setMode('dark' | 'light' | 'system')` or `toggleMode()`) and `media-darkmode.css` (follows `prefers-color-scheme`, no JavaScript). `mode-watcher` is already a dependency of the library. The provider does not render `` for you. - `FluentUISvelte` takes only `children` (and an optional `tabspotInstance`). It has no theme or reduced-motion props; reduced motion follows the operating system. - Everything is exported from the package root: `import { Button, Dialog } from 'fluentui-svelte'`. ## Rules every component follows **Icons** come from `fluentui-icons-svelte` (6,000+ Fluent icons as Svelte components). The library depends on it, but an app that imports icons itself must install it too: `npm i -D fluentui-icons-svelte`. Browse the names at https://fluentui-icons-svelte.pages.dev/icons. Import each icon from its own file, never from the package root. The root re-exports thousands of components, and Vite prebundles all of them in dev (minutes of cold start): ```svelte ``` Icon props (`icon`, `indicatorIcon`, `iconBefore`, `media`, `expandIcon`, …) take either the component itself (`icon={AddRegular}`) or a snippet when the icon needs its own props: `{#snippet add()}{/snippet}`. **Bound state starts at `null`, not `undefined`.** Every `$bindable` prop defaults to `null` (or another simple value), and Svelte throws when you `bind:` a prop with a default to `undefined`: ```svelte ``` **Where attributes go.** Attributes passed straight to a component (`id`, `name`, `required`, `class`, `aria-*`, `oninput`, …) land on the element that holds the value or does the job: the native ``/`` with `appearance: base-select`. That needs Chrome or Edge 135+ or Safari 27+, and Chrome or Edge 145+ with `multiple`; other browsers, Firefox included, show the native select without rich option content. Use `Dropdown` when the select must look the same in every browser. ## SSR (SvelteKit) Components render on the server. A few need data the server cannot read from the markup: - `DropdownOption`: pass `text`, or the button shows the raw value until hydration. - `TagPicker`: tags show the raw values on the server unless a custom `tag` snippet renders the text. - `CalendarView`: pass `today` (built from year, month and day) so server and browser agree on the date; `CalendarDatePicker` needs the visitor's `timeZone` in `format`. - Menu popovers are not in the server HTML; arrow-key navigation starts after hydration. - Never read `document` or `window` in markup or at the top of ` This is the content of the app. ``` ## Examples ### Mode `layer`, the default, is a layer over the window, with the stroke of a card. `mica` paints the base of the window itself, with the stroke of a control surface. ```svelte
Layer
Mica
``` ### Active and Inactive `active` tells whether the window the surface lives in is the active one. A `layer` is solid while active and translucent while inactive, which is the default; `mica` paints the same base in both states. Set it from the same focus state as the window. ```svelte
Layer
``` ## Component Props | Name | Type | Default | Description | | --------------------------------------------------- | ------------------------- | --------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------- | | `ref` _bindable_ | `HTMLElement` | | The DOM reference of the surface element. | | `mode` | `'layer'` | `'mica'` | `'layer'` | The material of the surface: a `layer` over the window, or the `mica` of the window itself. | | `active` | `boolean` | `false` | Whether the window the surface lives in is active, which picks the surface color. Inherits AppWindow's active state when omitted, or false when standalone. | | `children` | `Snippet` | | The content of the surface. | | `HTMLAttributes` without `children` | | | | --- # AppWindow > Part of fluentui-svelte. Read the global guide first (setup, rules and pitfalls): https://fluentui-svelte.dev/docs/llms.md, also shipped as node_modules/fluentui-svelte/skills/fluentui-svelte/SKILL.md An app window is the surface of an app: a Mica window with its own border and a shell shadow that tells the active window from the inactive ones. It is built on the Flyout, so it takes its content the same way, and it fills the space around it unless you give it a size. ## Usage Start with a `TitleBar` if the window has one, then place page content in an `AppSurface` or another scrollable container. The window itself clips overflow. It is `100%` wide and tall unless you give it a `width` and a `height`. ```svelte {#snippet leftControls()} {/snippet} {#snippet rightControls()} {/snippet} This is the content of the window. ``` ## Examples ### Size `width` and `height` take a number in pixels or any CSS length. By default they take `100%` of their container. ```svelte
``` ### Active and Inactive `active` picks the shell shadow the window casts: the lighter one of an inactive window, which is the default, or the deeper one of the active window. Set it from the focus state of the window your app lives in. ```svelte ``` ### With a Title Bar The window paints the Mica background, so a `TitleBar` inside it stays transparent and sits right on it. ```svelte {#snippet leftControls()} {/snippet} {#snippet search()} {/snippet} {#snippet rightControls()} {/snippet} This is the content of the window. ``` ## Shared window context AppWindow creates a context per instance. Descendant components can call the exported `getAppWindowContext()` during initialization; it returns null outside AppWindow. Call it inside a child component, rather than in the parent that renders AppWindow. `config.width` and `config.height` expose window dimensions. `state` contains the window `ref`, `active`, `maximized`, `minimized`, and registered `sideNav`, `titleBar`, `globalNav` and `appSurface` parts. Parts are null until mounted and are cleared on unmount. SideNav exposes live `collapsed`, `floating`, `position` and `ref` getters, and `setCollapsed(event, collapsed)`. `globalNav` is the global navigation button of the TitleBar (`TitleBarLeftControls`): its `ref` and `enabled`, which tells SideNav to hide its own hamburger. Nested AppWindow instances have independent contexts. The host reports maximized/minimized through AppWindow props; these flags do not invoke native APIs or hide the window. TitleBarRightControls inherits maximized unless explicitly overridden. AppSurface inherits active unless overridden and removes its corner radii while its window's SideNav is floating and collapsed. ```svelte

Maximized: {appWindow?.state.maximized ?? false}

Minimized: {appWindow?.state.minimized ?? false}

Navigation collapsed: {appWindow?.state.sideNav?.collapsed ?? false}

``` ## Component Props | Name | Type | Default | Description | | --------------------------------------------------- | --------------------------- | -------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- | | `ref` _bindable_ | `HTMLElement` | `null` | | The DOM reference of the window element. | | `width` | `number` | `string` | `'100%'` | The width of the window. A number is in pixels, a string is any CSS length. | | `height` | `number` | `string` | `'100%'` | The height of the window. A number is in pixels, a string is any CSS length. | | `active` | `boolean` | `false` | Whether the window is the active one, which picks the shell shadow it casts: a deeper one while active, a lighter one while inactive. | | `maximized` _bindable_ | `boolean` | `false` | The maximized state reported by the host. Shared through AppWindow context and inherited by TitleBarRightControls when its maximized prop is omitted. | | `minimized` _bindable_ | `boolean` | `false` | The minimized state reported by the host. Shared with window descendants; it does not call a native window API or hide the component. | | `children` | `Snippet` | | The content of the window, such as a `TitleBar` and the page below it. | | `HTMLAttributes` without `children` | | | | --- # AutoSuggestBox > Part of fluentui-svelte. Read the global guide first (setup, rules and pitfalls): https://fluentui-svelte.dev/docs/llms.md, also shipped as node_modules/fluentui-svelte/skills/fluentui-svelte/SKILL.md The AutoSuggestBox component provides an input field with dynamic suggestions as users type. It enhances user experience by offering relevant suggestions, improving efficiency in form inputs and searches. ## Usage ```svelte Apple Banana Cherry ``` ## Examples ### Open on focus Use `openOnFocus` to show suggestions as soon as the text box receives focus, before anything is typed. ```svelte {#each fruits as fruit, index (fruit.id)} {fruit.name} {/each} ``` ### Virtualization Window large suggestion sets by connecting AutoSuggestBox to a virtual list through the `virtualizer` prop. Its `size` is the total number of suggestions, while each option keeps its real `index`. ```svelte listRef.scroll({ index: 0, align: 'top', smoothScroll: false }), scrollToBottom: () => listRef.scroll({ index: people.length - 1, align: 'bottom', smoothScroll: false }), scrollToIndex: (index) => listRef.scroll({ index, align: 'auto', smoothScroll: false }) }} > {#snippet renderItem(person, index)} {person.name} {/snippet} ``` ### Multiselect Allow people to choose several suggestions and optionally show the selected values in the text box. ```svelte {#each fruits as fruit, index (fruit.id)} {fruit.name} {/each} ``` ### Virtualization with filtering A virtualized list must filter its source data itself and report the filtered length through `virtualizer.size`. ```svelte listRef.scroll({ index: 0, align: 'top', smoothScroll: false }), scrollToBottom: () => { if (items.length) listRef.scroll({ index: items.length - 1, align: 'bottom', smoothScroll: false }); }, scrollToIndex: (index) => listRef.scroll({ index, align: 'auto', smoothScroll: false }) }} textChanged={(_, value) => { const query = value.trim().toLowerCase(); items = people.filter(({ name }) => name.toLowerCase().includes(query)); }} > {#snippet renderItem(person, index)} {person.name} {/snippet} ``` HTML attributes, including class, id and ARIA attributes, apply to the control element. Bind ref to access that control. Use wrapperAttributes and wrapperRef for the outer container. ## Component Props | Name | Type | Default | Description | | ------------------------------------------------------------------------------------------------- | --------------------------------------------------------------- | -------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `wrapperRef` _bindable_ | `HTMLDivElement` | `null` | | The DOM reference of the wrapper element. | | `ref` _bindable_ | `HTMLInputElement` | `null` | | The DOM reference of the text box element. | | `value` _bindable_ | `string` | `''` | The current text of the box. | | `open` _bindable_ | `boolean` | `false` | Controls the open state of the suggestion list. | | `multiselect` | `boolean` | | Lets more than one suggestion be chosen, and keeps the list open after each one. | | `selectOnFocus` | `boolean` | | Mirrors the suggestion under the cursor into the text box as it is walked over. Not supported together with `multiselect`. | | `openOnFocus` | `boolean` | `false` | Opens the suggestion list as soon as the text box takes focus, instead of waiting for the first keystroke. Useful on touch devices, which have no arrow key to open the list with. | | `showTextualMultiselect` | `boolean` | | Lists every chosen suggestion in the text box, comma separated. Multiselect only. | | `notFoundText` | `string` | `'No results found'` | The message shown in place of the list when nothing matches. | | `selectedOptions` _bindable_ | `{ id: string; value: string }[]` | `[]` | The suggestions currently chosen. | | `suggestionChosen` | `(e: Event, selection: string) => void` | | Called when a suggestion is chosen: by clicking it, by pressing Enter on it, or by walking onto it while `selectOnFocus` is set. | | `querySubmitted` | `(e: MouseEvent` | `KeyboardEvent, query: string) => void` | | Called when Enter is pressed with no suggestion under the cursor, or when the search button is clicked. This is where a fresh set of suggestions is fetched. Enter then also submits the form with the typed text, unless the event is prevented. | | `virtualizer` | `AutoSuggestVirtualizer` | | Bridge to a windowed list, for suggestion sets too long to render whole. | | `maxItemsInView` | `number` | `6` | How many suggestions are visible before the list scrolls. | | `wrapperAttributes` | `HTMLAttributes` | | The attributes to spread on the wrapper element. | | `flyoutRef` _bindable_ | `HTMLElement` | `null` | | The DOM reference of the flyout holding the suggestion list. | | `flyoutProps` | `FlyoutProps` | | The props to spread on the flyout. | | `listViewRef` _bindable_ | `HTMLUListElement` | `null` | | The DOM reference of the suggestion list. | | `listViewProps` | `ListViewItemProps` | | The props to spread on the suggestion list. | | `shape`, `type`, `placeholder`, `hideActionButtons`, `textChanged`, `onClear` from `TextBoxProps` | | | | | `HTMLInputAttributes` without `value`, `type`, `role`, `size`, `placeholder` | | | | ## AutoSuggestBoxOption Props | Name | Type | Default | Description | | ----------------------------------------------- | ----------------------------- | ------- | ----------------------------------------------------------------------------------------------------------------------------- | | `value` | `string` | | The value reported to the box when the suggestion is chosen. Falls back to the id. | | `text` | `string` | | The text shown in the box once the suggestion is chosen. Falls back to `value`. | | `id` | `string` | | The id of the option element, referenced by the box through `aria-activedescendant`. Falls back to a generated id. | | `ref` _bindable_ | `HTMLLIElement` | `null` | | The DOM reference of the option element. | | `disabled` | `boolean` | | Takes the suggestion out of reach: it is shown, but the cursor steps over it. | | `index` | `number` | | Where the suggestion sits in the whole set. A windowed list needs the real index, not the position within the rendered slice. | | `ListViewItemProps<'li'>` without `as`, `value` | | | | --- # Avatar > Part of fluentui-svelte. Read the global guide first (setup, rules and pitfalls): https://fluentui-svelte.dev/docs/llms.md, also shipped as node_modules/fluentui-svelte/skills/fluentui-svelte/SKILL.md An Avatar is a graphical representation of a user, team, or entity. Avatar can display an image, icon, or initials, and supports different sizes, shapes, and status indicators. ## Usage ```svelte ``` ## Component API A brief explanation of the props that really need explaining. You can see the rest of the props in the Component Props table below. ## Examples ### Image An avatar can display an image. It is recommended to also include a name in addition to the image: the initials from the name are displayed while the image is loading, and the name makes the Avatar accessible to screen readers. ```svelte ``` ### Icon An avatar can display an icon. The icon will only be shown when there is no image or initials available. ```svelte ``` ### Badge An avatar can have a badge to indicate presence status. See the PresenceBadge component for more info. ```svelte ``` ### Shape An avatar can have a square, circular, or rounded shape. ```svelte ``` ### Color: colorful An avatar can have its color automatically picked based on the name prop, or idForColor can be used if a name is not available. ```svelte ``` ## Component Props | Name | Type | Default | Description | | ------------------ | ------------------------------------------------------------------------------ | ------------- | --------------------------------------------------------------------------------------------------------------- | | `name` | `string` | `'Avatar'` | The name of the person or entity represented by this Avatar. This should always be provided if it is available. | | `image` | `{ src: string; }` | | The Avatar's image | | `ref` _bindable_ | `HTMLDivElement` | `null` | | The DOM reference of the avatar element. | | `size` | `number` | `48` | Size of the avatar in pixels. | | `shape` | `'circular'` | `'rounded'` | `'square'` | `'circular'` | The avatar can have a circular, rounded or square shape. | | `color` | [`Colors`](https://fluentui-svelte.dev/docs/types/#colors) | `'colorful'` | `'attention'` | The color when displaying either an icon or initials. For now it only supports system colors (plus colorful). | | `active` | `'active'` | `'inactive'` | | Optional activity indicator | | `activeAppearance` | `'ring'` | `'shadow'` | `'ring-shadow'` | `'ring'` | The appearance when `active="active"` | | `initials` | `string` | `name` | Custom initials by default they will be derived from the `name` prop. | | `idForColor` | `string` | | Specify a string to be used instead of the name, to determine which color to use when color="colorful". | | `icon` | `Snippet` | `Component` | | Icon to be displayed when the avatar doesn't have an image or initials. | | `badge` | `BadgePresence` | | The badge to display as a status indicator. (you can use with a custom icon) | | HTML Attributes | | | | --- # Badge > Part of fluentui-svelte. Read the global guide first (setup, rules and pitfalls): https://fluentui-svelte.dev/docs/llms.md, also shipped as node_modules/fluentui-svelte/skills/fluentui-svelte/SKILL.md A badge is a visual decoration for UI elements used to display notifications, status indicators, or counts. It supports different colors and styles to match various UI needs. ## Usage ```svelte 36 ``` ## Badge API A brief explanation of the props that really need explaining. You can see the rest of the props here. ## Examples ### Appearance Use the appearance prop to switch between filled, outline, tint, and ghost styles. ```svelte 5 5 5 5 ``` ### Sizes Use the size prop to control the badge dimensions. ```svelte 46 56 64 96 ``` ### Shapes Use the shape prop to render circular, rounded, or square badges. ```svelte 36 36 36 ``` ### Color Use the color prop to communicate different statuses and priorities. ```svelte I A W C S ``` ### Icon Use the icon prop to render an icon inside the badge. You can pass the icon as a snippet or as a component. > **Only icon?** If you use this component and notice padding between the wrapper and the icon, use the BadgeIcon component instead to avoid it. ```svelte ``` ## Badge Props | Name | Type | Default | Description | | ---------------- | -------------------------------------------------------------- | --------------- | ----------------------------------------------------------------------------------------- | | `size` | `number` | `20` | The size of the badge in pixels. | | `shape` | `'circular'` | `'rounded'` | `'square'` | `'circular'` | The badge can have a circular, rounded or square shape. | | `appearance` | `'filled'` | `'outline'` | `'ghost'` | `'tint'` | `'filled'` | The badge can have its background and border styled for greater emphasis or to be subtle. | | `iconPosition` | `'before'` | `'after'` | `'before'` | The position of the icon relative to the badge content. | | `color` | [`Colors`](https://fluentui-svelte.dev/docs/types/#colors) | `'information'` | The color of the badge. For now it only supports system colors. | | `icon` | `Snippet` | `Component` | | Icon to render inside the badge. | | `ref` _bindable_ | `HTMLSpanElement` | `null` | | The DOM reference of the badge element. | | HTML Attributes | | | | ## BadgeIcon API This component is useful when you want to show an icon in the form of a Badge somewhere in your app. ### Usage ```svelte ``` One example is using this component inside Avatar: By default, Avatar uses an instance of BadgeIcon. As you can see, the first example on the left uses the Badge component, which adds unwanted padding inside it. In Avatar, you can use one of the predefined BadgeIcon options, or set a custom icon by passing it as a property. When you use the component option, the styles are applied automatically, but with #snippet you need to make sure you pass the arguments to the icon like this: ```svelte {#snippet customBadge(args)} {/snippet} ``` ### BadgeIcon Props | Name | Type | Default | Description | | ---------------- | -------------------------------------------------------------- | ------------- | ---------------------------------------------------------------------------------- | | `status` | [`Statuses`](https://fluentui-svelte.dev/docs/types/#statuses) | `'available'` | The presence status to display. It picks both the icon and the color of the badge. | | `outOfOffice` | `boolean` | `false` | Decorates the presence icon to signal that the person is out of office. | | `size` | `number` | `20` | The size of the badge in pixels. | | `color` | [`Colors`](https://fluentui-svelte.dev/docs/types/#colors) | | Overrides the color the status would pick on its own. | | `icon` | `Snippet` | `Component` | | Custom icon, rendered instead of the one the status would pick on its own. | | `ref` _bindable_ | `HTMLSpanElement` | `null` | | The DOM reference of the badge element. | | HTML Attributes | | | | --- # Breadcrumb > Part of fluentui-svelte. Read the global guide first (setup, rules and pitfalls): https://fluentui-svelte.dev/docs/llms.md, also shipped as node_modules/fluentui-svelte/skills/fluentui-svelte/SKILL.md A breadcrumb shows where a page sits in the hierarchy above it, and gives the reader a way back up. It renders a `nav` landmark around an ordered list, so a screen reader can jump straight to it. The landmark names itself `Breadcrumb`, the trail is an `ol` so its order is part of the markup rather than of the styling, the last step carries `aria-current="page"`, and the dividers are held out of the accessibility tree — a trail of three steps reads as three, not as five. Every one of those can be overridden: pass your own `aria-label`, or an `aria-labelledby`, and the default steps aside. To create a breadcrumb, you will need to use the following components: - `Breadcrumb`: The landmark and the list. It creates the context the rest read. - `BreadcrumbItem`: One step of the trail — the list item the step lives in. It takes anything, not only a step. - `BreadcrumbButton`: A step that can be activated: an anchor when it goes somewhere, a button when it does something. - `BreadcrumbDivider`: The mark between two steps. It is decoration, and is hidden from assistive technology. ## Usage A breadcrumb is a list of steps with a divider between them. The last step is the page the reader is already on, so it is marked `current` rather than linked away. ```svelte Home Files Quarterly report ``` ## Examples ### Size `size` sets the type, the height and the divider of every step at once. ```svelte ... ... ... ``` ### Icon `icon` takes a snippet or a component and renders it beside the label, on the side `iconPosition` asks for. ```svelte Files ``` ### Current Step `current` marks the step as the page the trail ends at. It announces `aria-current="page"` and reads as text rather than as a way out, so the last step does not offer to take the reader where they already are. ```svelte Quarterly report ``` ### Overflow Menu A step takes whatever you put in it, so a long trail folds its middle into a menu by making that menu a step of its own. Which steps fold is your call — slice the list wherever the layout needs it. ```svelte {#each head as item (item.name)} {item.name} {/each} {#snippet children({ state, menuTriggerProps })} {/snippet} {#each folded as item (item.name)} {item.name} {/each} {#each tail as item (item.name)} {item.name} {/each} ``` The label on the menu button is yours to write, and it is worth writing: a trigger with only an icon says nothing to a screen reader. Note also that what lives inside a `MenuPopover` is not rendered until the menu opens, so the folded steps are not in the HTML a crawler reads. ### Focus Mode `focusMode` decides how the focus walks the trail. `tab`, the default, leaves every step its own tab stop, which is what a reader expects of a row of links. `arrow` gives the whole trail a single tab stop and moves between steps with the arrow keys, with `Home` and `End` for the ends. ```svelte ... ``` ## Component Props (Breadcrumb) | Name | Type | Default | Description | | -------------------- | -------------------------------------------- | ---------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------- | | `ref` _bindable_ | `HTMLElement` | `null` | | The DOM reference of the `nav`. | | `listRef` _bindable_ | `HTMLOListElement` | `null` | | The DOM reference of the list. | | `listAttributes` | `HTMLOlAttributes` | | The attributes to spread on the list element. | | `size` | `'small'` | `'medium'` | `'large'` | `'medium'` | The size of every step and divider of the trail. | | `focusMode` | `'tab'` | `'arrow'` | `'tab'` | How the focus walks the trail: `tab` leaves every step its own tab stop, `arrow` gives the trail a single one and moves between steps with the arrow keys. | | Element Attributes | | | | ## Component Props (BreadcrumbItem) | Name | Type | Default | Description | | ------------------------- | ----------------------------- | ------- | ------------------------------ | | `ref` _bindable_ | `HTMLLIElement` | `null` | | The DOM reference of the item. | | Element Attributes (`li`) | | | | ## Component Props (BreadcrumbButton) | Name | Type | Default | Description | | ------------------- | --------------------------------- | ---------- | ------------------------------------------------------------------------------------------------------ | | `ref` _bindable_ | `BreadcrumbItemElementDOMType[T]` | | The DOM reference of the step. | | `as` | `'button'` | `'a'` | `'button'` | The DOM element to render. A step that goes somewhere is an anchor and takes `href`. | | `icon` | `Snippet` | `Component` | | The icon to display beside the label. | | `iconPosition` | `'before'` | `'after'` | `'before'` | Which side of the label the icon sits on. | | `current` | `boolean` | `false` | Marks the step as the page the trail ends at, which is what `aria-current` announces. | | `disabled` | `boolean` | | Disables the user interaction. | | `disabledFocusable` | `boolean` | `false` | Keeps a disabled step focusable, so the tab order stays the same for a keyboard or screen reader user. | | HTML Attributes | | | | ## Component Props (BreadcrumbDivider) | Name | Type | Default | Description | | ------------------------- | ----------------------------- | ------- | --------------------------------- | | `ref` _bindable_ | `HTMLLIElement` | `null` | | The DOM reference of the divider. | | Element Attributes (`li`) | | | | ## Accessibility The landmark is named `Breadcrumb` by default, which is what a screen reader announces when jumping to it. Give it your own `aria-label` when a page carries more than one trail, so each is distinguishable, or an `aria-labelledby` pointing at a heading you already render — the default steps aside for both. The dividers are decoration and are hidden, so the list reads as the number of steps it has. The last step carries `aria-current="page"`. A step with an icon and no label needs an `aria-label` of its own. Structured data is left to you. A breadcrumb is one of the few components a search engine reads directly, through `BreadcrumbList` from schema.org, but the text of a step lives in your markup and the URLs live in your routing — so the trail you publish is yours to build, in whichever shape your site already uses. --- # Button > Part of fluentui-svelte. Read the global guide first (setup, rules and pitfalls): https://fluentui-svelte.dev/docs/llms.md, also shipped as node_modules/fluentui-svelte/skills/fluentui-svelte/SKILL.md A button triggers an action or event when activated and supports three visual appearances: accent, standard, and subtle. ## Usage ```svelte ``` ## Component API A brief explanation of the props that really need explaining. You can see the rest of the props in the Component Props table below. ## Examples ### As You can control which tag the button component should use: button, a, or div. ```svelte ``` ### Shape A button can be rounded, circular, or square. Default: rounded. ```svelte {/snippet} Preview

Lorem ipsum dolor sit amet, consectetur adipiscing elit.

``` ## Component API A card is built out of the following components: - `Card`: the root component. It creates all the state, provides context to its parts and handles the selection. - `CardPreview`: the media shown at one edge of the card, with an optional logo overlaid on it. - `CardHeader`: the title of the card, with an optional image, description and action. - `CardFooter`: the actions shown at the bottom of the card. `CardPreview`, `CardHeader` and `CardFooter` read the card context, so they throw when rendered outside a `Card`. They are all optional, and the card renders any other content passed to it as is. The following combinations are rejected at runtime, because they cannot be resolved visually: - `showFloatingAction` without `selectable`. - `selected` without `selectable`. - `as="a"` together with `selectable`. - `action` on `CardHeader` or `CardFooter` inside a selectable card. ## Examples ### Appearance A card can have its background and borders styled for greater emphasis or to be subtle. ```svelte Filled Outlined Subtle ``` ### Orientation A card lays its parts out horizontally by default. Set `orientation` to `vertical` to stack them instead. ```svelte Preview Preview ``` ### Selection A selectable card toggles its selection when clicked anywhere, and reports it through `onSelectionChange`. Set `showFloatingAction` to float a checkbox over the top right corner. ```svelte console.log(id, selected)}> ``` ### Header The header takes a `title`, and optionally an `image`, a `description` and an `action`. A string title renders inside a heading; a snippet or a component receives the id the floating checkbox is labelled by. ```svelte {#snippet title(attrs)}

FluentUI Svelte mentioned you

{/snippet} {#snippet action()} {/snippet} ``` ### Preview The preview holds the media of the card and rounds the corners it sits against. The `logoSrc` prop overlays a logo on the bottom left corner. ```svelte Preview ``` ### Footer The footer renders the actions of the card at the bottom, spread across the available width. ```svelte {#snippet action()} {/snippet} ``` ## Component Props | Name | Type | Default | Description | | --------------------- | ---------------------------------------------------------- | -------------- | --------------------------------------------------------------------------------------- | | `ref` _bindable_ | `CardElementDOMType[Tag]` | | The DOM reference of the card element. | | `as` | `'div'` | `'article'` | `'section'` | `'a'` | `'div'` | The DOM element to render. | | `orientation` | `'horizontal'` | `'vertical'` | `'horizontal'` | The axis the card lays its parts out on. | | `selectable` | `boolean` | `false` | Lets the user select the card by clicking anywhere on it. | | `showFloatingAction` | `boolean` | `false` | Floats the selection checkbox over the top right corner of the card. | | `id` | `string` | | The id of the card element. Falls back to a generated one. | | `selected` _bindable_ | `boolean` | `false` | Whether the card is selected. Only available on selectable cards. | | `disabled` | `boolean` | `false` | Disables the user interaction. | | `appearance` | `'filled'` | `'outlined'` | `'subtle'` | `'filled'` | A card can have its background and borders styled for greater emphasis or to be subtle. | | `onSelectionChange` | `(id: string, selected: boolean) => void` | | Called with the id of the card whenever its selection changes. | | HTML Attributes | | | | ## CardPreview The media shown at one edge of the card, with an optional logo overlaid on it. ### Component Props | Name | Type | Default | Description | | --------------------------------------------------- | ------------------------------ | ------- | --------------------------------------------------------------------------------------- | | `ref` _bindable_ | `HTMLDivElement` | `null` | | The DOM reference of the preview element. | | `logoSrc` | `string` | | The URL of the logo overlaid on the bottom left corner of the preview. | | `logoAlt` | `string` | `''` | The alternative text of the logo. Empty by default, which marks the logo as decorative. | | `children` | `Snippet` | | The media to preview, usually an image. | | `HTMLAttributes` without `children` | | | | ## CardHeader The title of the card, with an optional image, description and action. ### Component Props | Name | Type | Default | Description | | ------------------------------------------------------------ | ---------------------------------------------------------- | ------- | ----------------------------------------------------------------------------------------------------- | | `ref` _bindable_ | `HTMLDivElement` | `null` | | The DOM reference of the header element. | | `title` | `Snippet` | `Component` | `string` | | The title of the card. A snippet or a component receives the id the floating checkbox is labelled by. | | `headingLevel` | `1` | `2` | `3` | `4` | `5` | `6` | `4` | The level of the heading that holds a string title, to fit the headings of the page around it. | | `image` | `Snippet` | `Component` | `string` | | The image rendered before the title. A string is used as the `src` of an ``. | | `imageAlt` | `string` | `''` | The alternative text of a string image. Empty by default, which marks the image as decorative. | | `description` | `Snippet` | `Component` | `string` | | A second line of text below the title. | | `action` | `Snippet` | `Component` | | The action rendered at the end of the header. Not available on selectable cards. | | `HTMLAttributes` without `children`, `title` | | | | ## CardFooter The actions shown at the bottom of the card. ### Component Props | Name | Type | Default | Description | | --------------------------------------------------- | ------------------------------ | ------- | -------------------------------------------------------------------------- | | `ref` _bindable_ | `HTMLDivElement` | `null` | | The DOM reference of the footer element. | | `action` | `Snippet` | `Component` | | The actions rendered inside the footer. Not available on selectable cards. | | `HTMLAttributes` without `children` | | | | --- # Checkbox > Part of fluentui-svelte. Read the global guide first (setup, rules and pitfalls): https://fluentui-svelte.dev/docs/llms.md, also shipped as node_modules/fluentui-svelte/skills/fluentui-svelte/SKILL.md Represents a control that a user can select (check) or clear (uncheck). A CheckBox can also report its value as indeterminate. ## Usage ```svelte Default ``` ## Component API A brief explanation of the props that really need explaining. You can see the rest of the props in the Checkbox Props table below. ## Examples ### Label Pass the label text as children. The root is a `
` and the text renders in a separate `