Open In App

ReactJS Semantic UI button 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 and jQuery to incorporate in different frameworks.

In this article, we will know how to use button element in ReactJS Semantic UI. Button element is used to make a button that will indicate a possible user action.



Syntax:

<Button content='Content'/>

Button Types:



 

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 { Button } from 'semantic-ui-react'
  
const styleLink = document.createElement("link");
styleLink.rel = "stylesheet";
styleLink.href = 
document.head.appendChild(styleLink);
  
const App = () => <Button>Submit</Button>
  
export default App    

Output: 

Example 2: Making a button using shorthand.




import React from 'react'
import { Button } from 'semantic-ui-react'
  
const styleLink = document.createElement("link");
styleLink.rel = "stylesheet";
styleLink.href = 
document.head.appendChild(styleLink);
  
const App = () => <Button content='Submit' />
  
export default App    

Output:

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


Article Tags :