Movatterモバイル変換


[0]ホーム

URL:


Skip to content
DEV Community
Log in Create account

DEV Community

Cover image for Getting Started with Fluent UI React v9
Paul Gildea
Paul Gildea

Posted on

     

Getting Started with Fluent UI React v9

Fluent is an open-source, cross-platform design system that gives designers and developers the frameworks they need to create engaging product experiences—accessibility, internationalization, and performance included.

Fluent UI React v9 is the UI library focused on React development for Microsoft 365 platforms like Teams Apps, Office Add-ins, and even stand along web app development.

The following is quick tutorial to get you up and running with the latest version of the library.

This tutorial assumes you have a React project up and running likeCreate React App and you are ready to add some UI components.

1. Install the npm package

Install the component suite package with your favorite package manager

npm

npm install @fluentui/react-components
Enter fullscreen modeExit fullscreen mode

yarn

yarn add @fluentui/react-components
Enter fullscreen modeExit fullscreen mode

2. Add aFluentProvider andTheme

AFluentProvider and aTheme are required for providing the right visual context for the UI Components so that they render properly. Without it, the components will not have any visuals.

import React from 'react';import ReactDOM from 'react-dom';import { FluentProvider, webLightTheme } from '@fluentui/react-components';import App from './App';ReactDOM.render(  <FluentProvider theme={webLightTheme}>    <App />  </FluentProvider>,  document.getElementById('root'),);
Enter fullscreen modeExit fullscreen mode

3. Add Components

Fluent UI React v9 has two categories of components:

  1. Stable - Components with stable APIs that will version according toSemantic Versioning. These are exported from the top level package.
  2. Preview - Components with APIs that may change or may not have complete feature set. These components are exported out of the/unstable deep import
import React from 'react';import ReactDOM from 'react-dom';import { FluentProvider, webLightTheme, Button } from '@fluentui/react-components';import { Select } from '@fluetui/react-components/unstable'; // Preview components deep importReactDOM.render(  <FluentProvider theme={webLightTheme}>    <Button appearance="primary">Hello World!</Button>    <Select>      <option>Red</option>      <option>Green</option>      <option>Blue</option>    </Select>  </FluentProvider>,  document.getElementById('root'),);
Enter fullscreen modeExit fullscreen mode

And that's all you need to get started using Fluent UI React v9.

Don't forget to check outhttps://react.fluentui.dev for more code samples and find out the latest onGitHub.

Lastly, here's a full CodeSandbox:

Enjoy!

Top comments(0)

Subscribe
pic
Create template

Templates let you quickly answer FAQs or store snippets for re-use.

Dismiss

Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment'spermalink.

For further actions, you may consider blocking this person and/orreporting abuse

Product Manager working on Fluent UI - pretending I know how to code...
  • Education
    Rochester Institute of Technology
  • Work
    Senior Product Manager at Microsoft
  • Joined

More fromPaul Gildea

DEV Community

We're a place where coders share, stay up-to-date and grow their careers.

Log in Create account

[8]ページ先頭

©2009-2025 Movatter.jp