semantic-css

Skill for building beautiful, accessible web interfaces with semantic CSS. Provides design tokens for colors, typography, spacing, and effects with a 6-theme system. Use this skill when styling web applications with scalable, meaningful CSS that prioritizes accessibility and theming.

Safety Notice

This listing is imported from skills.sh public index metadata. Review upstream SKILL.md and repository scripts before running.

Copy this and send it to your AI assistant to learn

Install skill "semantic-css" with this command: npx skills add createnewui/skills/createnewui-skills-semantic-css

Semantic CSS with New UI

Crafted with care. Styled for impact.

New UI is a modern, semantic UI framework for building beautiful, accessible sites and apps. It provides the core design foundations you need—including colors, typography, spacing, sizing, layouts, and effects.

Designed to grow with you from your first launch to millions of users, it is thoughtfully made for makers, small teams, and anyone who values functional, scalable, and timeless design.

Core Principles

  • Built to scale — Core building blocks for modern interfaces that grow with your needs.
  • Themes that adapt — Customizable default themes with cold and warm variants to match your brand.
  • Framework agnostic — Works seamlessly with React, Vue, Svelte, or any framework you choose.
  • Accessibility first — WCAG-compliant with built-in keyboard navigation and focus management.

Getting Started

Install

npm i -D @new-ui/foundations

Note: This command installs all New UI foundation packages, which include reset, colors, effects, spacings, and typography.

CDN Quick Start

<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@new-ui/foundations@latest/dist/index.css" />

Import

@use '@new-ui/foundations'; // Use `@import` for CSS

Set the Theme

Set the theme by adding the data-new-ui-theme attribute to your HTML wrapper element:

<html data-new-ui-theme="light"></html>
Available ThemesValue
Light (Default)light
Light warmlight--warm
Light coldlight--cold
Dark (Default)dark
Dark warmdark--warm
Dark colddark--cold

Naming Convention

All classes associated with the New UI are prefixed with a global namespace followed by a hyphen: nu-

In addition to a global namespace, we added prefixes to each class to make it more apparent what job that class is doing using BEM syntax:

PrefixPurpose
nu-c-UI components
nu-l-Layout-related styles
nu-u-Utilities
is-State-based classes
has-State-based classes
js-Targeting JavaScript functionality

Design Tokens

Colors

BackgroundRole
--backgroundDefault app background
--background-secondarySecondary app background
--background-hoverBackground hover
--background-selectedUI element background
--background-selected-hoverUI element background hovered
--background-high-contrastHigh contrast background
BorderRole
--border-mutedMuted strokes and separators
--borderDefault strokes and separators
--border-strongStrong strokes and separators
--border-inkedInked strokes and separators
--border-inverseInverse strokes and separators
--border-focusFocus outline
ButtonRole
--buttonPrimary button background
--button-hoverPrimary button hover
--button-activePrimary button active
--button-disabledDisabled button background
LinkRole
--linkPrimary link
--link-hoverHover state for primary link
--link-subtleSecondary link
--link-visitedLink visited
SupportRole
--support-errorError
--support-warningWarning
--support-successSuccess
--support-infoInformation
ContentRole
--content-primaryPrimary body copy
--content-secondarySecondary text color
--content-secondary-altSecondary text color alt
--content-placeholderPlaceholder text color
--content-on-colorText on interactive color
--content-errorError message
--content-successSuccess message
--content-inkedInked text

Effects

ShadowsRole
--dialog-strongModals, sidebar overlays, toasts
--dialogDropdown, tooltip, popover
--contentContent area, buttons, controls, cards, pills
--canvasBackground
--keyboard-keyKeyboard key component
FocusRole
--focus-defaultDefault focus
--focus-accentAccent focus
--focus-inverseFocus inverse
RadiusBlur
--radius-xs--blur-xs
--radius-sm--blur-sm
--radius-md--blur-md
--radius-lg--blur-lg
--radius-xl--blur-xl
--radius-2xl--blur-2xl
--radius-3xl--blur-3xl
--radius-4xl
PerspectiveValue
--perspective-dramatic6.25rem
--perspective-near18.75rem
--perspective-normal31.25rem
--perspective-midrange50rem
--perspective-distant75rem
OtherValue
--aspect-video16/9
--keyboard-keyKeyboard key component shadow

Spacings

TokenSourceSize (px/rem)
--spacing-zero--spacing-000 / 0
--spacing-xs--spacing-024 / 0.25
--spacing-s--spacing-048 / 0.5
--spacing-m--spacing-0512 / 0.75
--spacing-l--spacing-0616 / 1
--spacing-xl--spacing-0824 / 1.5
--spacing-xxl--spacing-0932 / 2
--spacing-xxxl--spacing-1148 / 3

Sizing

TokenSourceSize (px/rem)
--size-xs--spacing-0616 / 1
--size-s--spacing-0824 / 1.5
--size-m--spacing-0932 / 2
--controls-size-default--spacing-0932 / 2
--controls-size-small--spacing-0824 / 1.5

Typography

Heading (Desktop)Heading (Mobile)Role
--desktop-heading-01--mobile-heading-01Heading 01
--desktop-heading-02--mobile-heading-02Heading 02
--desktop-heading-03--mobile-heading-03Heading 03
--desktop-heading-04--mobile-heading-04Heading 04
--desktop-heading-05--mobile-heading-05Heading 05
--desktop-heading-06--mobile-heading-06Heading 06
Body (Desktop)Body (Mobile)Role
--desktop-body-xl--mobile-body-xlBody large
--desktop-body--mobile-bodyBody copy
--desktop-body-sm--mobile-body-smBody small
Utility (Desktop)Utility (Mobile)Role
--desktop-caption--mobile-captionCaption
--desktop-helper-text--mobile-helper-textHelper text
--desktop-code--mobile-codeCode

Note: To set line height, simply add the prefix --lh to the font size variables. For instance, --desktop-body-xl becomes --lh-desktop-body-xl.


Utility Classes

Margin & Padding

Pattern: nu-u-{property}-{size}

PropertyDescription
mmargin
mtmargin-top
mbmargin-bottom
msmargin-left
memargin-right
mxmargin-inline
mymargin-block
ppadding
ptpadding-top
pbpadding-bottom
pspadding-left
pepadding-right
pxpadding-inline
pypadding-block

Sizes: zero, xs, s, m, l, xl, xxl, xxxl

<div class="nu-u-p-l">Padding large (16px)</div>
<div class="nu-u-mt-xl nu-u-mb-m">Margin top XL, bottom M</div>
<div class="nu-u-mx-auto">Centered horizontally</div>

Spacer Components

<div class="nu-c-spacer-xl"></div> <!-- 24px vertical space -->

Typography Classes

<h1 class="nu-c-h1">Heading 1</h1>
<h2 class="nu-c-h2">Heading 2</h2>
<p class="nu-c-fs-lead">Lead paragraph</p>
<p class="nu-c-fs-normal">Normal body text</p>
<p class="nu-c-fs-small">Small text</p>
<span class="nu-c-caption">CAPTION TEXT</span>
<span class="nu-c-helper-text">Helper text</span>
<code class="nu-c-code">Code text</code>

Font weights: nu-u-fw-bold, nu-u-fw-semi-bold, nu-u-fw-normal

Text transform: nu-u-text--uppercase, nu-u-text--lowercase, nu-u-text--capitalize

Text align: nu-u-text--left, nu-u-text--right, nu-u-text--center, nu-u-text--justify

Font families: nu-u-serif, nu-u-sans-serif, nu-u-code

Background Classes

<div class="nu-u-bg">Default background</div>
<div class="nu-u-bg-secondary">Secondary background</div>
<div class="nu-u-bg-selected">Selected state</div>
<div class="nu-u-bg-black">Black background</div>
<div class="nu-u-bg-white">White background</div>

Text Color Classes

<p class="nu-u-text--primary">Primary text</p>
<p class="nu-u-text--secondary">Secondary text</p>
<p class="nu-u-text--error">Error message</p>
<p class="nu-u-text--success">Success message</p>
<a class="nu-u-link">Link text</a>

Border Classes

<div class="nu-u-b">Default border color</div>
<div class="nu-u-b--muted">Muted border</div>
<div class="nu-u-b--strong">Strong border</div>
<div class="nu-u-b--focus">Focus border</div>

Shadow Classes

<div class="sh-dialog--strong">Modal shadow</div>
<div class="sh-dialog">Dropdown/tooltip shadow</div>
<div class="sh-content">Card/button shadow</div>
<div class="sh-canvas">Background shadow</div>
<div class="sh-default">Default focus ring</div>
<div class="sh-accent">Accent focus ring</div>
<div class="sh-inverse">Inverse focus ring</div>

Usage Examples

Themed Card Component

<html data-new-ui-theme="light">
<body class="nu-u-bg">
  <article class="nu-u-p-xl nu-u-bg-secondary sh-content" 
           style="border-radius: var(--radius-lg);">
    <h2 class="nu-c-h3 nu-u-text--primary nu-u-mb-m">Card Title</h2>
    <p class="nu-c-fs-normal nu-u-text--secondary">
      Card description using semantic color tokens.
    </p>
    <div class="nu-c-spacer-l"></div>
    <button style="background: var(--button); color: var(--content-on-color); 
                   padding: var(--spacing-s) var(--spacing-l); 
                   border-radius: var(--radius-md);">
      Action
    </button>
  </article>
</body>
</html>

Dark Theme Toggle

function toggleTheme() {
  const html = document.documentElement;
  const current = html.dataset.newUiTheme;
  html.dataset.newUiTheme = current === 'light' ? 'dark' : 'light';
}

Best Practices

Using New UI Tokens

  1. Use semantic tokens — Prefer --content-primary over --grey10 for automatic theme support.
  2. Leverage utility classes — Use nu-u-* classes for consistent spacing and typography.
  3. Set themes at root — Apply data-new-ui-theme on <html> for full page theming.
  4. Responsive typography — Heading and body classes automatically scale for mobile.
  5. Accessible colors — OKLCH color system ensures perceptual consistency across themes.

Focus States

  • Interactive elements need visible focus: use --focus-default, --focus-accent, or --border-focus
  • Apply focus with box-shadow: var(--focus-default) or the .sh-default utility class
  • Never use outline: none without providing a focus replacement
  • Use :focus-visible over :focus (avoids focus ring on click)
  • Group focus with :focus-within for compound controls

Forms

  • Inputs need autocomplete and meaningful name attributes
  • Use correct type (email, tel, url, number) and inputmode
  • Labels must be clickable (for attribute or wrapping control)
  • Errors displayed inline next to fields; focus first error on submit
  • Placeholders should show example patterns and end with

Animation

  • Honor prefers-reduced-motion (provide reduced variant or disable)
  • Animate transform and opacity only (compositor-friendly)
  • Never use transition: all—list properties explicitly
  • Use --default-transition-duration and --default-transition-timing-function

Typography

  • Use not ... (ellipsis character)
  • Use curly quotes " " not straight "
  • Non-breaking spaces for units: 10 MB, ⌘ K
  • Loading states end with : "Loading…", "Saving…"
  • Use font-variant-numeric: tabular-nums for number columns
  • Use text-wrap: balance on headings (prevents widows)

Images

  • Always provide explicit width and height (prevents CLS)
  • Below-fold images: loading="lazy"
  • Above-fold critical images: fetchpriority="high"

Dark Mode & Theming

  • Set theme using data-new-ui-theme attribute on <html>
  • Use color-scheme: dark on <html> for dark themes (fixes native scrollbar, inputs)
  • <meta name="theme-color"> should match --background token
  • Native <select>: use --background and --content-primary for consistent theming
  • Always use semantic tokens (--content-primary, --background) for automatic theme adaptation

Content Handling

  • Text containers must handle long content: truncate, line-clamp, or overflow-wrap: break-word
  • Flex children need min-width: 0 to allow text truncation
  • Always handle empty states—don't render broken UI

Accessibility

  • Form inputs must have associated labels
  • Icon buttons need aria-label
  • Never disable zoom: avoid user-scalable=no or maximum-scale=1
  • Use semantic HTML elements (<button>, <a>, <nav>, <main>, <article>)

Anti-Patterns to Avoid

  • outline: none without focus-visible replacement
  • transition: all (list properties explicitly)
  • <div> or <span> with click handlers (use <button>)
  • Images without dimensions
  • Form inputs without labels
  • Icon buttons without aria-label
  • Hardcoded date/number formats (use Intl.*)
  • Inline onClick navigation without <a> or <Link>

Learn More

Source Transparency

This detail page is rendered from real SKILL.md content. Trust labels are metadata-based hints, not a safety guarantee.

Related Skills

Related by shared tags or category signals.

General

Find Skills for ClawHub

Search for and discover OpenClaw skills from ClawHub (the official skill registry). Activate when user asks about finding skills, installing skills, or wants...

Registry SourceRecently Updated
1270
Profile unavailable
General

Skill Listing Polisher

Improve a skill's public listing before publish. Use when tightening title, description, tags, changelog, and scan-friendly packaging so the listing looks cl...

Registry SourceRecently Updated
0109
Profile unavailable
General

Skill Priority Setup

Scans installed skills, suggests L0-L3 priority tiers, and auto-configures skill injection policy. Use when: setting up skill priorities, optimizing token bu...

Registry SourceRecently Updated
0246
Profile unavailable