Convert Figma logo to code with AI

microsoft logofluentui

Fluent UI web represents a collection of utilities, React components, and web components for building web applications.

18,417
2,722
18,417
557

Top Related Projects

An enterprise-class UI design language and React UI library

Material UI: Comprehensive React component library that implements Google's Material Design. Free forever.

37,442

⚡️ Simple, Modular & Accessible UI Components for your React Applications

A utility-first CSS framework for rapid UI development.

84,226

Storybook is the industry standard workshop for building, documenting, and testing UI components in isolation

Visual primitives for the component age. Use the best bits of ES6 and CSS to style your apps without stress 💅

Quick Overview

Fluent UI is a collection of React-based UI components, design tools, and utilities built by Microsoft. It aims to provide a consistent and accessible user experience across Microsoft products and services.

Pros

  • Consistent Design: Fluent UI follows Microsoft's Fluent Design System, ensuring a cohesive look and feel across different applications.
  • Accessibility-Focused: The components are designed with accessibility in mind, making them suitable for users with various needs.
  • Extensive Component Library: Fluent UI offers a wide range of UI components, from basic elements like buttons and inputs to more complex components like data grids and calendars.
  • Customizable and Themable: Developers can customize the appearance and behavior of Fluent UI components to match their specific design requirements.

Cons

  • Learning Curve: Developers new to Fluent UI may need to invest time in understanding the library's conventions and patterns.
  • Performance Overhead: The comprehensive feature set and flexibility of Fluent UI components may result in a larger bundle size and potential performance impact, especially for smaller projects.
  • Microsoft-Centric: Fluent UI is primarily designed for and used within the Microsoft ecosystem, which may limit its adoption outside of that context.
  • Dependency on React: Fluent UI is built on top of React, which means it may not be the best choice for projects that don't use React.

Code Examples

// Example 1: Rendering a Button component
import { Button } from '@fluentui/react';

const MyButton = () => {
  return (
    <Button
      primary
      onClick={() => console.log('Button clicked!')}
    >
      Click me
    </Button>
  );
};
// Example 2: Using the Persona component to display a user profile
import { Persona, PersonaSize } from '@fluentui/react';

const UserProfile = () => {
  return (
    <Persona
      text="John Doe"
      secondaryText="Software Engineer"
      imageUrl="https://via.placeholder.com/150"
      size={PersonaSize.size72}
    />
  );
};
// Example 3: Implementing a simple data grid with the DetailsList component
import { DetailsList, DetailsListLayoutMode, SelectionMode } from '@fluentui/react';

const data = [
  { id: 1, name: 'John Doe', email: 'john.doe@example.com' },
  { id: 2, name: 'Jane Smith', email: 'jane.smith@example.com' },
  { id: 3, name: 'Bob Johnson', email: 'bob.johnson@example.com' },
];

const columns = [
  { key: 'id', name: 'ID', fieldName: 'id', minWidth: 50 },
  { key: 'name', name: 'Name', fieldName: 'name', minWidth: 100 },
  { key: 'email', name: 'Email', fieldName: 'email', minWidth: 150 },
];

const DataGrid = () => {
  return (
    <DetailsList
      items={data}
      columns={columns}
      layoutMode={DetailsListLayoutMode.justified}
      selectionMode={SelectionMode.none}
    />
  );
};

Getting Started

To get started with Fluent UI, follow these steps:

  1. Install the required packages:
npm install @fluentui/react
  1. Import the necessary components and use them in your React application:
import { Button, Persona, PersonaSize, DetailsList, DetailsListLayoutMode, SelectionMode } from '@fluentui/react';

// Use the components in your JSX
  1. Customize the appearance and behavior of the components by passing in the appropriate props:
<Button primary onClick={handleClick}>
  Click me
</Button>

<Persona
  text="John Doe"
  secondaryText="Software Engineer"
  imageUrl="https://via.placeholder.com/150"
  size={PersonaSize.size72}
/>

<DetailsList
  items={data}

Competitor Comparisons

An enterprise-class UI design language and React UI library

Pros of Ant Design

  • Larger community and ecosystem, with more third-party components and extensions
  • More comprehensive documentation and examples
  • Better support for internationalization and localization out of the box

Cons of Ant Design

  • Steeper learning curve due to more complex API and configuration options
  • Less seamless integration with Microsoft products and services
  • Heavier bundle size, which may impact performance in some applications

Code Comparison

Ant Design button example:

import { Button } from 'antd';

const MyComponent = () => (
  <Button type="primary">Click me</Button>
);

Fluent UI button example:

import { PrimaryButton } from '@fluentui/react';

const MyComponent = () => (
  <PrimaryButton text="Click me" />
);

Both libraries offer similar component APIs, but Ant Design tends to use more props-based configuration, while Fluent UI often uses separate components for different variants. Ant Design's styling system is more flexible, allowing for easier customization, while Fluent UI adheres more closely to Microsoft's design guidelines.

Overall, Ant Design is a more versatile and feature-rich library, suitable for a wide range of projects. Fluent UI, on the other hand, is ideal for applications that need to integrate seamlessly with Microsoft's ecosystem and follow their design language closely.

Material UI: Comprehensive React component library that implements Google's Material Design. Free forever.

Pros of Material-UI

  • Larger community and ecosystem, with more third-party components and resources
  • More comprehensive documentation and examples
  • Better support for customization and theming

Cons of Material-UI

  • Steeper learning curve due to more complex API
  • Larger bundle size, which may impact performance for smaller projects
  • Less native integration with Microsoft products and services

Code Comparison

Material-UI:

import { Button, ThemeProvider, createTheme } from '@mui/material';

const theme = createTheme();

function App() {
  return (
    <ThemeProvider theme={theme}>
      <Button variant="contained">Click me</Button>
    </ThemeProvider>
  );
}

Fluent UI:

import { ThemeProvider, Button } from '@fluentui/react';

function App() {
  return (
    <ThemeProvider>
      <Button>Click me</Button>
    </ThemeProvider>
  );
}

Both libraries offer similar component-based approaches, but Material-UI provides more customization options out of the box. Fluent UI's API is generally simpler and more straightforward, which can be beneficial for developers who prefer a more streamlined experience. However, Material-UI's extensive theming capabilities and larger ecosystem make it a popular choice for projects requiring advanced customization and a wide range of pre-built components.

37,442

⚡️ Simple, Modular & Accessible UI Components for your React Applications

Pros of Chakra UI

  • More flexible and customizable design system
  • Better support for dark mode and color mode switching
  • Stronger focus on accessibility out of the box

Cons of Chakra UI

  • Smaller ecosystem and less enterprise-focused than Fluent UI
  • Less comprehensive documentation for complex scenarios
  • Fewer pre-built components for specific use cases

Code Comparison

Chakra UI button example:

import { Button } from "@chakra-ui/react"

function MyComponent() {
  return <Button colorScheme="blue">Click me</Button>
}

Fluent UI button example:

import { PrimaryButton } from "@fluentui/react"

function MyComponent() {
  return <PrimaryButton text="Click me" />
}

Both libraries offer easy-to-use component APIs, but Chakra UI's approach is more flexible with inline styling options, while Fluent UI focuses on predefined styles adhering to Microsoft's design system.

A utility-first CSS framework for rapid UI development.

Pros of Tailwind CSS

  • Highly customizable and flexible, allowing for rapid UI development
  • Utility-first approach enables quick styling without leaving HTML
  • Smaller file size when properly configured, leading to faster load times

Cons of Tailwind CSS

  • Steeper learning curve for developers used to traditional CSS frameworks
  • Can lead to cluttered HTML with many utility classes
  • Requires additional tooling for optimal performance

Code Comparison

Tailwind CSS:

<button class="bg-blue-500 hover:bg-blue-700 text-white font-bold py-2 px-4 rounded">
  Click me
</button>

Fluent UI:

import { PrimaryButton } from '@fluentui/react';

<PrimaryButton text="Click me" onClick={handleClick} />

Summary

Tailwind CSS offers a utility-first approach with high customization, while Fluent UI provides pre-built components following Microsoft's design language. Tailwind excels in flexibility but may result in verbose HTML, whereas Fluent UI offers a more structured, component-based approach with a focus on accessibility and consistency across Microsoft products.

84,226

Storybook is the industry standard workshop for building, documenting, and testing UI components in isolation

Pros of Storybook

  • Broader framework support (React, Vue, Angular, etc.)
  • More extensive ecosystem of addons and plugins
  • Better suited for documenting and showcasing component libraries

Cons of Storybook

  • Steeper learning curve for beginners
  • Can be overkill for smaller projects
  • Requires additional setup and configuration

Code Comparison

Storybook component story:

import { Button } from './Button';

export default {
  title: 'Example/Button',
  component: Button,
};

const Template = (args) => <Button {...args} />;

export const Primary = Template.bind({});
Primary.args = {
  primary: true,
  label: 'Button',
};

Fluent UI component usage:

import { PrimaryButton } from '@fluentui/react/lib/Button';

const MyComponent = () => (
  <PrimaryButton text="Click me" onClick={() => console.log('Clicked')} />
);

While Storybook focuses on component documentation and testing, Fluent UI provides a comprehensive set of pre-built components. Storybook offers more flexibility in terms of framework support and customization, but Fluent UI provides a cohesive design system out of the box. The choice between the two depends on project requirements and team preferences.

Visual primitives for the component age. Use the best bits of ES6 and CSS to style your apps without stress 💅

Pros of styled-components

  • More flexible and customizable, allowing for dynamic styling based on props
  • Better integration with component-based architecture in React
  • Smaller bundle size and better performance for large-scale applications

Cons of styled-components

  • Steeper learning curve for developers new to CSS-in-JS
  • Less out-of-the-box UI components compared to FluentUI
  • Potential for style duplication if not managed properly

Code Comparison

styled-components:

const Button = styled.button`
  background-color: ${props => props.primary ? 'blue' : 'white'};
  color: ${props => props.primary ? 'white' : 'blue'};
  padding: 10px 20px;
  border: 2px solid blue;
`;

FluentUI:

import { PrimaryButton, DefaultButton } from '@fluentui/react';

<PrimaryButton text="Primary Button" />
<DefaultButton text="Default Button" />

styled-components offers more flexibility in styling, allowing for dynamic styles based on props. FluentUI provides pre-styled components that adhere to Microsoft's design system, requiring less custom styling but offering less flexibility.

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

Fluent UI Web

Build Status GitHub contributors GitHub top language Twitter Follow

Fluent UI React is shipping its v9 final stable release. Visit the Fluent UI React v9 Release page on the wiki to learn more about the upcoming release schedule.

Fluent UI web represents a collection of utilities, React components, and Web Components for building web applications.

This repo is home to 3 separate projects today. Combining Fluent UI React v9 components with Fluent UI React v8 or v0 components is possible and allows gradual migration to Fluent UI v9.

The following table will help you navigate the 3 projects and understand their differences.

React Components (v9)React (v8)Web Components
OverviewNew, future-proof and forward lookingMatureWeb Component implementation of Fluent UI.
Used ByMicrosoft 365OfficeEdge
Read MeREADME.mdREADME.mdREADME.md
ChangelogCHANGELOG.mdCHANGELOG.mdCHANGELOG.md
Repopackages/react-components./packages/react./packages/web-components
Quick StartQuick StartQuick StartSee README.md
Docshttps://react.fluentui.dev/aka.ms/fluentui-reactaka.ms/fluentui-web-components
NPM@fluentui/react-components@fluentui/react@fluentui/web-components
Versionnpm versionnpm versionnpm version
IssuesFluent UI React Components GitHub IssuesFluent UI React GitHub IssuesFluent UI Web Components GitHub Issues

Why are there two React versions? Fluent UI v8 is still widely used. We encourage you to migrate to Fluent UI v9. See the Migration overview.

FluentUI Insights

Fluent UI Insights is a series that describes the design and decisions behind the Fluent UI design system.

EP01: PositioningEP02: StylingEP03: Griffel
Watch EP01: PositioningWatch EP02: StylingWatch EP03: Griffel
EP04: Foundational APIsEP05: ThemingEP06: Accessible by default
Watch EP04: Foundational APIsWatch EP05: ThemingWatch EP06: Accessible by default

Licenses

All files on the Fluent UI React GitHub repository are subject to the MIT license. Please read the License file at the root of the project.

Usage of the fonts and icons referenced in Fluent UI React is subject to the terms of the assets license agreement.

Changelog

You can view the complete list of additions, fixes, and changes in the CHANGELOG.md file for each package.

Looking for Office UI Fabric React?

The Office UI Fabric React project has evolved to Fluent UI.

The office-ui-fabric-react repo is now this repo (fluentui in the Microsoft organization)! The name change should not disrupt any current Fabric usage, repo clones, pull requests, or issue reporting. Links should redirect to the new location. The library formerly known as office-ui-fabric-react is now available as @fluentui/react (see above table for more information).

We have a lot in store for Fluent UI - Read our announcement here.

Looking for Fluent UI React Northstar?

Fluent UI React Northstar has been superseded by Fluent UI React Components v9. For more details about Fluent UI React Northstar, see its README.md.


This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.

NPM DownloadsLast 30 Days