Open In App

ReactJS Semantic UI container Element

Semantic UI is a modern framework used in developing seamless designs for the website, It gives the user a lightweight experience with its components. It uses the predefined CSS, JQuery language to incorporate in different frameworks.

In this article, we will know how to use Container elements in ReactJS Semantic UI. Container element is used to make a container in which we can input some text.



Syntax:

<Container>
    <p>Text</p>
</Container>

Container Types:



 

Container Variations:

Creating React Application And Installing Module:

Project Structure: It will look like the following.

 

Step to Run Application: Run the application from the root directory of the project, using the following command.

npm start

Example 1:




import React from 'react'
import { Container } from 'semantic-ui-react'
  
const styleLink = document.createElement("link");
styleLink.rel = "stylesheet";
styleLink.href = 
document.head.appendChild(styleLink);
  
const App = () =>(
    <Container>
        <p>
            Semantic UI is a modern framework used 
            in developing seamless designs for the
            website, Its gives the user a lightweight
            experience with its components. It uses
            the predefined CSS, JQuery language to 
            incorporate in different frameworks.
        </p>
  
    </Container>
)
  
export default App

Output: 

Example 2:

Filename: App.js




import React from 'react'
import { Container } from 'semantic-ui-react'
  
const styleLink = document.createElement("link");
styleLink.rel = "stylesheet";
styleLink.href = 
document.head.appendChild(styleLink);
  
const App = () =>(
    <Container fluid>
        <p>
            Semantic UI is a modern framework used 
            in developing seamless designs for the
            website, Its gives the user a lightweight
            experience with its components. It uses
            the predefined CSS, JQuery language to 
            incorporate in different frameworks.
        </p>
  
    </Container>
)
  
export default App

Output:

Example 3:




import React from 'react'
import { Container } from 'semantic-ui-react'
  
const styleLink = document.createElement("link");
styleLink.rel = "stylesheet";
styleLink.href = 
document.head.appendChild(styleLink);
  
const App = () => (
  <Container textAlign='right'>
    <Container textAlign='center'>
      <Container textAlign='left'>GeeksforGeeks</Container>
        GeeksforGeeks
      </Container>
        GeeksforGeeks
  </Container>
)
  
export default App

Output:

Reference: https://react.semantic-ui.com/elements/container


Article Tags :