ReactJS Semantic UI Segment 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 segment elements in ReactJS Semantic UI. The segment element is used to create a grouping of related content.
- Placeholder Segment: A segment can be used to reserve space for conditionally displayed content.
- Raised: A segment may be formatted to raise above the page
- Stacked: A segment can be formatted to show it contains multiple pages.
- Piled: A segment can be formatted to look like a pile of pages.
- Vertical Segment: A vertical segment formats content to be aligned as part of a vertical group.
- Disabled: disabled segment.
- Loading: segment is loading.
<segment content='content' />
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.
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.
Example 1: In this example, we will use a simple segment component to create a segment of content by using the Semantic UI Segment element.
Example 2: In this example, we will use a segment component with loading state to show that the content of segment is being loaded by using Semantic UI Segment element.