### Install Fluent Svelte Extra and Setup Theme
Source: https://context7.com/openanime/fluent-svelte-extra/llms.txt
Demonstrates the installation of the fluent-svelte-extra package using npm or yarn. It also shows how to set up the theme, including a basic toggle for light and dark modes in a Svelte layout file.
```bash
# Install the package
npm install fluent-svelte-extra
# Or with yarn
yarn add fluent-svelte-extra
```
```svelte
```
```html
%sveltekit.head%
%sveltekit.body%
```
--------------------------------
### Install fluent-svelte using npm, pnpm, or yarn
Source: https://github.com/openanime/fluent-svelte-extra/blob/main/src/routes/docs/getting-started.md
These commands install the fluent-svelte library and its dependencies as development dependencies for your project. Choose the command corresponding to your preferred package manager.
```bash
npm i --save-dev fluent-svelte
```
```bash
pnpm i --save-dev fluent-svelte
```
```bash
yarn add --dev fluent-svelte
```
--------------------------------
### Progress Indicators in Svelte
Source: https://context7.com/openanime/fluent-svelte-extra/llms.txt
This Svelte example utilizes the ProgressBar and ProgressRing components from fluent-svelte-extra to display loading and progress states. It includes examples of determinate and indeterminate progress bars, a function to simulate download progress, and several configurations of the ProgressRing component with different sizes and values.
```svelte
```
--------------------------------
### InfoBar Examples with Different Severities
Source: https://github.com/openanime/fluent-svelte-extra/blob/main/src/routes/docs/components/infobar.md
Provides examples of the InfoBar component utilizing various 'severity' levels (information, attention, success, caution, critical) to visually distinguish message types.
```svelte
```
--------------------------------
### NavigationView Component Example (Svelte)
Source: https://context7.com/openanime/fluent-svelte-extra/llms.txt
Demonstrates the NavigationView component for creating collapsible sidebar navigation in Svelte applications. It includes examples for header, items, footer slots, and handling navigation events. Dependencies include ListItem and Button from fluent-svelte-extra.
```svelte
App Title
navigate('home')}
>
Home
navigate('documents')}
>
Documents
navigate('settings')}
>
Settings
Profile
Welcome to {currentPage}
This is the main content area for the {currentPage} page.
```
--------------------------------
### Fluent Svelte ToggleSwitch Component Examples
Source: https://context7.com/openanime/fluent-svelte-extra/llms.txt
Demonstrates the ToggleSwitch component from fluent-svelte-extra, showing its use for binary on/off states. Examples include binding to variables, handling change events, disabling the switch, and controlling its checked state.
```svelte
console.log('Notifications changed:', e.target.checked)}
>
Enable Notifications
console.log('Theme toggled')}
>
Dark Mode
Auto-save documents
Disabled (checked)
```
--------------------------------
### ContentDialog Sizing Examples
Source: https://github.com/openanime/fluent-svelte-extra/blob/main/src/routes/docs/components/contentdialog.md
Illustrates the different size options ('min', 'standard', 'max') for the ContentDialog component. Each dialog is displayed with its respective title and size property.
```svelte
{#each ["min", "standard", "max"] as size}
It has a width of {sizes[size]}px.
{/each}
```
--------------------------------
### Import and use fluent-svelte Button and Checkbox components
Source: https://github.com/openanime/fluent-svelte-extra/blob/main/src/routes/docs/getting-started.md
This Svelte component example shows how to import and use the `Button` and `Checkbox` components from the `fluent-svelte` library. Components are typically imported from the main index file.
```svelte
Check me!
```
--------------------------------
### Import fluent-svelte components using a namespace
Source: https://github.com/openanime/fluent-svelte-extra/blob/main/src/routes/docs/getting-started.md
This Svelte example demonstrates an alternative way to import fluent-svelte components by using a namespace (`Fluent`). This can help avoid naming conflicts if you have similarly named components from other libraries.
```svelte
Click me!Check me!
```
--------------------------------
### Basic ListItem Usage (Svelte)
Source: https://github.com/openanime/fluent-svelte-extra/blob/main/src/routes/docs/components/listitem.md
Shows a basic example of rendering a ListItem with text content in Svelte. This demonstrates the default appearance and behavior.
```svelte
ListItem
```
--------------------------------
### AutoSuggestBox Component Examples (Svelte)
Source: https://context7.com/openanime/fluent-svelte-extra/llms.txt
Showcases the AutoSuggestBox component for implementing search inputs with dynamic suggestions. It covers basic usage with filtering and custom item templates. Dependencies include AutoSuggestBox from fluent-svelte-extra.
```svelte
console.log('User selected:', e.detail)}
/>
🍎 {item}
{#if selectedItem}
You selected: {selectedItem}
{/if}
```
--------------------------------
### Import ToggleSwitch Component
Source: https://github.com/openanime/fluent-svelte-extra/blob/main/src/routes/docs/components/toggleswitch.md
Demonstrates how to import the ToggleSwitch component from the 'fluent-svelte' library. This is a basic setup step for using the component in your Svelte application.
```typescript
import { ToggleSwitch } from "fluent-svelte";
```
--------------------------------
### Basic ContentDialog Example with Controls
Source: https://github.com/openanime/fluent-svelte-extra/blob/main/src/routes/docs/components/contentdialog.md
Demonstrates a basic ContentDialog with controls for opening and closing. It utilizes Svelte's two-way binding for the 'open' property and includes a footer slot for action buttons.
```svelte
Some text
```
--------------------------------
### Fluent Svelte Button Component Examples
Source: https://context7.com/openanime/fluent-svelte-extra/llms.txt
Showcases the usage of the Button component from fluent-svelte-extra, demonstrating various variants like standard, accent, hyperlink, disabled, and custom-styled buttons. Includes event handling for clicks and mouse enter.
```svelte
```
--------------------------------
### Opening ContentDialog by Default
Source: https://github.com/openanime/fluent-svelte-extra/blob/main/src/routes/docs/components/contentdialog.md
Shows how to render a ContentDialog directly in its open state by setting the 'open' property to true. This is useful for initial setup or pre-defined dialogs.
```svelte
This dialog is open by default.
```
--------------------------------
### Set CalendarView Week Start Day
Source: https://github.com/openanime/fluent-svelte-extra/blob/main/src/routes/docs/components/calendarview.md
Explains how to customize the starting day of the week displayed in the CalendarView using the 'weekStart' property. Accepts a number from 0 (Sunday) to 6 (Saturday). This example sets Monday as the start.
```svelte
```
--------------------------------
### Showcase of RadioButton Components (Svelte)
Source: https://github.com/openanime/fluent-svelte-extra/blob/main/src/routes/docs/components/radiobutton.md
Presents a showcase of various RadioButton instances with different configurations, including value binding, disabled states, and default checked states. This example is part of the component's integration within a larger site structure.
```svelte
Option 1Option 2Option 3RadioButtonRadioButtonRadioButton
```
--------------------------------
### Importing the Button Component in Svelte
Source: https://github.com/openanime/fluent-svelte-extra/blob/main/src/routes/docs/components/button.md
This code snippet demonstrates how to import the Button component from the 'fluent-svelte' library into a Svelte project. Ensure the 'fluent-svelte' package is installed as a dependency.
```typescript
import { Button } from "fluent-svelte";
```
--------------------------------
### InfoBar Component Examples (Svelte)
Source: https://context7.com/openanime/fluent-svelte-extra/llms.txt
Demonstrates the InfoBar component for displaying various types of notifications and alerts within a Svelte application. Supports different severity levels, closable messages, and action buttons. Dependencies include InfoBar and Button from fluent-svelte-extra.
```svelte
```
--------------------------------
### Create a Basic SplitButton with Flyout Menu in Svelte
Source: https://github.com/openanime/fluent-svelte-extra/blob/main/src/routes/docs/components/splitbutton.md
Illustrates the basic structure of a SplitButton in Svelte, including a primary button label and a flyout menu populated with MenuFlyoutItem components. This serves as a foundational example for implementing split buttons.
```svelte
Button
Item 1Item 2Item 3
```
--------------------------------
### Basic RadioButton Usage (Svelte)
Source: https://github.com/openanime/fluent-svelte-extra/blob/main/src/routes/docs/components/radiobutton.md
Shows a basic example of using the RadioButton component with different states like disabled and checked. It utilizes slot content for labels.
```svelte
I have a label!
```
--------------------------------
### Fluent Svelte TextBox Component Examples
Source: https://context7.com/openanime/fluent-svelte-extra/llms.txt
Illustrates the functionality of the TextBox component from fluent-svelte-extra, including different input types (text, password, search, email), placeholders, max length, and special buttons for reveal, search, and clear actions. Also shows custom slot usage for buttons.
```svelte
console.log('Input:', e.target.value)}
/>
console.log('Password revealed')}
/>
{#if value}
✓
{/if}
```
--------------------------------
### Basic ToggleSwitch Usage
Source: https://github.com/openanime/fluent-svelte-extra/blob/main/src/routes/docs/components/toggleswitch.md
Shows the basic rendering of a ToggleSwitch component. This example displays a simple toggle switch without any specific states like checked or disabled.
```svelte
ToggleSwitch
```
--------------------------------
### ProgressRing with 50% Completion (Svelte)
Source: https://github.com/openanime/fluent-svelte-extra/blob/main/src/routes/docs/components/progressring.md
Illustrates how to set a specific completion percentage for the ProgressRing component by using the 'value' property. This example sets the value to 50, demonstrating a determinate state. It requires the 'fluent-svelte' library.
```svelte
```
--------------------------------
### Programmatically Checked ToggleSwitch
Source: https://github.com/openanime/fluent-svelte-extra/blob/main/src/routes/docs/components/toggleswitch.md
Example of controlling the checked state of a ToggleSwitch programmatically using the `checked` property. This allows for dynamic updates to the switch's state.
```svelte
```
--------------------------------
### InfoBadge Custom Content Examples
Source: https://github.com/openanime/fluent-svelte-extra/blob/main/src/routes/docs/components/infobadge.md
Shows how to use the InfoBadge component with custom content, such as numbers or text, overriding the default glyph. This is useful for displaying counts or specific alerts.
```svelte
99bazinga
```
--------------------------------
### Initialize CalendarView with a Specific Date
Source: https://github.com/openanime/fluent-svelte-extra/blob/main/src/routes/docs/components/calendarview.md
Demonstrates how to initialize the CalendarView with a pre-selected date. The 'value' property accepts a Date object, and this example sets it to March 3, 2020.
```svelte
```
--------------------------------
### Controlling Slider Value with 'value' Property
Source: https://github.com/openanime/fluent-svelte-extra/blob/main/src/routes/docs/components/slider.md
Illustrates how to set an initial specific value for the Slider component using the 'value' property. This positions the slider thumb at the desired starting point.
```svelte
```
--------------------------------
### ListItem with Icon (Svelte)
Source: https://github.com/openanime/fluent-svelte-extra/blob/main/src/routes/docs/components/listitem.md
Illustrates how to add an icon to a ListItem using the 'icon' slot. The example uses an SVG icon defined directly within the template.
```svelte
Text
```
--------------------------------
### ProgressRing with Custom Size (Svelte)
Source: https://github.com/openanime/fluent-svelte-extra/blob/main/src/routes/docs/components/progressring.md
Shows how to control the visual size of the ProgressRing component using the 'size' property. This example sets the diameter to 64 pixels. It requires the 'fluent-svelte' library.
```svelte
```
--------------------------------
### Render Various TextBlock Variants in Svelte
Source: https://github.com/openanime/fluent-svelte-extra/blob/main/src/routes/docs/components/textblock.md
Illustrates how to render different variants of the TextBlock component to display text with distinct styles, such as captions, body text, subtitles, and titles. This example utilizes the Showcase component for displaying multiple TextBlock instances.
```svelte
CaptionBodyBody StrongBody LargeSubtitleTitleTitle LargeDisplay
```
--------------------------------
### Radio Group Binding Example (Svelte)
Source: https://github.com/openanime/fluent-svelte-extra/blob/main/src/routes/docs/components/radiobutton.md
Demonstrates how to group RadioButtons using a `bind:group` directive. This ensures only one radio button within the group can be selected at a time, and the bound variable reflects the `value` of the selected option.
```svelte
ChocolateVanillaStrawberry
```
--------------------------------
### RadioButton Value Property Example (Svelte)
Source: https://github.com/openanime/fluent-svelte-extra/blob/main/src/routes/docs/components/radiobutton.md
Illustrates how to assign a `value` to a RadioButton, which is crucial for form submissions and group bindings. The `value` property determines the data associated with the selected radio.
```svelte
Option 1
```
--------------------------------
### Import fluent-svelte theme CSS file
Source: https://github.com/openanime/fluent-svelte-extra/blob/main/src/routes/docs/getting-started.md
This Svelte script block imports the necessary CSS theme file for fluent-svelte components to render correctly. This should typically be placed in your main application file (e.g., `App.svelte` or `routes/__layout.svelte` in SvelteKit).
```svelte
```
--------------------------------
### Svelte REPL: Import fluent-svelte with CDN theme
Source: https://github.com/openanime/fluent-svelte-extra/blob/main/src/routes/docs/getting-started.md
This Svelte code is specifically for use in the Svelte REPL. It imports fluent-svelte components and the theme CSS via a CDN, as direct CSS imports from `node_modules` are not supported in the REPL environment. Basic global styles are included for better presentation.
```svelte
```
--------------------------------
### Import fluent-svelte theme from CDN
Source: https://github.com/openanime/fluent-svelte-extra/blob/main/src/routes/docs/getting-started.md
This code snippet demonstrates how to import the fluent-svelte theme CSS file using a CDN within a style block. This is an alternative to direct import, though generally not recommended for production environments.
```svelte
```
--------------------------------
### Basic InfoBar Usage with Title and Message
Source: https://github.com/openanime/fluent-svelte-extra/blob/main/src/routes/docs/components/infobar.md
Shows the fundamental usage of the InfoBar component, including setting a title and a message. This is the most basic way to display information.
```svelte
```
--------------------------------
### Importing and Using the Slider Component
Source: https://github.com/openanime/fluent-svelte-extra/blob/main/src/routes/docs/components/slider.md
Demonstrates the basic import statement required to use the Slider component from the fluent-svelte library. This is the foundational step for utilizing any of its features.
```typescript
import { Slider } from "fluent-svelte";
```
--------------------------------
### Limit CalendarView Date Range
Source: https://github.com/openanime/fluent-svelte-extra/blob/main/src/routes/docs/components/calendarview.md
Shows how to restrict the selectable date range in CalendarView using the 'min' and 'max' properties, which accept Date objects. This example limits selections to the year 2020.
```svelte
```
--------------------------------
### Import RadioButton Component (TypeScript)
Source: https://github.com/openanime/fluent-svelte-extra/blob/main/src/routes/docs/components/radiobutton.md
Demonstrates how to import the RadioButton component from the fluent-svelte library. This is a common first step when using the component.
```typescript
import { RadioButton } from "fluent-svelte";
```
--------------------------------
### Import InfoBar Component
Source: https://github.com/openanime/fluent-svelte-extra/blob/main/src/routes/docs/components/infobar.md
Demonstrates how to import the InfoBar component from the fluent-svelte library for use in your Svelte application.
```typescript
import { InfoBar } from "fluent-svelte";
```
--------------------------------
### Advanced Slider Configurations in Showcase
Source: https://github.com/openanime/fluent-svelte-extra/blob/main/src/routes/docs/components/slider.md
Presents a variety of Slider component configurations, including different values, step increments, tick placements, reverse orientation, and disabled states, showcasing the component's flexibility.
```html