React Suite is a popular front-end library with a set of React components that are designed for the middle platform and back-end products. It is a developer-friendly UI framework.
Installation: You can install it with the following command:
npm i rsuite
// or
yarn add rsuite
Now you can import suite components like:
import { Button } from 'rsuite';
Let's understand it's working with the help of examples.
Creating React Application And Installing Module:
Step 1: Create a React application using the following command:
npx create-react-app foldername
Step 2: After creating your project folder i.e. foldername, move to it using the following command:
cd foldername
Step 3: After creating the ReactJS application, Install the required module using the following command:
npm install rsuite
Project Structure: It will look like the following.
Example 1: In this example, we will use how to use the input component of ReactJS Suite.
App.js
import React from 'react'
import 'rsuite/dist/styles/rsuite-default.css';
import { Input } from 'rsuite';
export default function App() {
// State of our dream city
const [dreamCity, setDreamCity] = React.useState('')
return (
<div style={{
display: 'block', width: 700, paddingLeft: 30
}}>
<h4>React Suite Input Component</h4>
<Input
placeholder="Enter your dream city"
onChange={(e) => setDreamCity(e)}
/>
Dream City Value: {dreamCity}
</div>
);
}
Step to Run Application: Run the application using the following command from the root directory of the project:
npm start
Output: Now open your browser and go to http://localhost:3000/, you will see the following output:
Â
Example 2: In this example, we will see how to use domHelper component of ReactJS Suite. We will use the addTheStyling method to add the style to our element at the click of the button.
App.js
import React from 'react'
import 'rsuite/dist/styles/rsuite-default.css';
import { Button, DOMHelper } from 'rsuite';
const { addStyle } = DOMHelper;
export default class App extends React.Component {
// State holding initial style
constructor(props) {
super(props);
this.state = {
htmlCode: '<div class="view"></div>'
};
}
// Function to set the states with latest style
showView() {
const htmlCode = this.container.innerHTML;
this.setState({ htmlCode });
}
// Function to add the styles
addTheStyling() {
addStyle(this.view, {
'margin-top': '16px',
'color': 'orange'
});
this.showView();
}
render() {
const { htmlCode } = this.state;
return (
<div>
<h4>React Suite DOMHelper Component</h4>
<Button appearance="primary"
onClick={() => this.addTheStyling()} >
Click to Add Style
</Button>
<div>{htmlCode}</div>
<div ref={ref => { this.container = ref }}>
<div className="view" ref={ref => { this.view = ref }} />
</div>
</div>
);
}
}
Output:
Â
Features:
- Server-Side Rendering(SSR): React Suite supports Server Side Rendering, Which supports Next.js to build applications.
Supported Platforms:
Browser's Name | Version |
Internet Explorer | >=11 |
Safari | >= 10 |
Edge | >=14 |
Firefox | >= 45 |
Chrome | >= 49 |
Supported development environment:
Similar Reads
React Introduction ReactJS is a component-based JavaScript library used to build dynamic and interactive user interfaces. It simplifies the creation of single-page applications (SPAs) with a focus on performance and maintainability.It is developed and maintained by Facebook.The latest version of React is React 19.Uses
8 min read
React Suite Nav Props React Suite is a front-end library designed for the middle platform and back-end products. The React Suite Nav component acts as a navigator it allows the user to provide an easy way to navigate. The props are: classPrefix: This denotes the prefix of the component CSS class. Specifying any value her
3 min read
Environment Protection Website using React Imagine building a website that champions environmental protection. That's exactly what we're aiming for with this project. We're crafting a space using React where people can learn, share, and engage in all things related to safeguarding our planet.Output Preview: Let us have a look at how the fina
7 min read
React Suite Nav Appearance A React suite is a library of React components, sensible UI design, and a friendly development experience. It is supported in all major browsers. It provides pre-built components of React which can be used easily in any web application. In this article, we'll learn about React suite nav appearance.
3 min read
React Constructor and Super Keyword In this article, we will learn about the React Constructor and Super keyword. In React JS constructor is used for class components not for the functional component. In React JS super call other constructor methods that is instantiated.Table of ContentConstructor:Super:Constructor:In React JS constru
3 min read
React vs React Native? React and React Native, created by Facebook, are popular tools for building user-friendly apps. React is mainly used for web applications, while React Native focuses on mobile apps. They share similar concepts, but each serves a unique purpose.Table of ContentReact vs React NativeWhat is React ?What
4 min read