supple-css

Supple CSS | objects.mesh

Mesh makes use of grid & Custom Properties to provide for a flexible, fluid & extensible grid system. In a declaritive way you can create a variety of different grid systems for every need.

If you want to arrange items over 1 dimension (horizontal) I recommend using objects.layout.

Read more about Supple CSS.

Table of contents

Features

Use

A simple mesh is easy to create. A mesh container can have any number of child cells.

<div class="o-mesh  o-mesh--gap-base">
  <div><!-- content --></div>
  <div><!-- content --></div>
  <div><!-- content --></div>
  <div><!-- content --></div>
</div>

For more granular control over mesh make use of modifiers, custom properties or sizing utilities.

Modifiers on o-mesh

<div class="o-mesh  [o-mesh--flow  |  o-mesh--dense  |  o-mesh--gap-base]">
  <div></div>
  <div></div>
  <div></div>
  <div></div>
</div>

Works with u-columns-X on o-mesh

<div class="o-mesh  u-columns-10">
  <div class="u-colspan-5">Spans 5 of 10 columns</div>
</div>

Elements

<div class="o-mesh">
  <div class="o-mesh__row">Spans a full row</div>
</div>

Works with u-colspan-X & u-colstart-X on grid item

<div class="o-mesh">
  <div class="u-colspan-5  u-colstart-2">
    Spans 5 of 12 columns and starts at column 2
  </div>
</div>

Custom properties

<div class="o-mesh" style="--columns: 10; --gap: 3rem;">
  <div style="--colspan: 4;">Spans 4 of 10 columns</div>

  <div style="--colspan: 1; --colstart: 5;">
    Spans 1 of 10 columns starts at column 5
  </div>

  <div style="--colspan: 3;">Spans 3 of 10 columns</div>

  <div style="--colspan: 2;">Spans 2 of 10 columns</div>
</div>

Note Of course this specific use of custom properties(through inline styles) is pure for example purposes. It is advised to overwrite the custom properties in your own components instead of inline styles.

Nesting

You can nest mesh in any context. Keep in mind that the dimensions will be relative to the width of o-mesh, and not the width of the whole application.

<div class="o-mesh">
  <div class="[ o-mesh ]  [ u-colspan-X ]">
    <div class="u-colspan-X"></div>
  </div>
</div>

responsive modifiers

When you set breakpoints in $row-in-query you can use it like this:

<div class="o-mesh">
  <div class="o-mesh__row@lap">
    spans 1 column and from lap breakpoint it will span 12 columns (full row).
  </div>
</div>

Available classes

On the .o-mesh block

On the grid item element

Configurable variables

There are multiple ways to configure the mesh object. The Custom properties are calculated at run-time, the SCSS variables will allow you to change things at build-time.

Custom properties

On the .o-mesh block

On the .o-mesh--flow modifier

On the grid item element

SCSS variables

You can overwrite the SCSS variables the following ways:

// in your manifest file, eg. `styles.scss`
@use 'node_modules/@supple-kit/supple-css/objects/mesh' with (
  $row-in-query: (
    lap,
    desk,
  ),
  $gaps: (
    'base',
    'tiny',
  )
);

or

// in your own variable file, eg. `_vars.scss`
@use 'node_modules/@supple-kit/supple-css/objects/mesh/variables' with (
  $row-in-query: (
    lap,
    desk,
  ),
  $gaps: (
    'tiny',
    'huge',
  )
);

// in your manifest file, eg. `styles.scss`
@use 'node_modules/@supple-kit/supple-css/objects/mesh';

Installation

Make sure you’ve installed/downloaded the Supple CSS library: Supple CSS installation

Testing

Basic visual tests are in test.html.

Browser support