### PieChart Basic Example - React Source: https://developer.microsoft.com/en-us/fluentui#/controls/web/piechart#IPieChartStyles A basic example demonstrating the usage of the PieChart component. Ensure you have the necessary Fluent UI charting libraries installed. ```jsx import React from 'react'; import { PieChart } from '@fluentui/react-charting'; const data = [ { data: 20, label: 'Series A', color: '#0078d4' }, { data: 50, label: 'Series B', color: '#107c10' }, { data: 30, label: 'Series C', color: '#ffb900' }, ]; const PieChartBasic = () => ( ); export default PieChartBasic; ``` -------------------------------- ### Default Callout Example Source: https://developer.microsoft.com/en-us/fluentui#/controls/web/callout Demonstrates the default usage of the Callout component. No specific setup is required beyond importing the component. ```javascript import * as React from 'react'; import * as ReactDOM from 'react-dom'; import { Callout } from '@fluentui/react'; const App = () => { const [showCallout, setShowCallout] = React.useState(false); return (
{showCallout && ( setShowCallout(false)}>

Callout title

This is the content of the callout.

)}
); }; ReactDOM.render(, document.getElementById('root')); ``` -------------------------------- ### Basic SpinButton Example Source: https://developer.microsoft.com/en-us/fluentui#/controls/web/spinbutton Demonstrates the basic usage of the SpinButton component. No special setup is required beyond importing the component. ```jsx import { SpinButton } from "@fluentui/react"; ; ``` -------------------------------- ### Default Callout Example Source: https://developer.microsoft.com/en-us/fluentui#/controls/web/callout#usage Demonstrates the default usage of the Callout component. No specific setup is required beyond importing the component. ```jsx import * as React from 'react'; import * as ReactDOM from 'react-dom'; import { Callout } from '@fluentui/react'; const App = () => { const [showCallout, setShowCallout] = React.useState(false); return (
{showCallout && (

Callout title

This is the content of the callout.

)}
); }; ReactDOM.render(, document.getElementById('root')); ``` -------------------------------- ### TeachingBubble with Multi-steps Example Source: https://developer.microsoft.com/en-us/fluentui#/controls/web/teachingbubble#ITeachingBubble Illustrates how to use TeachingBubbles in sequence to guide users through complex interactions. Use 'x of y' text for progress indication. ```jsx import * as React from 'react'; import { TeachingBubble } from '@fluentui/react/lib/TeachingBubble'; import { Button } from '@fluentui/react/lib/Button'; export const TeachingBubbleWithMultiStepsExample: React.FunctionComponent<{}> = () => { const [firstCallout, setFirstCallout] = React.useState(false); const [secondCallout, setSecondCallout] = React.useState(false); const [thirdCallout, setThirdCallout] = React.useState(false); const onRenderCalloutContent = (step: number) => { switch (step) { case 1: return (
setFirstCallout(false)} headline="Step 1 of 3" primaryButtonProps={{ text: 'Next', onClick: () => { setFirstCallout(false); setSecondCallout(true); }, }} > This is the first step in a multi-step teaching bubble sequence.
); case 2: return (
setSecondCallout(false)} headline="Step 2 of 3" primaryButtonProps={{ text: 'Next', onClick: () => { setSecondCallout(false); setThirdCallout(true); }, }} > This is the second step in a multi-step teaching bubble sequence.
); case 3: return (
setThirdCallout(false)} headline="Step 3 of 3" primaryButtonProps={{ text: 'Got it', onClick: () => { setThirdCallout(false); }, }} > This is the final step in a multi-step teaching bubble sequence.
); default: return null; } }; return (
{onRenderCalloutContent(1)} {onRenderCalloutContent(2)} {onRenderCalloutContent(3)}
); }; ``` -------------------------------- ### Default SearchBox Example Source: https://developer.microsoft.com/en-us/fluentui#/controls/web/searchbox A basic implementation of the SearchBox component. No specific setup is required beyond importing the component. ```jsx import * as React from 'react'; import { SearchBox } from '@fluentui/react'; export const DefaultSearchBoxExample: React.FunctionComponent<{}> = () => { return ; }; ``` -------------------------------- ### Basic ContextualMenu Example Source: https://developer.microsoft.com/en-us/fluentui#/controls/web/contextualmenu#overview Demonstrates attaching a ContextualMenu directly to arbitrary elements. This example uses ContextualMenu through Fluent UI Button components in subsequent examples. ```jsx import { ContextualMenu } from "@fluentui/react"; // ... other imports and component setup const menuProps = { items: [ { key: 'newItem', text: 'New' }, { key: 'edit', text: 'Edit' }, { key: 'delete', text: 'Delete' }, ], }; { showMenu && ( ) } ``` -------------------------------- ### Basic PieChart Example Source: https://developer.microsoft.com/en-us/fluentui#/controls/web/piechart#feedback A simple implementation of the PieChart component. Ensure you have the `@fluentui/react-charting` library installed. ```jsx import * as React from 'react'; import { PieChart, IPieChartProps } from '@fluentui/react-charting'; export const PieChartBasic: React.FunctionComponent = ( { data, height, width, colors, culture, strokeWidth, styles, theme, chartTitle, className, }: IPieChartProps ) => { return ( ); }; ``` -------------------------------- ### Basic Legends Example Source: https://developer.microsoft.com/en-us/fluentui#/controls/web/legends#implementation Demonstrates the basic rendering of legend items. Ensure the `@fluentui/react-charting` library is installed. ```jsx import * as React from 'react'; import { Legend } from '@fluentui/react-charting'; export const BasicLegends = () => { const data = [ { legend: 'Legend 1', color: 'blue' }, { legend: 'Legend 2', color: 'red' }, { legend: 'Legend 3', color: 'green' }, { legend: 'Legend 4', color: 'purple' }, ]; return ; }; ``` -------------------------------- ### Overlay Component - Usage Examples Source: https://developer.microsoft.com/en-us/fluentui#/controls/web/overlay#implementation Provides examples of how to implement the Overlay component with light and dark themes. ```APIDOC ## Overlay Component - Usage Examples ### Description Demonstrates how to use the Overlay component in both light and dark themes. ### Light Theme Usage ``` // Example for showing the overlay with a light theme // (Specific code not provided in source, conceptual example) ``` ### Dark Theme Usage ``` // Example for showing the overlay with a dark theme // (Specific code not provided in source, conceptual example) ``` ``` -------------------------------- ### Default Callout React Example Source: https://developer.microsoft.com/en-us/fluentui#/controls/web/callout#feedback Demonstrates the basic usage of the Callout component. Ensure proper setup and imports for React components. ```jsx import * as React from 'react'; import * as ReactDOM from 'react-dom'; import { Callout } from '@fluentui/react'; const App = () => { const [showCallout, setShowCallout] = React.useState(false); const toggleCallout = () => { setShowCallout(!showCallout); }; return (
{showCallout && (

Callout title

This is the content of the callout.

)}
); }; ReactDOM.render(, document.getElementById('root')); ``` -------------------------------- ### GroupedList basic example Source: https://developer.microsoft.com/en-us/fluentui#/controls/web/groupedlist#IGroupFooterStyleProps A basic example demonstrating the usage of the GroupedList component with default settings. ```jsx ``` -------------------------------- ### Modal React Example Source: https://developer.microsoft.com/en-us/fluentui#/controls/web/modal#implementation Demonstrates the basic usage of the Modal component in Fluent UI React. Ensure proper setup and imports for the Modal and related components. ```jsx import { Modal } from "@fluentui/react"; import * as React from "react"; export const ModalBasicExample = () => { const [showModal, setShowModal] = React.useState(false); const openModal = React.useCallback(() => setShowModal(true), []); const closeModal = React.useCallback(() => setShowModal(false), []); return ( <> This is the content of the basic modal. ); }; ``` -------------------------------- ### Render Custom Item Columns with Sorting in DetailsList Source: https://developer.microsoft.com/en-us/fluentui#/controls/web/detailslist/customitemcolumns#feedback This example shows how to configure and render custom columns within a DetailsList component, including the necessary setup for sorting. Ensure you have the Fluent UI React library installed. ```jsx import * as React from 'react'; import * as ReactDOM from 'react-dom'; import { DetailsList, DetailsListLayoutMode, Selection, IColumn, IDetailsListProps, } from '@fluentui/react'; interface IDetailsListItem { key: string; name: string; color: string; shape: string; location: string; width: number; height: number; } const items: IDetailsListItem[] = [ { key: 'a', name: 'item-0 Lorem ipsum dolor sit', color: 'Lorem ipsum dolor sit amet,', shape: 'yellow', location: 'square', width: 179, height: 179 }, { key: 'b', name: 'item-1 Lorem ipsum dolor sit', color: 'Lorem ipsum dolor sit amet,', shape: 'yellow', location: 'circle', width: 232, height: 232 }, { key: 'c', name: 'item-2 Lorem ipsum dolor sit', color: 'Lorem ipsum dolor sit amet,', shape: 'blue', location: 'triangle', width: 237, height: 237 }, { key: 'd', name: 'item-3 Lorem ipsum dolor sit', color: 'Lorem ipsum dolor sit amet,', shape: 'red', location: 'circle', width: 214, height: 214 }, { key: 'e', name: 'item-4 Lorem ipsum dolor sit', color: 'Lorem ipsum dolor sit amet,', shape: 'red', location: 'triangle', width: 200, height: 200 }, { key: 'f', name: 'item-5 Lorem ipsum dolor sit', color: 'Lorem ipsum dolor sit amet,', shape: 'yellow', location: 'square', width: 243, height: 243 }, { key: 'g', name: 'item-6 Lorem ipsum dolor sit', color: 'Lorem ipsum dolor sit amet,', shape: 'green', location: 'triangle', width: 246, height: 246 }, { key: 'h', name: 'item-7 Lorem ipsum dolor sit', color: 'Lorem ipsum dolor sit amet,', shape: 'red', location: 'circle', width: 178, height: 178 }, { key: 'i', name: 'item-8 Lorem ipsum dolor sit', color: 'Lorem ipsum dolor sit amet,', shape: 'red', location: 'square', width: 191, height: 191 }, { key: 'j', name: 'item-9 Lorem ipsum dolor sit', color: 'Lorem ipsum dolor sit amet,', shape: 'red', location: 'square', width: 170, height: 170 }, { key: 'k', name: 'item-10 Lorem ipsum dolor sit', color: 'Lorem ipsum dolor sit amet,', shape: 'green', location: 'circle', width: 152, height: 152 }, { key: 'l', name: 'item-11 Lorem ipsum dolor sit', color: 'Lorem ipsum dolor sit amet,', shape: 'green', location: 'circle', width: 213, height: 213 }, { key: 'm', name: 'item-12 Lorem ipsum dolor sit', color: 'Lorem ipsum dolor sit amet,', shape: 'green', location: 'square', width: 189, height: 189 }, { key: 'n', name: 'item-13 Lorem ipsum dolor sit', color: 'Lorem ipsum dolor sit amet,', shape: 'green', location: 'square', width: 219, height: 219 }, { key: 'o', name: 'item-14 Lorem ipsum dolor sit', color: 'Lorem ipsum dolor sit amet,', shape: 'green', location: 'triangle', width: 217, height: 217 }, { key: 'p', name: 'item-15 Lorem ipsum dolor sit', color: 'Lorem ipsum dolor sit amet,', shape: 'yellow', location: 'square', width: 217, height: 217 }, { key: 'q', name: 'item-16 Lorem ipsum dolor sit', color: 'Lorem ipsum dolor sit amet,', shape: 'yellow', location: 'triangle', width: 181, height: 181 }, { key: 'r', name: 'item-17 Lorem ipsum dolor sit', color: 'Lorem ipsum dolor sit amet,', shape: 'green', location: 'square', width: 193, height: 193 }, { key: 's', name: 'item-18 Lorem ipsum dolor sit', color: 'Lorem ipsum dolor sit amet,', shape: 'blue', location: 'square', width: 235, height: 235 }, { key: 't', name: 'item-19 Lorem ipsum dolor sit', color: 'Lorem ipsum dolor sit amet,', shape: 'red', location: 'square', width: 187, height: 187 }, { key: 'u', name: 'item-20 Lorem ipsum dolor sit', color: 'Lorem ipsum dolor sit amet,', shape: 'yellow', location: 'triangle', width: 239, height: 239 }, { key: 'v', name: 'item-21 Lorem ipsum dolor sit', color: 'Lorem ipsum dolor sit amet,', shape: 'yellow', location: 'triangle', width: 155, height: 155 }, { key: 'w', name: 'item-22 Lorem ipsum dolor sit', color: 'Lorem ipsum dolor sit amet,', shape: 'blue', location: 'square', width: 179, height: 179 }, { key: 'x', name: 'item-23 Lorem ipsum dolor sit', color: 'Lorem ipsum dolor sit amet,', shape: 'red', location: 'square', width: 165, height: 165 }, { key: 'y', name: 'item-24 Lorem ipsum dolor sit', color: 'Lorem ipsum dolor sit amet,', shape: 'blue', location: 'circle', width: 186, height: 186 }, { key: 'z', name: 'item-25 Lorem ipsum dolor sit', color: 'Lorem ipsum dolor sit amet,', shape: 'yellow', location: 'triangle', width: 168, height: 168 }, { key: 'aa', name: 'item-26 Lorem ipsum dolor sit', color: 'Lorem ipsum dolor sit amet,', shape: 'blue', location: 'circle', width: 206, height: 206 }, { key: 'bb', name: 'item-27 Lorem ipsum dolor sit', color: 'Lorem ipsum dolor sit amet,', shape: 'green', location: 'circle', width: 200, height: 200 }, { key: 'cc', name: 'item-28 Lorem ipsum dolor sit', color: 'Lorem ipsum dolor sit amet,', shape: 'yellow', location: 'circle', width: 229, height: 229 }, { key: 'dd', name: 'item-29 Lorem ipsum dolor sit', color: 'Lorem ipsum dolor sit amet,', shape: 'blue', location: 'triangle', width: 152, height: 152 }, { key: 'ee', name: 'item-30 Lorem ipsum dolor sit', color: 'Lorem ipsum dolor sit amet,', shape: 'blue', location: 'triangle', width: 199, height: 199 }, { key: 'ff', name: 'item-31 Lorem ipsum dolor sit', color: 'Lorem ipsum dolor sit amet,', shape: 'green', location: 'triangle', width: 190, height: 190 }, { key: 'gg', name: 'item-32 Lorem ipsum dolor sit', color: 'Lorem ipsum dolor sit amet,', shape: 'yellow', location: 'square', width: 242, height: 242 }, { key: 'hh', name: 'item-33 Lorem ipsum dolor sit', color: 'Lorem ipsum dolor sit amet,', shape: 'blue', location: 'triangle', width: 234, height: 234 }, { key: 'ii', name: 'item-34 Lorem ipsum dolor sit', color: 'Lorem ipsum dolor sit amet,', shape: 'blue', location: 'triangle', width: 165, height: 165 }, { key: 'jj', name: 'item-35 Lorem ipsum dolor sit', color: 'Lorem ipsum dolor sit amet,', shape: 'yellow', location: 'circle', width: 228, height: 228 }, { key: 'kk', name: 'item-36 Lorem ipsum dolor sit', color: 'Lorem ipsum dolor sit amet,', shape: 'red', location: 'square', width: 235, height: 235 }, { key: 'll', name: 'item-37 Lorem ipsum dolor sit', color: 'Lorem ipsum dolor sit amet,', shape: 'green', location: 'square', width: 151, height: 151 }, { key: 'mm', name: 'item-38 Lorem ipsum dolor sit', color: 'Lorem ipsum dolor sit amet,', shape: 'red', location: 'triangle', width: 177, height: 177 }, { key: 'nn', name: 'item-39 Lorem ipsum dolor sit', color: 'Lorem ipsum dolor sit amet,', shape: 'yellow', location: 'triangle', width: 215, height: 215 }, ]; const columns: IColumn[] = [ { key: 'column1', name: 'key', fieldName: 'key', minWidth: 100, maxWidth: 200, isResizable: true }, { key: 'column2', name: 'name', fieldName: 'name', minWidth: 100, maxWidth: 200, isResizable: true }, { key: 'column3', name: 'color', fieldName: 'color', minWidth: 100, maxWidth: 200, isResizable: true }, { key: 'column4', name: 'shape', fieldName: 'shape', minWidth: 100, maxWidth: 200, isResizable: true }, { key: 'column5', name: 'location', fieldName: 'location', minWidth: 100, maxWidth: 200, isResizable: true }, { key: 'column6', name: 'width', fieldName: 'width', minWidth: 100, maxWidth: 200, isResizable: true }, { key: 'column7', name: 'height', fieldName: 'height', minWidth: 100, maxWidth: 200, isResizable: true }, ]; export const DetailsListCustomItemColumnsExample: React.FunctionComponent = () => { const selection = new Selection({ onSelectionChanged: () => this.setState({ selectionDetails: this._getSelectionDetails() }), }); const _getSelectionDetails = (): string => { const selectionCount = selection.getSelectedCount(); switch (selectionCount) { case 0: return 'No items selected'; case 1: return '1 item selected: ' + (selection.getSelection()[0] as any).name; default: return `${selectionCount} items selected`; } }; return ( ); }; ``` -------------------------------- ### Basic Nav with Sample Links Source: https://developer.microsoft.com/en-us/fluentui#/controls/web/nav#best-practices Demonstrates a basic implementation of the Nav component with sample links. Ensure Fluent UI React is installed and imported. ```jsx import { Nav } from '@fluentui/react'; const navStyles = { root: { width: '200px', height: '400px', boxSizing: 'border-box', overflowY: 'auto', padding: '10px', }, }; const links = [ { key: 'key1', name: 'File 1', url: 'http://example.com', icon: 'File' }, { key: 'key2', name: 'Folder 1', url: 'http://example.com', icon: 'Folder' }, ];