Package detail

suitcss-components-arrange

suitcss1.6k1.1.1

SUIT CSS component for horizontal arrangement

browser, css-components, arrange, suitcss

readme

SUIT CSS components-arrange

Build Status

A SUIT CSS component for horizontally and vertically arranging a single row of cells. Includes modifier classes for equal-width cells and gutter-separated cells. Makes use of CSS table layout.

Note: This component has been superseded by flexbox and you may instead find more use from utils-flex.

Read more about SUIT CSS's design principles.

Installation

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

Available classes

  • Arrange - The core component class
  • Arrange--middle - The modifier class for middle-aligned cells
  • Arrange--bottom - The modifier class for bottom-aligned cells
  • Arrange--equal - The modifier class for equal-width cells
  • Arrange--withGutter - The modifier class for adding a gutter between cells.
  • Arrange-sizeFit - The child class for cells to snap to fit their content
  • Arrange-sizeFill - The child class for cells to expand to fill the remaining space
  • Arrange-row - The child class for a new row of cells (Arrange-sizeFit or Arrange-sizeFill)

Configurable variables

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

Usage

N.B. This component affects the width of images in cells.

Arrange must only contain Arrange-sizeFit, Arrange-sizeFill, and Arrange-row child nodes.

It's recommended that you only use one Arrange-sizeFill per component instance (unless using the Arrange--equal modifier; see below). The first Arrange-sizeFill in the component's source order will not share the extra space with any subsequent nodes of that class.

Arrange relies on a core component class that is extended by additional modifier classes. This component works best for small-scale UI layout, for example, image-content pairs:

<div class="Arrange Arrange--middle Arrange--withGutter">
  <div class="Arrange-sizeFit">
    <img src="img.png" alt="">
  </div>
  <div class="Arrange-sizeFill">
    Nicolas Gallagher @necolas
    …
  </div>
</div>

Or for an equally spaced row of buttons or icons, etc.

<ul class="Arrange Arrange--equal">
  <li class="Arrange-sizeFill">
    <button class="Button u-sizeFull">Reply</button>
  </li>
  <li class="Arrange-sizeFill">
    <button class="Button u-sizeFull">Like</button>
  </li>
  <li class="Arrange-sizeFill">
    <button class="Button u-sizeFull">Save</button>
  </li>
  <li class="Arrange-sizeFill">
    <button class="Button u-sizeFull">Remove</button>
  </li>
</ul>

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 4+
  • Safari 5+
  • Internet Explorer 8+

changelog

HEAD

1.1.1 (February 28, 2016)

  • Update preprocessor to ^1.0.1
  • Upgrade stylelint-config-suitcss to ^4.0.0
  • Use weak mode for BEM linting

1.1.0 (December 2, 2015)

  • Added ability to create new rows within the same component (Arrange-row).

1.0.0 (October 18, 2015)

  • Fix Vertical alignment modifiers to support nesting.
  • Drop bower.json and component.json support

0.6.2 (November 18, 2014)

  • Fix equal-width modifier layout calculation.

0.6.1 (October 28, 2014)

  • Add support for JS bundling.

0.6.0 (June 26 2014)

  • Change variable names.

0.5.2 (June 24, 2014)

Add .css extension to imports for interoperability.

0.5.1 (June 21, 2014)

0.5.0 (June 21, 2014)

  • npm-based workflow.
  • Add preprocessor build tools.

0.4.0 (May 14, 2014)

  • Update variables syntax.

0.3.0 (March 31, 2014)

  • Add npm support.
  • Re-introduce the gutter modifier, relying on a variable for configuration.
  • Stop using CSSLint.

0.2.0 (November 13, 2013)

  • Remove gutter modifier; add instructions for it to README.
  • Fix a spacing bug when gutters-between-cells and equal-width-cells were combined.
  • Use suit-test for the test file.
  • Use Component(1) for development.

0.1.1 (September 2, 2013)

  • Fix Bower ignores.
  • Add CSS linting and configuration.
  • Add Component(1) support.

0.1.0 (May 26, 2013)

  • Public release.