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 Container Basic Layout. The container layout can define the main frame of the page using header, content, sidebar, and footer components.
Syntax:
<Container> <Header>Header</Header> <Content>Content</Content> <Footer>Footer</Footer> </Container>
Creating React Application And Installing Module:
Step 1: Create a React application using the given command:
npm create-react-app projectname
Step 2: After creating your project, move to it using the given command:
cd projectname
Step 3: Now Install the rsuite node package using the given command:
npm install rsuite
Project Structure: Now your project structure should look like the following:
Example 1: Below example demonstrates the basic container layout with header, footer, and content.
Javascript
import { Container, Header, Footer, Content, Sidebar } from "rsuite" ; import "rsuite/dist/rsuite.min.css" ; export default function App() { return ( <center> <div> <h2>neveropen</h2> <h4 style={{ color: "green" }}> React Suite Container Basic Layout </h4> <div style={{ marginTop: 20, width: 800 }}> <Container> <Header style={{ backgroundColor: "skyblue" , padding: 20, color: "white" , }} > <h2>neveropen</h2> </Header> <Content style={{ backgroundColor: "lightgreen" , padding: 40, color: "white" , }} > neveropen is a portal for neveropen. It is a collection of well-written, well-thought, and well-responsive articles. </Content> <Footer style={{ backgroundColor: "skyblue" , padding: 20, color: "white" , }} > © neveropen.org </Footer> </Container> </div> </div> </center> ); } |
Output:
Example 2: Below example demonstrates the basic container layout with a sidebar.
Javascript
import { Container, Header, Footer, Content, Sidebar } from "rsuite" ; import "rsuite/dist/rsuite.min.css" ; export default function App() { return ( <center> <div> <h2>neveropen</h2> <h4 style={{ color: "green" }}> React Suite Container Basic Layout </h4> <div style={{ marginTop: 20, width: 800 }}> <Container> <Sidebar style={{ backgroundColor: "orange" , padding: 20, color: "white" }} > <h4>Courses</h4> <ul style={{ listStyleType: "none" , padding: 0, margin: 0 }}> <li>JavaScript</li> <li>React</li> <li>Node</li> </ul> </Sidebar> <Container> <Header style={{ backgroundColor: "skyblue" , padding: 20, color: "white" , }} > <h2>neveropen</h2> </Header> <Content style={{ backgroundColor: "lightgreen" , padding: 40, color: "white" , }} > neveropen is a portal for neveropen. It is a collection of well-written, well-thought, and well-responsive articles. </Content> <Footer style={{ backgroundColor: "skyblue" , padding: 20, color: "white" , }} > © neveropen.org </Footer> </Container> </Container> </div> </div> </center> ); } |
Output:
Reference: https://rsuitejs.com/components/container/#basic-layout