Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to install and use semantic-ui-react

I want to build a web client using react.js and semantic ui. There is a node package to use semantic-ui with react.js; semantic ui react. I have already installed this package on my computer following the instructions on react.semantic-ui.com/usage, but upon testing the with a simple webpage.

I think I have this issue because I failed to use this last instruction: import '.../semantic/dist/semantic.min.css';. The semantic folder has been generated in my project main folder, but the dist folder and the semantic.min.css have not been generated yet. Where and how should I use this?

NB: I also tried adding this <link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/semantic-ui/2.2.2/semantic.min.css"></link> to my index.html page and the page was style as expected. I don't want to use this option as I cannot change the them with it.

like image 741
cdaiga Avatar asked Nov 25 '16 10:11

cdaiga


People also ask

How add Semantic UI in React JS?

Open this project in Visual Studio Code and install semantic UI using the following command. Install Semantic UI by using the following command, npm install semantic-ui-react.

How is semantic used in React?

We start by importing Form , Button , and Input from the Semantic UI package. Next, we use the Form , Form. Field , Input , and Button components to render a form. Also note the import of the Semantic UI CSS file with import "semantic-ui-css/semantic.


2 Answers

First - install css npm install semantic-ui-css --save
Then - import in at the index.js page (the very top level)
import 'semantic-ui-css/semantic.min.css';

like image 185
Donskikh Andrei Avatar answered Sep 29 '22 18:09

Donskikh Andrei


First, use one of below package managers to install semantic UI react package.

For npm users:

npm install semantic-ui-react

For yarn users:

yarn add semantic-ui-react

Then add this import line to your index.js

import 'semantic-ui-css/semantic.min.css'

That's all.

like image 44
Pasindu Dineth Peiris Avatar answered Sep 29 '22 17:09

Pasindu Dineth Peiris