Skip to content
/ zss Public

Library - 📐 Sass for design systems

License

Notifications You must be signed in to change notification settings

zicht/zss

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

📐 ZSS – Sass for design systems

ZSS is a Sass framework that helps you build design systems with configurable design scales.



Documentation

This overview provides an in depth view of all of the available properties/classes in ZSS.

Background

What it does

  • Provides a simple base for your typography.
  • Provides abstractions of common UI patterns, so you can focus on the specific design details.
  • Functional CSS: generates immutable, configurable, and responsive utility classes.
  • Provides a flexible and configurable flexbox grid.
  • Provide compile time checking of your configuration for design smells.

What it doesn’t do

  • No pre-defined colors.
  • Unlike Bootstrap, ZSS does not contain pre-made components or JavaScript.

Principles

ZSS is built on a few principles.

  • Composition over repetition
    The class attribute is perfect for composing your design with multiple classes. It leads to better re-usability of your design and smaller CSS stylesheets.
  • Configurable and optional
    In ZSS, generated utility classes have configurable values. Need an extra value, or don’t like the default values? Just override a variable in your project. Don’t need the button abstraction class? Just don’t import it.
  • Responsiveness
    All utility classes have responsive equivalents, so you can use different values on different screens.
  • Design scales
    ZSS uses scales to limit the number of available values for certain properties, like color and margin.

Setup

Install:

npm install zss --save

After that, import the files you need into your Sass stylesheet.

@import "../node_modules/zss/src/utilities/background-color";

ℹ️ Please note that some utility classes make use of the responsive helper mixins. To make sure ZSS compiles correctly import these before you import the utility classes:

@import "../node_modules/zss/src/helpers/responsive";
@import "../node_modules/zss/src/utilities/margin";

ℹ️ You can use the accompanying file zss.scss as a starting point for your project's stylesheet. It imports all files that are available in ZSS.

Structure

Class names

ZSS uses namespaces, similar to the system CSS Wizardry wrote about.

  • o- prefix for abstract objects.
  • u- prefix for utility classes.

Source order

ZSS advocates importing sources files in the way ITCSS prescribes, with an inverted specificity.

  1. Settings and variables
  2. Mixins and other Sass helpers
  3. Generic: common resets
  4. Base: unclassed HTML and page setup
  5. Abstract objects
  6. Components
  7. Scopes
  8. Theming
  9. Visual classes
  10. Utility classes

Responsive

ZSS uses an @breakpoint suffix to indicate if a class only works on a certain breakpoint, e.g. u-black@md.


How to use

Configuration and variables