@sq-ui/sq-grid

1.0.1 • Public • Published

sq-grid

A simple and clean CSS grid which can be configured to use either CSS Grid or Flexbox.

See a combined live preview here

Documentation can be found here

Types of grid implementations

SQ-Grid offers three types of grids:

The grid which the browser should use is determined by @supports queries. In case the browser supports either native CSS grids or flexbox, the UI kit exposes class rules which the developer can use to manipulate the grid according to either grid or flexbox rules. In case the browser doesn't support either of those two features, the UI kit defaults to using floats to establish the grid rules.

Installation

  1. Install the package: npm install @sq-ui/sq-grid
  2. Import whatever you need:
./node_modules/@sq-ui/sq-grid/dist/sq-grid.css
./node_modules/@sq-ui/sq-grid/mixins.scss
./node_modules/@sq-ui/sq-grid/sq-grid.scss

Usage

The grid uses a maximum of 12 columns per row. All the width calculations and corresponding classes are based on the 12-column layout.

The grid consists of the following classes:

  • .sq-grid - The parent which wraps the grid columns. By default, it does not contain any CSS rules.
  • (.sq-grid).css-grid - This is an additional class to .sq-grid which enables the usage of the native CSS grid feature.
  • (.sq-grid).css-flexbox - An additional class to .sq-grid. It enables the flexbox implementation of the grid system.
  • (.sq-grid).auto-col-width - An additional class to .sq-grid. When this class is added, the columns width is calculated automatically (based on 12-column layout).
  • .col - The class for every child of the .sq-grid container. Represents a single column of the grid.
  • (.col).span-{<number>, where <number> can be an integer between 1 and 12} - An additional class to .col. It can be used to manually set the width of box. For example, .col.span-4 would mean that the box would span 4 columns.

Local Development

  1. Clone the repository
  2. Run npm install
  3. After you modify either of the scss files, you would need to run: npm run build:sass

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 1.0.1
    1
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 1.0.1
    1

Package Sidebar

Install

npm i @sq-ui/sq-grid

Weekly Downloads

1

Version

1.0.1

License

MIT

Unpacked Size

9.97 kB

Total Files

5

Last publish

Collaborators

  • ardentia
  • samuil4