Utilities

Spruce CSS is not a utility-first framework, but some helpers are useful everywhere. The new groups are opt-in, so they never add CSS you don't use.

@use 'sprucecss/scss/spruce' with (
  $settings: (
    'utilities': (
      'display': true,     // default
      'typography': true,  // default
      'text': false,       // opt-in
      'layout': false,     // opt-in, see the Layout page
    ),
  ),
);

Accessibility (Always On)

ClassDescription
.sr-onlyHides the element visually but keeps it for screen readers.
.sr-only-focusableHidden until it (or an element inside it) gets the focus, like a skip link.
<a class="sr-only-focusable" href="#content">Skip to content</a>

The same helpers are available as mixins: visually-hidden and visually-hidden-focusable.

Display

ClassDescription
.hidden, [hidden]display: none !important;

Typography

.h1 – .h6 apply the heading font sizes to any element, so you can keep the right heading level with a different look.

<h2 class="h4">A second-level heading with a smaller size</h2>

Text (Opt-In)

.text-center

.text-muted — a secondary text.

.text-mono — monospace text.

.text-truncate — Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus vel tortor mi, vivamus bibendum erat lacus, quis tincidunt urna dictum non.

ClassDeclaration
.text-start, .text-center, .text-endtext-align (logical values)
.text-sm, .text-lgfont-size from font-size-sm / font-size-lg
.text-mutedcolor: color('muted')
.text-monofont-family from font-family-mono
.text-uppercasetext-transform: uppercase
.text-balance, .text-prettytext-wrap: balance / pretty
.text-nowrapwhite-space: nowrap
.text-truncateOne-line ellipsis (the text-ellipsis mixin)

Layout (Opt-In)

See the Layout page for .l-stack, .l-cluster, .l-grid, .l-sidebar, .l-switcher, .l-reel and .l-center.

Documentation

Learn about Spruce CSS through our extensive documentation.

Components

Explore our UI library of accessible components built with Spruce CSS.

Blocks and Pages

Full-width page blocks and complete page templates, ready to copy.

Find us on GitHub

Did you find a bug? Have an idea or a question? Please open an issue to help us develop the project.