In this article, we will learn about how to leverage the office UI fabric grid in our SPFx component and also the implementation of accordion, Datepicker, and richtext controls in our component.


OfficeUI Grid

As similar to bootstrap grid breakpoint, OfficeUI also has its own breakpoints.

Grid Layout

Breakpoint Range
small (SM) 320px – 479px
medium (MD) 480px – 639px
large (LG) 1023px
extra large (XL) 1365px
extra extra large (XXL) 1366px – 1919px
extra extra extra large (XXXL) 1920px and so on…

The screen is divided into 12 columns, here it’s only available via Fabric Core CSS.

Import the below package in your TSX file, to use fabricui layout,

To use the grid in your component, you must use the below classes,

class=”ms-Grid” –> this should be in top parent class

class=”ms-Grid-row” –> this should be in adjacent parent class

Here the number is the columns, which range from 1 – 12.

Push and pull

This is used to change the order,

Push–> push to right(left to right)

Pull–> pull from the right(right to left)



This control is used to implement a collapsible segment in our SPFx component, this can be done by using @pnp/spfx-controls-react

In npm installation,

Import statement,



title string
defaultCollapsed boolean
className string

Date picker

This control is used to implement datepicker in our SPFx component.

Npm installation,

Import statement,


Rich text

Npm installation,

Import statements,



Open a command prompt and create a directory for the SPFx solution.

md spfx-MyAccordian

Navigate to the above-created directory.

cd spfx-MyAccordian

Run the Yeoman SharePoint Generator to create the solution.

yo @microsoft/sharepoint

Solution Name

Hit enter for the default name (spfx-MyAccordian in this case) or type in any other name for your solution.

Selected choice – Hit Enter

Target for the component

Here, we can select the target environment where we are planning to deploy the client web part; i.e., SharePoint Online or SharePoint OnPremise (SharePoint 2016 onwards).

Selected choice – SharePoint Online only (latest).

Place of files

We may choose to use the same folder or create a subfolder for our solution.

Selected choice – same folder.

Deployment option

Selecting Y will allow the app to be deployed instantly to all sites and be accessible everywhere.

Selected choice – N (install on each site explicitly).

Permissions to access web APIs

Choose if the components in the solution require permission to access web APIs that are unique and not shared with other components in the tenant.

Selected choice – N (solution contains unique permissions)

Type of client-side component to create

We can choose to create a client-side web part or an extension. Choose the web part option.

Selected choice – WebPart

Web part name

Hit Enter to select the default name or type in any other name.

Selected choice – MyAccordian

Web part description

Hit Enter to select the default description or type in any other value.

Framework to use

Select any JavaScript framework to develop the component. Available choices are – No JavaScript Framework, React, and Knockout.

Selected choice – React

The Yeoman generator will perform a scaffolding process to generate the solution. The scaffolding process will take a significant amount of time.

Once the scaffolding process is completed, lock down the version of project dependencies by running the below command,

npm shrinkwrap

In the command prompt, type the below command to open the solution in the code editor of your choice.

In MyAccordian.tsx,

Expected Output

PC view

Mobile view