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

inuit-flexgrid

v0.4.0

Published

Flexbox grid for inuitcss.

Downloads

1,994

Readme

inuit-flexgrid

Flexbox grid for inuitcss.

Support for IE9 currently prevents inuitcss from using the flexbox layout mode. This plugin serves as an alternative to the core layout system.

Installation

npm:

npm install inuit-flexgrid --save

Yarn:

yarn add inuit-flexgrid

Import the plugin in the objects section of main.scss:

@import "node_modules/inuit-flexgrid/objects/objects.grid";

Quick start

Cells are full-width and will stack on top of each other by default:

<div class="o-grid">
  <div class="o-grid__cell">
  </div>
  <div class="o-grid__cell">
  </div>
</div>

Cells will in most cases be accompanied by utility classes that divide the grid into fractions. These are provided by inuitcss:

<div class="o-grid">
  <div class="o-grid__cell u-1/2">
  </div>
  <div class="o-grid__cell u-1/2">
  </div>
</div>

Usage and configuration

Distribute cells equally

o-grid--auto will divide the space equally between all containing cells without the need for width utility classes. Sets flex: 1 0 0 on cell elements (.o-grid > .o-grid__cell).

<div class="o-grid o-grid--auto">
  <div class="o-grid__cell">
    50%
  </div>
  <div class="o-grid__cell">
    50%
  </div>
</div>

Horizontal alignment

o-grid can be used with the following modifiers for horizontal alignment:

  • o-grid--left: Align cells left. Uses justify-content: flex-start (default).
  • o-grid--center: Horizontally center cells. Uses justify-content: center.
  • o-grid--right: Align cells right. Uses justify-content: flex-end.
  • o-grid--between: Distribute free space between the cells. Uses justify-content: space-between.
  • o-grid--around: Distribute free space around the cells. Uses justify-content: space-around.

If you want to omit some of the modifiers, or change their suffixes (--left, --center etc.), simply set the $inuit-flexgrid-alignment-values before importing objects.grid.

$inuit-flexgrid-alignment-values: (
    '--top': 'flex-start',
    '--middle': 'center',
    '--bottom': 'flex-end',
    '--baseline': 'baseline',
    '--stretch': 'stretch',
);

@import "node_modules/inuit-flexgrid/objects/objects.grid";

Vertical alignment

o-grid can be used with the following modifiers for vertical alignment.

  • o-grid--stretch: Stretch cells to fit the container. Uses align-items: stretch (default).
  • o-grid--middle: Vertically center cells. Uses align-items: center.
  • o-grid--bottom: Align cells to the bottom. Uses align-items: flex-end.
  • o-grid--top: Align cells to the top. Uses align-items: flex-start.
  • o-grid--baseline: Position cells at the baseline of the container. Uses align-items: baseline.

While the above modifier classes will affect every cell in the grid, you can also align specific cells by using the following modifier classes with o-grid__cell:

  • o-grid__cell--stretch: Stretch cell to fit the container.
  • o-grid__cell--middle: Vertically align cell.
  • o-grid__cell--bottom: Align cell to the bottom.
  • o-grid__cell--top: Align cell to the top.
  • o-grid__cell--baseline: Position cell at the baseline of the container.

If you want to omit some of the modifiers, or change their suffixes (--middle, --bottom etc.), simply set the $inuit-flexgrid-justify-values before importing objects.grid.

$inuit-flexgrid-justify-values: (
    '--left': 'flex-start',
    '--center': 'center',
    '--right': 'flex-end',
    '--between': 'space-between',
    '--around': 'space-around',
);

@import "node_modules/inuit-flexgrid/objects/objects.grid";

Content distribution

You can change the direction cells are placed in the grid with the following classes:

  • o-grid--column: Sets flex-direction: column. Cells will be layed out from top to bottom instead of from left to right.
  • o-grid--column-reverse: Sets flex-direction: column-reverse. Cells will be layoued out from bottom to top.

Reverse the order of cells

  • o-grid--reverse: Place cells from right to left. Uses flex-direction: row-reverse.

Pulling

You can pull cells to the left or to the right with the following modifier classes:

  • o-grid__cell--pull-left: Sets margin-right: auto.
  • o-grid__cell--pull-right: Sets margin-left: auto.

Gutter sizes

A set of gutter widths are provided as modifier classes. For example, the following block will generate a grid with "large" gutters and a grid with no gutters at all:

<div class="o-grid o-grid--large">
    <div class="o-grid__cell">
    </div>
</div>

<div class="o-grid o-grid--flush">
    <div class="o-grid__cell">
    </div>
</div>

Available gutter sizes:

  • o-grid--tiny
  • o-grid--small
  • o-grid--large
  • o-grid--huge
  • o-grid--flush

Without a modifier, the default gutter size is equal to $inuit-global-spacing-unit. You have full control over which modifier classes are generated and how they are suffixed. Simply override the $inuit-flexgrid-spacing-sizes variable before you import the grid object:

$inuit-flexgrid-spacing-sizes: (
    null: $your-spacing-unit
    '--xs': $your-spacing-unit-xs,
    '--sm': $your-spacing-unit-sm,
    '--lg': $your-spacing-unit-lg,
    '--xl': $your-spacing-unit-xl,
    '--none': 0
) !default;

@import "node_modules/inuit-flexgrid/objects/objects.grid";

Remember to include the null key if you want the default o-grid (without modifiers) to have gutters.