Semantic UI is an open-source framework that uses CSS and jQuery to build great user interfaces. It is the same as a bootstrap for use and has great different elements to use to make your website look more amazing. It uses a class to add CSS to the elements.
A Sidebar is a great way to hide additional content from the user unless required. Semantic UI provides us with a styled sidebar. Before jumping into the sidebar types, let’s have a look at various sidebar type classes.
Semantic UI Sidebar Type:
- Sidebar: This is used to create a sidebar.
Syntax:
<div class="ui sidebar">
...
</div>
Note: Sidebars can be used with any type of content but are mostly used with an inverted vertical menu. Follow the below examples for understanding.
Example 1: In the below example, we have created a standard menu sidebar using sidebar vertical menu classes.
HTML
<!DOCTYPE html>
< html >
< head >
< title >Semantic UI Sidebar Types</ title >
< link href =
rel = "stylesheet" />
< script src =
integrity =
"sha256-hVVnYaiADRTO2PzUGmuLJr8BLUSjGIZsDYGmIJLv2b8="
crossorigin = "anonymous" >
</ script >
< script src =
</ script >
</ head >
< body >
< div class = "ui sidebar vertical menu" >
< a class = "item" >Web Development</ a >
< a class = "item" >Machine Learning</ a >
< a class = "item" >Data Science</ a >
< a class = "item" >Blockchain</ a >
</ div >
< div class = "ui pusher container" >
< h2 class = "ui green header" >GeeksforGeeks</ h2 >
< h4 >Semantic UI Sidebar Types</ h4 >
< hr >
< br />
< button class = "ui button"
onclick = "toggle()" >
Toggle Sidebar
</ button >
</ div >
< script >
const toggle = () => $('.ui.sidebar').sidebar('toggle');
</ script >
</ body >
</ html >
|
Output:

Semantic-UI Sidebar Types
Example 2: In the below example, we have created an inverted sidebar using sidebar inverted vertical menu classes.
HTML
<!DOCTYPE html>
< html >
< head >
< title >Semantic UI Sidebar Types</ title >
< link href =
rel = "stylesheet" />
< script src =
integrity =
"sha256-hVVnYaiADRTO2PzUGmuLJr8BLUSjGIZsDYGmIJLv2b8="
crossorigin = "anonymous" >
</ script >
< script src =
</ script >
</ head >
< body >
< div class = "ui sidebar inverted vertical menu" >
< a class = "item" >Web Development</ a >
< a class = "item" >Machine Learning</ a >
< a class = "item" >Data Science</ a >
< a class = "item" >Blockchain</ a >
</ div >
< div class = "ui pusher container" >
< h2 class = "ui green header" >GeeksforGeeks</ h2 >
< h4 >Semantic UI Sidebar Types</ h4 >
< hr >
< br />
< button class = "ui button"
onclick = "toggle()" >
Toggle Sidebar
</ button >
</ div >
< script >
const toggle = () => $('.ui.sidebar').sidebar('toggle');
</ script >
</ body >
</ html >
|
Output:

Semantic-UI Sidebar Types
References: https://semantic-ui.com/modules/sidebar.html