Open In App

ReactJS Semantic UI Select Addons

Last Updated : 24 Jun, 2021
Improve
Improve
Like Article
Like
Save
Share
Report

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 see how to use Select Addons in ReactJS Semantic UI. Select Addons is used to make a select element which can be used to select elements from addons.

Syntax:

<Select />

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: Install semantic UI in your given directory.
    npm install semantic-ui-react semantic-ui-css

 

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: This is the basic example that shows how to use select addons by using ReactJS Semantic UI Select Addons.

App.js




import React from 'react'
import { Select } from 'semantic-ui-react'
  
const styleLink = document.createElement("link");
styleLink.rel = "stylesheet";
styleLink.href = 
document.head.appendChild(styleLink);
  
const gfg = [
    { key: 'h5', value: 'h5', text: 'HTML5' },
    { key: 'js', value: 'js', text: 'JavaScript' },
    { key: 'aj', value: 'aj', text: 'AngularJS' },
    { key: 'rj', value: 'rj', text: 'ReactJS' },
    { key: 'nj', value: 'nj', text: 'NodeJS' },
    { key: 'ja', value: 'ja', text: 'Java' },
  ]
  const btt = () => (
    <Select placeholder='Select your Language' options={gfg} />
  )
    
  export default btt


Output:

Reference: https://react.semantic-ui.com/addons/select


Like Article
Suggest improvement
Previous
Next
Share your thoughts in the comments

Similar Reads