Home

Awesome

<p align="center"> <img alt="hedron logo" src="https://raw.githubusercontent.com/garetmckinley/project-assets/master/hedron/hedron-header.svg?sanitize=true" id="dracula-invert"> </p>

Travis npm David All Contributors Spectrum Chat

Quick Jump

Features

Requirements

The follow dependencies must be installed in your project in order for hedron to work.

Installation

Using yarn

yarn add hedron@next

Using npm

npm install hedron@next

Usage

Basic Example

import React from "react";
import ReactDOM from "react-dom";
import Grid from "hedron";

const App = () => (
  <Grid.Bounds direction="vertical">
    <Grid.Box>Header</Grid.Box>
    <Grid.Box>Content</Grid.Box>
    <Grid.Box>Footer</Grid.Box>
  </Grid.Bounds>
);

ReactDOM.render(<App />, document.getElementById("root"));

Responsive Example

To make your layout responsive, use the Grid.Provider to define breakpoints. You can add as many or as few breakpoints as you'd like.

import React from "react";
import ReactDOM from "react-dom";
import Grid from "hedron";

const App = () => (
  <Grid.Provider
    padding="20px"
    breakpoints={{ sm: "-500", md: "501-750", lg: "+750" }}
  >
    <Grid.Bounds direction="vertical">
      <Grid.Box sm={{ hidden: true }}>
        This header hides on small screens
      </Grid.Box>
      <Grid.Box>Content</Grid.Box>
      <Grid.Box lg={{ padding: "50px" }}>
        This footer gains extra padding on large screens
      </Grid.Box>
    </Grid.Bounds>
  </Grid.Provider>
);

ReactDOM.render(<App />, document.getElementById("root"));

If you want to be more verbose with your naming convention, that's perfectly fine too! Go ahead and name your breakpoints whatever feels right

import React from "react";
import ReactDOM from "react-dom";
import Grid from "hedron";

const App = () => (
  <Grid.Provider
    breakpoints={{ mobile: "-500", tablet: "501-750", wide: "+750" }}
  >
    <Grid.Bounds direction="vertical">
      <Grid.Box mobile={{ hidden: true }}>Header</Grid.Box>
      <Grid.Box>Content</Grid.Box>
      <Grid.Bounds direction="vertical" wide={{ direction: "horizontal" }}>
        <Grid.Box>These boxes render side by side on wide screens</Grid.Box>
        <Grid.Box>These boxes render side by side on wide screens</Grid.Box>
      </Grid.Bounds>
    </Grid.Bounds>
  </Grid.Provider>
);

ReactDOM.render(<App />, document.getElementById("root"));

You don't need to fill all screen sizes either, if you only need elements to change on a single resolution, just add a single breakpoint! To learn more about breakpoints, check out the documentation for Grid.Provider.

Upgrading

Unfortunately, there's no simple way to upgrade from the pre 1.0.0 version, but here's a few tips to make your life easier if you decide to upgrade (which we recommend doing!)

Also: There are no longer default breakpoints. You must define breakpoints yourself via Grid.Provider. You can also finally set custom breakpoints, as many as you want!

Documentation

Grid.Provider

Props

<details><summary><strong>Defining Breakpoints</strong></summary><p>

Defining breakpoints gives you strong control over the way your content is rendered at various screen sizes. Any property that can be set on Grid.Box can be set per-breakpoint. Here's a few things to keep in mind when defining breakpoints:

</p></details> <details><summary><strong>Restricted Breakpoint Names</strong></summary><p>

Although you can name breakpoints whatever you want, there are a few names that we do not recommend using because they will conflict with existing property names. Most of these are pretty obvious and would never come up in real usage, but it's worth having a list here just to be sure!

</p></details>

Grid.Bounds

Props

Grid.Bounds also inherits all properties that Stylable has.

Grid.Bounds accepts aliases for the width property.

Available aliases are:

<Grid.Bounds sm={{ width: "half", height: "200px" }}>
  This box gains height on small devices
</Grid.Bounds>

Grid.Box

Props

Grid.Box also inherits all properties that Stylable has.

Grid.Box accepts aliases for the width property.

Available aliases are:

<Grid.Box sm={{ width: "half", height: "200px" }}>
  This box gains height on small devices
</Grid.Box>

Contributors

Thanks goes to these wonderful people (emoji key):

<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section --> <!-- prettier-ignore --> <table><tr><td align="center"><a href="https://garet.io"><img src="https://avatars0.githubusercontent.com/u/1624279?v=4" width="100px;" alt="Garet McKinley"/><br /><sub><b>Garet McKinley</b></sub></a><br /><a href="https://github.com/garetmckinley/hedron/commits?author=garetmckinley" title="Code">💻</a> <a href="https://github.com/garetmckinley/hedron/commits?author=garetmckinley" title="Documentation">📖</a> <a href="#review-garetmckinley" title="Reviewed Pull Requests">👀</a></td><td align="center"><a href="http://internetofmatt.com"><img src="https://avatars3.githubusercontent.com/u/11802078?v=4" width="100px;" alt="Matt Hamil"/><br /><sub><b>Matt Hamil</b></sub></a><br /><a href="#question-matthamil" title="Answering Questions">💬</a></td><td align="center"><a href="https://github.com/mikkom"><img src="https://avatars3.githubusercontent.com/u/77391?v=4" width="100px;" alt="Mikko Matilainen"/><br /><sub><b>Mikko Matilainen</b></sub></a><br /><a href="https://github.com/garetmckinley/hedron/commits?author=mikkom" title="Code">💻</a></td><td align="center"><a href="https://github.com/nathanielpiche"><img src="https://avatars1.githubusercontent.com/u/16616772?v=4" width="100px;" alt="Nathaniel Piché"/><br /><sub><b>Nathaniel Piché</b></sub></a><br /><a href="https://github.com/garetmckinley/hedron/commits?author=nathanielpiche" title="Code">💻</a> <a href="https://github.com/garetmckinley/hedron/commits?author=nathanielpiche" title="Documentation">📖</a></td><td align="center"><a href="https://dealspotr.com/"><img src="https://avatars1.githubusercontent.com/u/233396?v=4" width="100px;" alt="Brian Stanback"/><br /><sub><b>Brian Stanback</b></sub></a><br /><a href="https://github.com/garetmckinley/hedron/commits?author=Stanback" title="Code">💻</a></td><td align="center"><a href="https://github.com/stephenmathieson"><img src="https://avatars0.githubusercontent.com/u/571265?v=4" width="100px;" alt="Stephen Mathieson"/><br /><sub><b>Stephen Mathieson</b></sub></a><br /><a href="https://github.com/garetmckinley/hedron/commits?author=stephenmathieson" title="Code">💻</a></td><td align="center"><a href="http://justjibba.net"><img src="https://avatars1.githubusercontent.com/u/7897877?v=4" width="100px;" alt="James G. Best"/><br /><sub><b>James G. Best</b></sub></a><br /><a href="https://github.com/garetmckinley/hedron/commits?author=jim-at-jibba" title="Code">💻</a></td></tr></table> <!-- ALL-CONTRIBUTORS-LIST:END -->

This project follows the all-contributors specification. Contributions of any kind are welcome!

Want to help? Join our Spectrum.chat community to get started!

Backers

Support us with a monthly donation and help us continue our activities. [Become a backer]

<a href="https://opencollective.com/hedron/backer/0/website" target="_blank"><img src="https://opencollective.com/hedron/backer/0/avatar.svg"></a> <a href="https://opencollective.com/hedron/backer/1/website" target="_blank"><img src="https://opencollective.com/hedron/backer/1/avatar.svg"></a> <a href="https://opencollective.com/hedron/backer/2/website" target="_blank"><img src="https://opencollective.com/hedron/backer/2/avatar.svg"></a> <a href="https://opencollective.com/hedron/backer/3/website" target="_blank"><img src="https://opencollective.com/hedron/backer/3/avatar.svg"></a> <a href="https://opencollective.com/hedron/backer/4/website" target="_blank"><img src="https://opencollective.com/hedron/backer/4/avatar.svg"></a> <a href="https://opencollective.com/hedron/backer/5/website" target="_blank"><img src="https://opencollective.com/hedron/backer/5/avatar.svg"></a> <a href="https://opencollective.com/hedron/backer/6/website" target="_blank"><img src="https://opencollective.com/hedron/backer/6/avatar.svg"></a> <a href="https://opencollective.com/hedron/backer/7/website" target="_blank"><img src="https://opencollective.com/hedron/backer/7/avatar.svg"></a> <a href="https://opencollective.com/hedron/backer/8/website" target="_blank"><img src="https://opencollective.com/hedron/backer/8/avatar.svg"></a> <a href="https://opencollective.com/hedron/backer/9/website" target="_blank"><img src="https://opencollective.com/hedron/backer/9/avatar.svg"></a> <a href="https://opencollective.com/hedron/backer/10/website" target="_blank"><img src="https://opencollective.com/hedron/backer/10/avatar.svg"></a> <a href="https://opencollective.com/hedron/backer/11/website" target="_blank"><img src="https://opencollective.com/hedron/backer/11/avatar.svg"></a> <a href="https://opencollective.com/hedron/backer/12/website" target="_blank"><img src="https://opencollective.com/hedron/backer/12/avatar.svg"></a> <a href="https://opencollective.com/hedron/backer/13/website" target="_blank"><img src="https://opencollective.com/hedron/backer/13/avatar.svg"></a> <a href="https://opencollective.com/hedron/backer/14/website" target="_blank"><img src="https://opencollective.com/hedron/backer/14/avatar.svg"></a> <a href="https://opencollective.com/hedron/backer/15/website" target="_blank"><img src="https://opencollective.com/hedron/backer/15/avatar.svg"></a> <a href="https://opencollective.com/hedron/backer/16/website" target="_blank"><img src="https://opencollective.com/hedron/backer/16/avatar.svg"></a> <a href="https://opencollective.com/hedron/backer/17/website" target="_blank"><img src="https://opencollective.com/hedron/backer/17/avatar.svg"></a> <a href="https://opencollective.com/hedron/backer/18/website" target="_blank"><img src="https://opencollective.com/hedron/backer/18/avatar.svg"></a> <a href="https://opencollective.com/hedron/backer/19/website" target="_blank"><img src="https://opencollective.com/hedron/backer/19/avatar.svg"></a> <a href="https://opencollective.com/hedron/backer/20/website" target="_blank"><img src="https://opencollective.com/hedron/backer/20/avatar.svg"></a> <a href="https://opencollective.com/hedron/backer/21/website" target="_blank"><img src="https://opencollective.com/hedron/backer/21/avatar.svg"></a> <a href="https://opencollective.com/hedron/backer/22/website" target="_blank"><img src="https://opencollective.com/hedron/backer/22/avatar.svg"></a> <a href="https://opencollective.com/hedron/backer/23/website" target="_blank"><img src="https://opencollective.com/hedron/backer/23/avatar.svg"></a> <a href="https://opencollective.com/hedron/backer/24/website" target="_blank"><img src="https://opencollective.com/hedron/backer/24/avatar.svg"></a> <a href="https://opencollective.com/hedron/backer/25/website" target="_blank"><img src="https://opencollective.com/hedron/backer/25/avatar.svg"></a> <a href="https://opencollective.com/hedron/backer/26/website" target="_blank"><img src="https://opencollective.com/hedron/backer/26/avatar.svg"></a> <a href="https://opencollective.com/hedron/backer/27/website" target="_blank"><img src="https://opencollective.com/hedron/backer/27/avatar.svg"></a> <a href="https://opencollective.com/hedron/backer/28/website" target="_blank"><img src="https://opencollective.com/hedron/backer/28/avatar.svg"></a> <a href="https://opencollective.com/hedron/backer/29/website" target="_blank"><img src="https://opencollective.com/hedron/backer/29/avatar.svg"></a>

Sponsors

Become a sponsor and get your logo on our README on Github with a link to your site. [Become a sponsor]

sponsored by timber <a href="https://opencollective.com/hedron/sponsor/0/website" target="_blank"><img src="https://opencollective.com/hedron/sponsor/0/avatar.svg"></a> <a href="https://opencollective.com/hedron/sponsor/1/website" target="_blank"><img src="https://opencollective.com/hedron/sponsor/1/avatar.svg"></a> <a href="https://opencollective.com/hedron/sponsor/2/website" target="_blank"><img src="https://opencollective.com/hedron/sponsor/2/avatar.svg"></a> <a href="https://opencollective.com/hedron/sponsor/3/website" target="_blank"><img src="https://opencollective.com/hedron/sponsor/3/avatar.svg"></a> <a href="https://opencollective.com/hedron/sponsor/4/website" target="_blank"><img src="https://opencollective.com/hedron/sponsor/4/avatar.svg"></a> <a href="https://opencollective.com/hedron/sponsor/5/website" target="_blank"><img src="https://opencollective.com/hedron/sponsor/5/avatar.svg"></a> <a href="https://opencollective.com/hedron/sponsor/6/website" target="_blank"><img src="https://opencollective.com/hedron/sponsor/6/avatar.svg"></a> <a href="https://opencollective.com/hedron/sponsor/7/website" target="_blank"><img src="https://opencollective.com/hedron/sponsor/7/avatar.svg"></a> <a href="https://opencollective.com/hedron/sponsor/8/website" target="_blank"><img src="https://opencollective.com/hedron/sponsor/8/avatar.svg"></a> <a href="https://opencollective.com/hedron/sponsor/9/website" target="_blank"><img src="https://opencollective.com/hedron/sponsor/9/avatar.svg"></a>

License

MIT

<img src="https://raw.githubusercontent.com/syntra/assets/master/syntra-sponsorship.svg?sanitize=true"/>