Skip to main content
CodeSpeedTest
Languages
Start TypingJump into a test — pick any languageAdaptive TrainingUnlock chars as you master themPractice DrillsFocused sessions targeting weak spotsDaily ChallengesNew coding challenges every dayRace ModeCompete against others in real timeAI OpponentRace against an AI at your WPM levelTournamentsLive coding speed tournamentsArcade GamesZType, Overkill Survival, Glyphica & moreGamificationXP, coins, badges & quests
LeaderboardGlobal rankings for every languageCertificatesEarn verifiable Bronze / Silver / Gold certsActivityDaily streaks & historical analyticsProfileYour stats, badges & achievements
Browse Languages500+ languages with real code examplesBlogTips, guides & deep divesFree ToolsWPM calculator, typing speed report & moreFAQCommon questions answeredGetting StartedNew to CodeSpeedTest?AboutOur story & missionSupportGet help — Pro users get priorityContactGet in touch with the team
Pricing
  1. Home
  2. /
  3. Learn
  4. /
  5. Semantic-ui

Learn Semantic-ui - 9 Code Examples & CST Typing Practice Test

Semantic UI is a front-end framework that uses human-friendly HTML to create responsive, themable, and component-rich web applications. It emphasizes semantic class names and intuitive structure for rapid development.

View all 9 Semantic-ui code examples →
Semantic UI Counter ExampleSemantic UI Menu ExampleSemantic UI Card ExampleSemantic UI Modal ExampleSemantic UI Tab ExampleSemantic UI Accordion ExampleSemantic UI Dropdown ExampleSemantic UI Progress ExampleSemantic UI Message Example

Learn SEMANTIC-UI with Real Code Examples

Updated Nov 23, 2025

Explain

Semantic UI uses descriptive class names for components and layouts, making HTML readable and maintainable.

It provides a responsive grid system, prebuilt UI elements, and integrated JavaScript behaviors.

Designed for developers and designers who want consistency and fast prototyping.

Core Features

Grid system with responsive breakpoints

UI components: buttons, menus, cards, modals, tables

Form elements with validation support

JavaScript plugins for interactive components

Theming and customizable CSS variables

Basic Concepts Overview

Grid: `.ui.grid`, `.column`, `.row`

Buttons: `.ui.button`, `.primary`, `.secondary`

Forms: `.ui.form` with inputs and validation

Menus: `.ui.menu`, `.item`, `.dropdown`

Modals and interactive components via JS plugins

Project Structure

index.html - main markup

src/ - custom styles or component overrides

js/ - optional Semantic JS behaviors

assets/ - images, fonts, media

node_modules/ - npm packages if used

Building Workflow

Include Semantic UI CSS & JS via CDN or npm

Use semantic classes in HTML for components

Apply grid layout for responsive structure

Initialize JS behaviors for interactivity

Customize themes with variables if needed

Difficulty Use Cases

Beginner: static layouts and basic components

Intermediate: forms, tables, dropdowns

Advanced: custom themes and interactive JS plugins

Expert: large dashboards or admin apps

Community: contribute themes or custom modules

Comparisons

More semantic than Bootstrap

Less utility-driven than Tailwind

Prebuilt JS behaviors unlike minimal frameworks

Readable HTML structure

Comprehensive component library

Versioning Timeline

2013 - Semantic UI initial release

2014 - Semantic UI 1.0

2015 - Component and theme expansions

2016-2020 - Minor updates and plugin improvements

2025 - Active maintenance primarily via Fomantic UI

Glossary

UI Component: prebuilt interactive element

Grid: layout system for responsive design

JS Plugin: interactive behavior (dropdown, modal)

Theming: customization of colors, fonts, variables

Semantic class: human-readable class name

Installation Setup

Install via npm: `npm install semantic-ui`

Or use CDN: `<link rel='stylesheet' href='https://cdn.jsdelivr.net/npm/semantic-ui/dist/semantic.min.css'>`

Include JS via CDN or npm for behaviors

Optional: customize theme via `semantic.json` or LESS/SASS

Integrate with build tools like Gulp, Webpack, or Parcel

Environment Setup

Install Node.js & npm

Install Semantic UI via npm or CDN

Setup Gulp or build process if customizing

Include JS behaviors for interactive components

Start coding semantic, responsive UI

Config Files

semantic.json - build config and theme variables

index.html - markup

src/ - custom overrides

dist/ - compiled CSS/JS

package.json - npm dependencies

Cli Commands

npm install semantic-ui

gulp build - compile CSS/JS

gulp watch - development mode

gulp install - setup theme

Optional: npm start for dev server

Internationalization

Framework is language-agnostic

Form messages can be customized per locale

RTL support via CSS overrides

JS behaviors are locale-independent

Typography adaptable for multiple languages

Accessibility

ARIA roles supported

Keyboard navigation for interactive components

Semantic HTML encourages screen reader support

Focus management in modals and dropdowns

Accessible form validation and feedback

Ui Styling

Prebuilt components: buttons, menus, modals

Responsive grid system

Customizable themes via variables

Typography, icons, and UI elements

Accessible and readable HTML structure

State Management

No built-in state system

JS behaviors manage basic component states

Reactive frameworks manage app-level state

Class toggles via JS for dropdowns/modals

Accessible focus and ARIA attributes supported

Data Management

Handled via framework or JS logic

Forms integrated with validation behaviors

Dynamic components via JS plugin API

No direct data-binding included

Integrates with frontend frameworks for data

Architecture

Semantic HTML classes

Responsive grid layout

CSS and JS component-based system

Theme and variable driven customization

Integrated accessibility support

Rendering Model

CSS for layout and styling

JS for component behaviors

Semantic HTML markup

Responsive grid with breakpoints

Theme variables for customization

Architectural Patterns

Component-based UI

Semantic HTML for readability

Grid-first layout system

JS-enhanced interactivity

Theme and variable-driven styling

Real World Architectures

Admin dashboards

Data-heavy web applications

Prototyping MVPs

Corporate websites with semantic structure

Responsive web apps with interactive components

Design Principles

Semantic class names

Component-driven development

Responsive, mobile-first layouts

Customizable themes

Integrated JS behaviors for interactivity

Scalability Guide

Only include needed components for performance

Use theme variables for consistency

Optimize JS plugin usage

Organize components and overrides efficiently

Leverage grid system for complex layouts

Migration Guide

Semantic UI -> Fomantic UI: bug fixes and modern updates

Update class names if using new components

Update JS plugin initialization

Adjust theme variables and overrides

Ensure responsive and accessibility changes

Performance Notes

Only include required components to reduce bundle size

Use minified CSS/JS for production

Optimize images and assets separately

Leverage browser caching

Remove unused themes or overrides

Security Notes

Validate form inputs server-side

Ensure safe usage of JS behaviors

Keep Semantic UI version updated

Avoid unsafe inline scripts

Audit third-party plugins for vulnerabilities

Monitoring Analytics

Audit CSS & JS bundle size

Test responsive layouts across devices

Check interactive components

Monitor accessibility compliance

Track performance in production

Code Quality

Use semantic class names consistently

Maintain theme variable consistency

Avoid unnecessary overrides

Document JS plugin usage

Ensure responsive and accessible behavior

Practical Examples

Corporate websites

Dashboard interfaces

Prototyping MVPs

Data-heavy admin apps

Mobile-responsive web apps

Troubleshooting

Ensure CSS and JS are loaded correctly

Check class names for typos

Verify JS behaviors initialized properly

Resolve conflicts with other frameworks

Confirm responsive grid is used correctly

Testing Guide

Test grid and component responsiveness

Verify JS behaviors (dropdowns, modals, tabs)

Validate form interactions

Check cross-browser rendering

Ensure accessibility support

Deployment Options

CDN hosting for CSS & JS

Self-host compiled CSS/JS

Bundle with framework components

Integrate in static or dynamic sites

Include custom themes for production

Tools Ecosystem

Semantic UI React / Vue / Angular integrations

Fomantic UI - community fork with enhancements

Theme builder

Component extensions

Official and community templates

Integrations

React (Semantic UI React)

Vue and Angular wrappers

Static sites and CMS platforms

Build tools: Gulp, Webpack, Parcel

Design systems via themes and variables

Productivity Tips

Use semantic class names for clarity

Leverage JS behaviors only as needed

Create reusable grid layouts

Customize themes with variables

Optimize bundle size for production

Challenges

Build a semantic, responsive landing page

Create a form-heavy admin panel

Implement dropdowns, modals, and tabs

Customize theme colors and typography

Ensure keyboard accessibility and ARIA roles

Learning Path

Learn semantic class naming

Understand grid system

Explore components and forms

Integrate JS behaviors

Customize themes and variables

Skill Improvement Plan

Week 1: Grid and layout basics

Week 2: Buttons, menus, forms

Week 3: JS plugins for interactivity

Week 4: Theming and variable overrides

Week 5: Build dashboards or admin panels

Interview Questions

Explain Semantic UI’s approach to semantic class names.

How does the grid system work?

Describe JS behaviors and plugins.

How to customize themes and variables?

Compare Semantic UI to Bootstrap and Tailwind.

Cheat Sheet

`.ui.grid` - grid container

`.column` - grid item

`.ui.button` - button

`.ui.menu` - navigation menu

`.ui.modal` - modal plugin

Books

Semantic UI in Action

Mastering Semantic UI

Building Responsive Apps with Semantic UI

Semantic UI for Designers and Developers

Fomantic UI Advanced Patterns

Tutorials

Official Semantic UI documentation

Fomantic UI guides

YouTube tutorials

freeCodeCamp examples

Community blogs and demos

Official Docs

https://semantic-ui.com

https://fomantic-ui.com

https://github.com/Semantic-Org/Semantic-UI

Community Links

Semantic UI GitHub

Fomantic UI GitHub

StackOverflow Semantic UI tag

Reddit r/semanticui

Twitter #semanticui

Community Support

Semantic UI GitHub

StackOverflow Semantic UI tag

Fomantic UI community

Reddit r/semanticui

Official documentation & examples

Monetization

Create Semantic UI-based templates

Develop admin dashboards for clients

Offer Fomantic UI custom themes

Consulting for semantic and accessible UI

Build reusable component libraries

Future Roadmap

Continue Semantic UI via Fomantic UI fork

Enhanced themes and components

Better framework integrations

Performance optimization

Maintain accessibility and responsive support

When Not To Use

Projects preferring utility-first CSS

Small static pages needing minimal CSS

Teams requiring very small bundle sizes

Rapid prototyping with modern micro-libraries

Projects requiring frequent framework updates

Final Summary

Semantic UI is a semantic, human-readable front-end framework.

Offers responsive grids, prebuilt components, and JS behaviors.

Customizable themes and variable-driven design.

Ideal for dashboards, admin apps, and enterprise projects.

Balances readability with comprehensive UI features.

Faq

Is Semantic UI still maintained?

Partially - Fomantic UI fork is more actively maintained.

Can I use Semantic UI with frameworks?

Yes - React, Vue, Angular wrappers available.

Does it support responsive design?

Yes, via grid system and breakpoints.

Is it beginner-friendly?

Moderate - semantic class names are intuitive but verbose.

Can I create custom themes?

Yes, using theme variables or the theme builder.

Code Sample Descriptions

1

Semantic UI Counter Example

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/semantic-ui/2.4.2/semantic.min.css">
    <title>Semantic UI Counter</title>
</head>
<body class="ui container center aligned">
    <h2 class="ui header">Counter: <span id="count">0</span></h2>
    <div class="ui buttons">
        <button id="increment" class="ui primary button">+</button>
        <button id="decrement" class="ui red button">-</button>
        <button id="reset" class="ui grey button">Reset</button>
    </div>
    <br><br>
    <button id="theme-btn" class="ui yellow button">Switch Theme</button>

    <script>
        let count = 0;
        let isDark = false;
        const countEl = document.getElementById('count');
        const body = document.body;

        document.getElementById('increment').onclick = () => { count++; countEl.textContent = count; };
        document.getElementById('decrement').onclick = () => { count--; countEl.textContent = count; };
        document.getElementById('reset').onclick = () => { count = 0; countEl.textContent = count; };
        document.getElementById('theme-btn').onclick = () => {
        isDark = !isDark;
        body.classList.toggle('inverted', isDark);
        };
    </script>

    <script src="https://cdnjs.cloudflare.com/ajax/libs/semantic-ui/2.4.2/semantic.min.js"></script>
</body>
</html>

Demonstrates a simple counter layout using Semantic UI classes and minimal JavaScript for interactivity.

Let’s Try →
2

Semantic UI Menu Example

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/semantic-ui/2.4.2/semantic.min.css">
    <title>Semantic UI Menu</title>
</head>
<body class="ui container">
    <div class="ui menu">
        <a class="active item">Home</a>
        <a class="item">About</a>
        <a class="item">Contact</a>
        <div class="right menu">
        <a class="item">Login</a>
        </div>
    </div>
</body>
</html>

Demonstrates a responsive navigation menu using Semantic UI menu classes.

Let’s Try →
3

Semantic UI Card Example

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/semantic-ui/2.4.2/semantic.min.css">
    <title>Semantic UI Card</title>
</head>
<body class="ui container">
    <div class="ui card">
        <div class="image">
        <img src="https://via.placeholder.com/300">
        </div>
        <div class="content">
        <a class="header">Card Title</a>
        <div class="description">Example card content using Semantic UI.</div>
        </div>
        <div class="extra content">
        <a><i class="user icon"></i> 10 Friends</a>
        </div>
    </div>
</body>
</html>

Shows a card layout using Semantic UI card classes.

Let’s Try →
4

Semantic UI Modal Example

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/semantic-ui/2.4.2/semantic.min.css">
    <title>Semantic UI Modal</title>
</head>
<body class="ui container center aligned">
    <button class="ui button" id="openModal">Open Modal</button>
    <div class="ui modal">
        <div class="header">Modal Header</div>
        <div class="content">
        <p>This is a Semantic UI modal example.</p>
        </div>
        <div class="actions">
        <div class="ui approve button">OK</div>
        <div class="ui cancel button">Cancel</div>
        </div>
    </div>

    <script src="https://cdnjs.cloudflare.com/ajax/libs/semantic-ui/2.4.2/semantic.min.js"></script>
    <script>
        document.getElementById('openModal').onclick = () => {
        $('.ui.modal').modal('show');
        };
    </script>
</body>
</html>

Demonstrates a modal popup using Semantic UI modal classes.

Let’s Try →
5

Semantic UI Tab Example

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/semantic-ui/2.4.2/semantic.min.css">
    <title>Semantic UI Tabs</title>
</head>
<body class="ui container">
    <div class="ui top attached tabular menu">
        <a class="active item" data-tab="first">Tab 1</a>
        <a class="item" data-tab="second">Tab 2</a>
        <a class="item" data-tab="third">Tab 3</a>
    </div>
    <div class="ui bottom attached tab segment active" data-tab="first">Content for Tab 1</div>
    <div class="ui bottom attached tab segment" data-tab="second">Content for Tab 2</div>
    <div class="ui bottom attached tab segment" data-tab="third">Content for Tab 3</div>

    <script src="https://cdnjs.cloudflare.com/ajax/libs/semantic-ui/2.4.2/semantic.min.js"></script>
    <script>
        $('.menu .item').tab();
    </script>
</body>
</html>

Shows a tabbed interface using Semantic UI tab classes.

Let’s Try →
6

Semantic UI Accordion Example

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/semantic-ui/2.4.2/semantic.min.css">
    <title>Semantic UI Accordion</title>
</head>
<body class="ui container">
    <div class="ui styled fluid accordion">
        <div class="title"><i class="dropdown icon"></i> Section 1</div>
        <div class="content"><p>Content for section 1</p></div>
        <div class="title"><i class="dropdown icon"></i> Section 2</div>
        <div class="content"><p>Content for section 2</p></div>
    </div>

    <script src="https://cdnjs.cloudflare.com/ajax/libs/semantic-ui/2.4.2/semantic.min.js"></script>
    <script>
        $('.ui.accordion').accordion();
    </script>
</body>
</html>

Demonstrates an accordion component using Semantic UI.

Let’s Try →
7

Semantic UI Dropdown Example

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/semantic-ui/2.4.2/semantic.min.css">
    <title>Semantic UI Dropdown</title>
</head>
<body class="ui container">
    <div class="ui dropdown">
        <div class="text">Select Option</div>
        <i class="dropdown icon"></i>
        <div class="menu">
        <div class="item">Option 1</div>
        <div class="item">Option 2</div>
        <div class="item">Option 3</div>
        </div>
    </div>

    <script src="https://cdnjs.cloudflare.com/ajax/libs/semantic-ui/2.4.2/semantic.min.js"></script>
    <script>
        $('.ui.dropdown').dropdown();
    </script>
</body>
</html>

Shows a dropdown menu using Semantic UI dropdown classes.

Let’s Try →
8

Semantic UI Progress Example

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/semantic-ui/2.4.2/semantic.min.css">
    <title>Semantic UI Progress</title>
</head>
<body class="ui container">
    <div class="ui indicating progress" data-percent="50">
        <div class="bar" style="width: 50%;"></div>
        <div class="label">Progress</div>
    </div>
</body>
</html>

Demonstrates a progress bar using Semantic UI classes.

Let’s Try →
9

Semantic UI Message Example

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/semantic-ui/2.4.2/semantic.min.css">
    <title>Semantic UI Message</title>
</head>
<body class="ui container">
    <div class="ui positive message">
        <i class="close icon"></i>
        <div class="header">Success</div>
        <p>This is a Semantic UI success message.</p>
    </div>

    <script src="https://cdnjs.cloudflare.com/ajax/libs/semantic-ui/2.4.2/semantic.min.js"></script>
    <script>
        $('.message .close').on('click', function() {
        $(this).closest('.message').transition('fade');
        });
    </script>
</body>
</html>

Shows a dismissable message using Semantic UI message classes.

Let’s Try →

Frequently Asked Questions about Semantic-ui

What is Semantic-ui?

Semantic UI is a front-end framework that uses human-friendly HTML to create responsive, themable, and component-rich web applications. It emphasizes semantic class names and intuitive structure for rapid development.

What are the primary use cases for Semantic-ui?

Corporate websites and web apps. Admin dashboards and data-heavy apps. Prototyping user interfaces quickly. Design systems with consistent component patterns. Mobile-responsive web applications

What are the strengths of Semantic-ui?

Readable and semantic HTML. Comprehensive UI component library. Easy integration of JavaScript behaviors. Responsive design and mobile-first support. Customizable themes and variables

What are the limitations of Semantic-ui?

Relatively large CSS/JS bundle if not optimized. Smaller community than Bootstrap or Tailwind. Learning curve due to verbose class names. Updates less frequent than major frameworks. Less utility-first, less control over atomic styling

How can I practice Semantic-ui typing speed?

CodeSpeedTest offers 9+ real Semantic-ui code examples for typing practice. You can measure your WPM, track accuracy, and improve your coding speed with guided exercises.

Learn Other Programming Languages

CReactPythonC++RustTypeScriptKotlinPHPJavaC#RubyMqlCqlN1qlCypherGremlinPartiqlHaskellElixirFsharpView all languages →
CodeSpeedTest

Improve your coding speed, code accuracy, and programming syntax WPM with practice sessions across 500+ programming languages.

Quick Links

HomeAboutFeaturesGetting StartedLanguages

Legal & Support

Pro ⚡ PricingContactPrivacy PolicyTerms of Service

Connect

CodeSpeedTest on GitHubCodeSpeedTest on TwitterEmail CodeSpeedTest

© 2026 CodeSpeedTest. All rights reserved.