npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

suitcss-components-grid

v4.0.0

Published

SUIT CSS component for grid layouts

Downloads

2,561

Readme

SUIT CSS components-grid

Build Status

A CSS grid component. The grid makes use of flexbox and box-sizing to provide features that float-based layouts cannot.

N.B. This component relies on particular dimensions being applied to cells in the grid via other classes. For example, suitcss-utils-size.

Read more about SUIT CSS.

Installation

  • npm: npm install suitcss-components-grid
  • Download: zip

Features

  • Fluid layout.
  • Intelligent cell wrapping.
  • Evenly fill cell spacing
  • Equal height columns
  • Horizontal centering of cells.
  • Custom vertical alignment of cells (top, bottom, or middle).
  • Cell width is controlled independently of grid gutter.
  • Infinite nesting.

Available classes

  • Grid: core component
  • Grid--alignCenter: center-align all child cells
  • Grid--alignRight: right-align all child cells
  • Grid--alignMiddle: middle-align all child cells
  • Grid--alignBottom: bottom-align all child cells
  • Grid--fill: evenly distribute space amongst all child cells
  • Grid--fit: fit cells to their content
  • Grid--equalHeight: all child cells match height of the tallest
  • Grid--withGutter: adds a gutter between cells

Configurable variables

  • --Grid-gutter-size: the width of the gutter applied by the Grid--withGutter modifier class.

Use

A simple grid is easy to create. A grid container can have any number of child cells. When used with Grid--fill space is evenly distributed without need for sizing utilities.

Note Elements that are direct descendants of Grid will be flex items. It's recommended to use an element that can easily have classes attached later if needed, such as u-sizeFill or u-flexJustifyCenter

<div class="Grid Grid--fill Grid--withGutter">
  <div><!-- cell content --></div>
  <div><!-- cell content --></div>
  <div><!-- cell content --></div>
  <div><!-- cell content --></div>
</div>

For more granular control over layout make use of modifiers and sizing utilities.

<div class="Grid [Grid--alignCenter|Grid--alignRight|Grid--alignMiddle|Grid--alignBottom|Grid--fill|Grid--fit|Grid--equalHeight]">
  <div class="u-size1of2 u-lg-size6of12"></div>
  <div class="u-size1of2 u-lg-size4of12"></div>
  <div class="u-size1of3 u-lg-size2of12"></div>
  <div class="u-size1of3"></div>
</div>

Fit cells to their content and allow others to fill the remaining space.

<div class="Grid">
  <div class="u-sizeFit">Fit to content</div>
  <div class="u-sizeFill">Take up remaining space</div>
</div>

Widths and offsets

Cell widths and offsets can be controlled using the responsive sizing utilities and responsive offset utilities, respectively.

One limitation of creating grid gutters in the manner shown above is that it prevents any offset utilities applied directly to the Grid component from functioning as expected.

GOOD:

<div class="Grid Grid--withGutter">
  <div class="u-size1of2 u-before1of4 u-after1of4">
    {{>partial}}
  </div>
</div>

BAD:

<div class="Grid Grid--withGutter u-before1of4 u-after1of4">
  <div>
    {{>partial}}
  </div>
</div>

You can nest grids in any context, including one that uses dimension or offset utilities, but keep in mind that the dimensions will be relative to the grid's width, and not the width of the whole application.

<div class="u-before1of4 u-after1of4">
  <div class="Grid Grid--withGutter">
    <div class="u-size1of2"> <!-- 50% of the width of the Grid -->
      {{>partial}}
    </div>
  </div>
</div>

Testing

Install Node (comes with npm).

npm install

To generate a build:

npm run build

To lint code with postcss-bem-linter and stylelint

npm run lint

To generate the testing build:

npm run build-test

To watch the files for making changes to test:

npm run watch

Basic visual tests are in test/index.html.

Browser support

  • Google Chrome (latest)
  • Opera (latest)
  • Firefox (latest)
  • Safari 6.2+
  • Internet Explorer 10+
  • iOS 7+
  • Android 4.4+
  • Windows Phone 8.1+

Refer to the caniuse page for flexbox