Classless CSS Framework with UI Components – Sumi.css

Category: CSS & CSS3 , Frameworks , Recommended | October 22, 2026
Authorvladocar
Last UpdateOctober 22, 2026
LicenseMIT
Views0 views
Classless CSS Framework with UI Components – Sumi.css

Sumi.css is a classless-first CSS framework that styles semantic HTML with a single stylesheet. It styles native content and controls by default, and optional classes handle responsive layouts and component variations.

The framework follows system light and dark themes, and CSS custom properties control the page’s colors, typography, and spacing. No JavaScript or build step is required.

Features

  • Responsive grids with auto-fitting columns and fixed-column layouts.
  • Primary, secondary, contrast, and outlined buttons.
  • Form controls with validation colors and visible focus indicators.
  • Styled native dialogs, accordions, and dropdown menus.
  • CSS tooltips, callouts, and loading indicators.
  • Fluid heading sizes and optional serif typography.
  • Reduced-motion preferences and print styles.
  • Custom colors, typography, spacing, and component dimensions through CSS variables.

How To Use It

Installation

Download sumi.min.css or link the stylesheet from a CDN. Place it in the document’s <head> section.

<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/vladocar/Sumi.css/sumi.min.css">

Basic Usage

Sumi.css applies its default styles to semantic HTML. Place <header>, <main>, and <footer> directly inside <body> to receive centered page widths automatically.

<body>
  <header>
    <nav>
      <ul><li><strong>Studio Notes</strong></li></ul>
      <ul>
        <li><a href="#home" aria-current="page">Home</a></li>
        <li><a href="#contact">Contact</a></li>
      </ul>
    </nav>
  </header>
  <main id="home">
    <h1>A Simple Project Page</h1>
    <p class="lead">Updates and resources from our design studio.</p>
    <article>
      <h2>Latest Update</h2>
      <p>Our autumn workshop schedule is now available.</p>
      <a href="#contact" role="button">Get in touch</a>
    </article>
  </main>
  <footer id="contact"><p>Contact: [email protected]</p>    </footer>
</body>

Native HTML Elements

Sumi.css styles these HTML elements directly. A class is only needed for a specific variant or layout.

ElementDefault styling
h1 to h6, p, ul, ol, blockquoteResponsive typography and spacing.
nav with ul groupsHorizontal navigation, or vertical navigation inside aside.
button, a[role="button"]Primary buttons with hover and focus states.
input, select, textarea, fieldset, labelForm fields, labels, and focus styles.
Checkbox, radio, range, file, and color inputsTheme-colored native form controls.
tableFull-width table with row dividers.
articleCard with styled direct header and footer elements.
details and summaryExpandable disclosure panel.
dialogStyled native modal and backdrop.
progress and meterStyled progress and measurement bars.

UI Components

A grid can hold cards with native disclosure panels and CSS dropdowns. A dropdown uses <details class="dropdown">, and .right can align its menu to the right.

<div class="grid">
  <article id="workshop">
    <header><strong>Workshop Details</strong></header>
    <p>Saturday, 10 AM. All materials are included.</p>
    <label for="attendee">Your name</label>
    <input id="attendee" name="attendee" autocomplete="name">
  </article>
  <article id="resources">
    <header><strong>Common Questions</strong></header>
    <details>
      <summary>Can I change my booking?</summary>
      <p>Contact the studio before the session.</p>
    </details>
    <details class="dropdown">
      <summary>Jump to a section</summary>
      <ul>
        <li><a href="#workshop">Workshop details</a></li>
        <li><a href="#resources">Questions</a></li>
      </ul>
    </details>
  </article>
</div>

For a modal, Sumi.css styles the native <dialog> element and its backdrop. Your application must open the dialog with browser JavaScript. A form with method="dialog" closes it using the native dialog behavior.

<button type="button" id="open-confirmation">Open confirmation</button>
<dialog id="confirmation">
  <article>
    <header><h3>Submit your request?</h3></header>
    <p>Review the information before continuing.</p>
    <footer>
      <form method="dialog" class="row">
        <button value="cancel" class="secondary outline">Cancel</button>
        <button value="confirm">Confirm</button>
      </form>
    </footer>
  </article>
</dialog>
<script>
  const confirmation = document.querySelector('#confirmation');
  document.querySelector('#open-confirmation').addEventListener('click', () => {
    confirmation.showModal();
  });
</script>

Responsive Layouts

.grid creates auto-fitting columns with a default minimum width of 14rem. Fixed layouts use .cols-2, .cols-3, .cols-4, .cols-6, or .cols-12 from a viewport width of 48rem. These fixed layouts switch to one column below that breakpoint.

Available span modifiers: .span-2, .span-3, .span-4, .span-6, .span-8, .span-9, and .span-full.

<div class="grid" style="--s-grid-min: 12rem">
  <article>First card</article>
  <article>Second card</article>
  <article>Third card</article>
</div>
<div class="grid cols-12">
  <section class="span-8">Main content</section>
  <aside class="span-4">Sidebar content</aside>
</div>

Light And Dark Themes

Sumi.css selects its palette through prefers-color-scheme. Set data-theme="light" or data-theme="dark" on <html> to choose a fixed theme. The attribute also works on an individual element.

<html lang="en" data-theme="dark">

A theme toggle needs a small JavaScript handler. This example stores the visitor’s choice in local storage. It expects the button after the HTML content has loaded.

If you need the saved theme applied before the first paint, read local storage and set data-theme in the document’s <head> before loading the stylesheet.

<button type="button" id="theme-toggle">Switch theme</button>
<script>
  const root = document.documentElement;
  const savedTheme = localStorage.getItem('theme');
  if (savedTheme === 'light' || savedTheme === 'dark') {
    root.dataset.theme = savedTheme;
  }
  document.querySelector('#theme-toggle').addEventListener('click', () => {
    const systemDark = matchMedia('(prefers-color-scheme: dark)').matches;
    const current = root.dataset.theme || (systemDark ? 'dark' : 'light');
    const next = current === 'dark' ? 'light' : 'dark';
    root.dataset.theme = next;
    localStorage.setItem('theme', next);
  });
</script>

Styling And Customization

Load your own stylesheet after Sumi.css to override the default tokens. Color overrides intended for both themes need equivalent light and dark definitions, since Sumi.css assigns its dark colors through separate selectors and a system-preference media query.

-root,
[data-theme="light"] {
  --s-primary: #0f766e;
  --s-radius: .25rem;
  --s-font-heading: Georgia, serif;
  --s-container: 64rem;
}
-root[data-theme="dark"],
[data-theme="dark"] {
  --s-primary: #5eead4;
}
@media (prefers-color-scheme: dark) {
-root:not([data-theme="light"]) {
    --s-primary: #5eead4;
  }
}

CSS Classes And Modifiers

These classes control layout, typography, components, and small utility behaviors. Grid spans apply at the 48rem breakpoint for the fixed-column layouts.

Layout Classes

ClassDescription
.containerCenters a block within the --s-container width.
.container-fluidUses an uncapped width and horizontal gutters.
.narrowRestricts content to --s-narrow.
.gridCreates auto-fitting CSS Grid columns.
.cols-2, .cols-3, .cols-4, .cols-6, .cols-12Set fixed column counts at 48rem and above when used with .grid.
.span-2, .span-3, .span-4Occupy two, three, or four grid tracks at 48rem and above.
.span-6, .span-8, .span-9Occupy six, eight, or nine grid tracks at 48rem and above.
.span-fullOccupies all tracks in a grid row.
.rowFlexible row with wrapping and alignment.
.spreadDistributes space between items when used with .row.
.stackVertical flex layout.

Typography Classes

ClassDescription
.displayLarge display-sized heading.
.leadLarger introductory text.
.proseReading width and long-form typography. Removes the card appearance from <article>.
.serifApplies the configured serif typeface.

Component Classes

ClassDescription
.secondarySecondary button colors.
.contrastHigh-contrast button colors.
.outlineOutlined button variant.
.small, .largeCompact or large button sizes.
.fullFull-width button or element.
.dropdownDropdown styling for <details>.
.rightRight-aligns a .dropdown panel.
.calloutStyled status or information block.
.success, .warning, .dangerCallout color variants when paired with .callout.
.stripedAlternating rows on <table>.

Utility Classes

ClassDescription
.mutedSecondary text color.
.smallReduced font size.
.centerCentered text.
.fullFull element width.
.overflow-autoAutomatic overflow scrolling.
.sr-onlyHides content visually while retaining it for assistive technologies.

HTML Attributes And States

AttributeDescription
role="button"Styles a link as a button.
role="group"Connects adjacent buttons or form fields into a joined group.
role="switch"Styles a checkbox as a switch.
aria-invalid="true"Displays an invalid-field state.
aria-invalid="false"Displays a valid-field state.
aria-busy="true"Shows a CSS loading spinner on eligible elements.
aria-current="page"Highlights the active navigation link.
aria-disabled="true"Styles button-like elements as disabled. Application code must prevent disabled link activation.
data-tooltip="..."Displays text in a CSS tooltip on hover or focus.
data-placement="bottom"Moves the tooltip below the element.
data-theme="light", data-theme="dark"Selects a fixed color theme on a root or section.
aria-label="breadcrumb" on <nav>Applies breadcrumb separators to list items.
open on <details> or <dialog>Uses the element’s native open state for the appropriate component styling.

CSS Custom Properties

Typography And Text Tokens

CSS variableDescription
--s-font-sansSans-serif font stack.
--s-font-monoMonospace font stack.
--s-font-serifSerif font stack.
--s-font-bodyBody font family, initially the sans-serif stack.
--s-font-headingHeading font family.
--s-font-sizeBase font size before fluid scaling, default 100%.
--s-line-heightBase line height, default 1.6.
--s-heading-weightHeading weight, default 700.
--s-measureReading measure for .prose, default 68ch.
--s-flowSpacing after text blocks, default 1.25rem.
--s-text-displayFluid display headline size.
--s-text-h1Fluid first-level heading size.
--s-text-h2Fluid second-level heading size.
--s-text-h3Fluid third-level heading size.
--s-text-h4Fluid fourth-level heading size.
--s-text-leadFluid .lead text size.

Layout, Spacing, And Effects Tokens

CSS variableDescription
--s-spaceSpacing after forms and components, default 1rem.
--s-gutterResponsive horizontal page gutter.
--s-containerMain container width, default 72rem.
--s-narrowNarrow content width, default 44rem.
--s-radiusCommon corner radius, default .5rem.
--s-transitionComponent transition timing, default .15s ease.
--s-shadowStandard component shadow.
--s-shadow-lgLarger modal shadow.
--s-grid-minMinimum auto-fit column width, default 14rem.
--s-grid-gapGrid spacing, defaulting to --s-space.
--s-row-gapGap between .row items, default .75rem.
--s-stack-gapGap between .stack items, defaulting to --s-space.

Color Tokens

CSS variableDescription
--s-bgPage and surface background.
--s-surfaceMuted surface color for controls and striped rows.
--s-cardCard background.
--s-card-sectionCard header and footer background.
--s-textPrimary text color.
--s-mutedSecondary text color.
--s-borderStandard borders and rules.
--s-border-strongEmphasized borders.
--s-primaryPrimary links, actions, and selected controls.
--s-on-primaryText on the primary button color.
--s-secondarySecondary button color.
--s-on-secondaryText on secondary buttons.
--s-contrastContrast button and tooltip background.
--s-on-contrastText on contrast buttons and tooltips.
--s-successSuccess and valid state color.
--s-warningWarning state color.
--s-dangerDanger and invalid state color.
--s-code-bgInline code background.
--s-mark-bgHighlighted text background.
--s-mark-textHighlighted text foreground.
--s-mixColor mixed into component hover states.
--s-focusFocus ring tint.

Alternatives And Related Resources

You Might Be Interested In:


Leave a Reply