Friday, August 29, 2025
HomeLanguagesReact Suite FlexboxGrid Order

React Suite FlexboxGrid Order

React Suite is a front-end library designed for the middle platform and back-end products. React Suite FlexboxGrid component allows the user to use 24 grids as it is a grid layout component.

The order prop sorts in ascending order the React Suite FlexGrid items according to the value passed to the prop. It takes a number as a parameter.

Syntax:

<FlexboxGrid.Item order={}> </FlexboxGrid.Item>

Prerequisite:

Creating React Application and Module installation:

Step 1: Create the react project folder, for that open the terminal, and write the command npm create-react-app folder name, if you have already installed create-react-app globally. If you haven’t then install create-react-app globally by using the command npm -g create-react-app or can install locally by npm i create-react-app.

npm create-react-app project

Step 2: After creating your project folder(i.e. project), move to it by using the following command.

cd project

Step 3: Now install the dependency by using the following command:

npm install rsuite

Project Structure: It will look like this:

 

Example 1: We are importing the FlexboxGrid Component from rsuite, and to apply the default styles of the components we are importing “rsuite/dist/rsuite.min.css”. Within the FlexboxGrid component, we are adding FlexboxGrid.Item component with some numbers and some inline styling.

App.js




import { FlexboxGrid } from "rsuite";
import "rsuite/dist/rsuite.min.css";
function App() {
    return (
        <div className="App">
            <h4>React Suite FlexboxGrid Order</h4>
            <FlexboxGrid>
                <FlexboxGrid.Item
                    style={{ border: "1px solid green"
                    padding: "10px", margin: "10px" }}
                >
                    4
                </FlexboxGrid.Item>
                <FlexboxGrid.Item
                    style={{
                        border: "1px solid yellow",
                        padding: "10px",
                        margin: "10px",
                    }}
                >
                    1
                </FlexboxGrid.Item>
                <FlexboxGrid.Item
                    style={{ border: "1px solid blue"
                    padding: "10px", margin: "10px" }}
                >
                    3
                </FlexboxGrid.Item>
                <FlexboxGrid.Item
                    style={{ border: "1px solid red"
                    padding: "10px", margin: "10px" }}
                >
                    2
                </FlexboxGrid.Item>
            </FlexboxGrid>
        </div>
    );
}
  
export default App;


Step to Run Application: Run the application using the following command from the project’s root directory.

npm start

Output:

 

The items will appear the way we have written in our code.

Example 2: Now, using the above example we are adding the order prop to every <FlexboxGrid.Item> component, and we are passing the value assigned to every item to the prop.

App.js




import { FlexboxGrid } from "rsuite";
import "rsuite/dist/rsuite.min.css";
function App() {
    return (
        <div className="App">
            <h4>React Suite FlexboxGrid Order</h4>
            <FlexboxGrid>
                <FlexboxGrid.Item
                    order={4}
                    style={{
                        border: "1px solid green",
                        padding: "10px", margin: "10px"
                    }}
                >
                    4
                </FlexboxGrid.Item>
                <FlexboxGrid.Item
                    order={1}
                    style={{
                        border: "1px solid yellow",
                        padding: "10px",
                        margin: "10px",
                    }}
                >
                    1
                </FlexboxGrid.Item>
                <FlexboxGrid.Item
                    order={3}
                    style={{
                        border: "1px solid blue",
                        padding: "10px", margin: "10px"
                    }}
                >
                    3
                </FlexboxGrid.Item>
                <FlexboxGrid.Item
                    order={2}
                    style={{
                        border: "1px solid red",
                        padding: "10px", margin: "10px"
                    }}
                >
                    2
                </FlexboxGrid.Item>
            </FlexboxGrid>
        </div >
    );
}
  
export default App;


Step to Run Application: Run the application using the following command from the project’s root directory.

npm start

Output:

using order

It appears in a sorted manner, not like the order we have written it in our code.

Reference: https://rsuitejs.com/components/flexbox-grid/#code-lt-flexbox-grid-item-gt-code

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

Dominic
32246 POSTS0 COMMENTS
Milvus
80 POSTS0 COMMENTS
Nango Kala
6615 POSTS0 COMMENTS
Nicole Veronica
11787 POSTS0 COMMENTS
Nokonwaba Nkukhwana
11835 POSTS0 COMMENTS
Shaida Kate Naidoo
6731 POSTS0 COMMENTS
Ted Musemwa
7011 POSTS0 COMMENTS
Thapelo Manthata
6685 POSTS0 COMMENTS
Umr Jansen
6699 POSTS0 COMMENTS