All Projects â†’ vitordino â†’ griding

vitordino / griding

Licence: MIT license
🧱 lean grid & responsive for react

Programming Languages

typescript
32286 projects
HTML
75241 projects

Projects that are alternatives of or similar to griding

Grid
This package has moved and renamed
Stars: ✭ 2,079 (+11450%)
Mutual labels:  grid, responsive, layout, flexbox
React Native Responsive Grid
Bringing the Web's Responsive Design to React Native
Stars: ✭ 369 (+1950%)
Mutual labels:  grid, responsive, layout, flexbox
react-super-styled
Responsive JSX layouts with Styled Components
Stars: ✭ 77 (+327.78%)
Mutual labels:  grid, responsive, layout, react-component
Flex Layout
Provides HTML UI layout for Angular applications; using Flexbox and a Responsive API
Stars: ✭ 5,705 (+31594.44%)
Mutual labels:  grid, responsive, layout, flexbox
bootstrap-grid-ms
Missing grid range in Bootstrap 3, micro-small from 480-767px.
Stars: ✭ 34 (+88.89%)
Mutual labels:  grid, responsive, layout
gutter-grid
A Sass flexbox based grid system that is able to replicate CSS grid-gap in IE11
Stars: ✭ 18 (+0%)
Mutual labels:  grid, responsive, flexbox
gymnast
🤸 Configurable grid and layout engine for React
Stars: ✭ 35 (+94.44%)
Mutual labels:  grid, layout, flexbox
React Flexview
A powerful React component to abstract over flexbox and create any layout on any browser
Stars: ✭ 276 (+1433.33%)
Mutual labels:  grid, layout, flexbox
flexboxes
CSS flexbox framework with pure flexbox grid ability
Stars: ✭ 27 (+50%)
Mutual labels:  grid, layout, flexbox
React Native Flexbox Grid
Responsive Grid for React Native
Stars: ✭ 95 (+427.78%)
Mutual labels:  grid, responsive, layout
Easygrid
EasyGrid - VanillaJS Responsive Grid
Stars: ✭ 77 (+327.78%)
Mutual labels:  grid, responsive, layout
Reflexbox
Moved to https://rebassjs.org
Stars: ✭ 1,369 (+7505.56%)
Mutual labels:  grid, react-component, flexbox
React Flexa
Responsive React Flexbox (CSS Flexible Box Layout Module) grid system based heavily on the standard CSS API.
Stars: ✭ 120 (+566.67%)
Mutual labels:  grid, responsive, flexbox
Shuffle
Categorize, sort, and filter a responsive grid of items
Stars: ✭ 2,170 (+11955.56%)
Mutual labels:  grid, responsive, layout
Grd
A CSS grid framework using Flexbox. Only 321 bytes (Gzipped).
Stars: ✭ 2,210 (+12177.78%)
Mutual labels:  grid, flexbox
Iota
A responsive micro-framework for the grid spec powered by CSS custom properties.
Stars: ✭ 189 (+950%)
Mutual labels:  grid, layout
Styled Bootstrap Components
The bootstrap components made with styled-components 💅
Stars: ✭ 196 (+988.89%)
Mutual labels:  grid, layout
Blueprint Css
📘 Blueprint CSS is a modern responsive CSS layout library & grid built on top of CSS Grid and Flexbox.
Stars: ✭ 233 (+1194.44%)
Mutual labels:  grid, flexbox
Reactsimpleflexgrid
A way to quickly add a Grid Layout to your React app 🚀
Stars: ✭ 181 (+905.56%)
Mutual labels:  grid, flexbox
Leerraum.js
A PDF typesetting library with exact positioning and hyphenated line breaking
Stars: ✭ 233 (+1194.44%)
Mutual labels:  grid, layout

griding

npm package demo Travis Coveralls Bundlephobia

griding is a set of react components, hooks and helpers to make responsive / grid layouts easier

why

although there are — already — an infinite amount of grid packages (pure css, stylus/sass, react) i couldn't find one that fill my needs:

  1. responsive gutters
  2. customisable breakpoints
  3. real react-like API
  4. easy to compose styles (lib-agnostic)
  5. local overrides (via nested <Providers/>)
  6. readable and predictable

installation

yarn:

yarn add griding

npm:

npm install griding --save

usage

this package provides components, hooks and a styled-components helper

components

basic usage (using default options):

import { Row, Cell, Provider } from 'griding'

const App = () => (
  <Provider>
    <Row vertical-gutter>
      <Cell xs={6} sm={4} md={3} lg={2}>
        <div>lorem</div>
      </Cell>
      <Cell xs={6} sm={4} md={3} lg={2}>
        <div>ipsum</div>
      </Cell>
    </Row>
  </Provider>
)

customizing options (breakpoints & column count):

import { Row, Cell, Provider } from 'griding'

const breakpoints = {
  hey: { width: 0, gutter: 16 },
  thats: { width: 480, gutter: 24 },
  rad: { width: 768, gutter: 32 },
}

const App = () => (
  <Provider breakpoints={breakpoints} columns={13}>
    <Row>
      {/* look how cool, your own named breakpoints & custom column count */}
      <Cell hey={6} thats={4} rad={3}>
        <div>lorem ipsum</div>
      </Cell>
    </Row>
  </Provider>
)

hooks

provides data derived from closest <Provider/> and / or window size*

*: although the folowing hooks are `ssr` friendly (not breaking the build), the correct result will only return when rendering browser. by default, when `window` is not available, it will fallback to 0, and return/render mobile results.

useTheme

outputs an object with:

  • columns: columns count
  • breakpoints: breakpoints object as described on Provider

useWindowSize

outputs an object with numeric: innerHeight & innerWidth

when ssr, both will return 0

useMediaQuery

receives an object with optional above and below parameters and returns a boolean. both parameters can be one of:

  • a string denoting a breakpoint

  • a number of pixels

the default parameters are below: 0, above: Infinity, therefore, if no parameters are provided, it will always return true

useBreakpoints

returns an array of strings denoting the breakpoint that are visible eg. on a tablet, we should get something like ['xs', 'sm', 'md']

useCurrentBreakpoint

returns a string denoting the biggest visible breakpoint, following the example, on a tablet we should get something like 'md'


helpers

above

a media query helper utility to use inside styled-components. receives a string denoting the breakpoint, and a template literal with the css that should be rendered:

const AboveMD = styled.div`
  display: none;
  ${above('md')`
  display: block;
 `}
`

contributing

this repo is open to issues and pull requests


thanks

mostly of this lib was done with @leonardodino great help and probably wouldn't be possible without it.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].