Tuesday, November 26, 2024
Google search engine
HomeLanguagesFluent UI Introduction and Installation for React

Fluent UI Introduction and Installation for React

Fluent UI is an open-source, cross-platform design system that gives designers and developers the frameworks they need to build amazing applications. It is a design language developed in 2017 by Microsoft. Products such as Microsoft Office 365, OneDrive, Outlook, Azure, and much more use Fluent UI so that all the applications look consistent over different platforms. If you like the clean and minimalist look of Microsoft apps, it’s the one and only library you should use. In this article, we will be installing Fluent UI and will see how to use it with React.js.

Features of Fluent UI:

  • Highly customizable.
  • Up to date components.
  • Cross-platform.
  • Open-source.

Prerequisite:

Let’s start building the React application.

Creating a React application:

Step 1: Create a React application by typing the following command in the terminal:

npx create-react-app fluentui-demo

Step 2: Now, go to the project folder i.e fluentui-demo by running the following command:

cd fluentui-demo

Project Structure: It will look like this:

Installing Fluent UI: To install Fluent UI run the below command in your working directory.

npm install @fluentui/react

Filename: App.js: This is the only default component of our app that contains all the logic. Here we will import the Fluent UI library and display a logo and some buttons.

Javascript




import './App.css';
import { DefaultButton, PrimaryButton } 
    from '@fluentui/react/lib/Button';
import { FontSizes } from '@fluentui/theme';
import { Icon } from '@fluentui/react/lib/Icon';
import { initializeIcons } from 
    '@fluentui/font-icons-mdl2';
  
function App() {
  
    // Initialization for Fluent UI Icons
    initializeIcons();
    return (
        <div className="App">
            <span style={{ fontSize: FontSizes.size42 }}>
                Hello Geeks!
            </span>
            <br />
            <Icon iconName="WindowsLogo" style={{
                fontSize: FontSizes.size68,
                color: '#0078d4'
            }} />
            <br />
            <div>
                <DefaultButton className='btn'>
                    Default Button
                </DefaultButton>
                <PrimaryButton className='btn'>
                    Primary Button
                </PrimaryButton>
            </div>
        </div>
    );
}
  
export default App;


Output:

Whether you’re preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape, neveropen Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we’ve already empowered, and we’re here to do the same for you. Don’t miss out – check it out now!

RELATED ARTICLES

Most Popular

Recent Comments