All Projects → welefen → grid-layout

welefen / grid-layout

Licence: other
grid-layout is a layout engine which implements grid, can use in canvas/node-canvas

Programming Languages

typescript
32286 projects
Vue
7211 projects
javascript
184084 projects - #8 most used programming language
HTML
75241 projects

Projects that are alternatives of or similar to grid-layout

Interior
Design system for the modern web.
Stars: ✭ 77 (+79.07%)
Mutual labels:  grid, layout, css-grid, grid-layout
Bedrock
Foundational Layout Primitives for your React App
Stars: ✭ 173 (+302.33%)
Mutual labels:  layout, css-grid, grid-layout
React Css Grid
React layout component based on CSS Grid Layout and built with styled-components
Stars: ✭ 239 (+455.81%)
Mutual labels:  layout, css-grid, grid-layout
grid-garden
Solutions to CSS Grid Garden
Stars: ✭ 79 (+83.72%)
Mutual labels:  grid, css-grid, grid-layout
60gs
60GS - 60 Columns Grid System based on CSS Grid Layout
Stars: ✭ 65 (+51.16%)
Mutual labels:  grid, css-grid, grid-layout
Bootstrap Grid Css
The grid and responsive utilities classes extracted from the Bootstrap 4 framework, compiled into CSS.
Stars: ✭ 119 (+176.74%)
Mutual labels:  grid, css-grid, grid-layout
Cssgridgenerator
🧮 Generate basic CSS Grid code to make dynamic layouts!
Stars: ✭ 3,943 (+9069.77%)
Mutual labels:  grid, css-grid, grid-layout
Magic Grid
A simple, lightweight Javascript library for dynamic grid layouts.
Stars: ✭ 2,827 (+6474.42%)
Mutual labels:  grid, layout, grid-layout
React Photo Layout Editor
Photo layout editor for react
Stars: ✭ 96 (+123.26%)
Mutual labels:  grid, layout, grid-layout
Grid Cheatsheet
CSS Grid cheat sheet
Stars: ✭ 83 (+93.02%)
Mutual labels:  grid, css-grid, grid-layout
Popo
PoPo is the grid layout tool, the best choice for runtime layout.
Stars: ✭ 130 (+202.33%)
Mutual labels:  grid, layout, grid-layout
gridbugs-ru
Перевод списка багов в CSS Grid Layout, курируемого Рейчел Эндрю
Stars: ✭ 27 (-37.21%)
Mutual labels:  grid, css-grid, grid-layout
grid-container
A grid for the future, CSS Grid Layout + Web Components (Custom Elements v1 + Shadow DOM v1)
Stars: ✭ 51 (+18.6%)
Mutual labels:  grid, grid-layout
egjs-grid
A component that can arrange items according to the type of grids
Stars: ✭ 188 (+337.21%)
Mutual labels:  grid, layout
rebass
⚛️ React primitive UI components built with styled-system.
Stars: ✭ 7,844 (+18141.86%)
Mutual labels:  grid, layout
bootstrap-grid-card
Bootstrap grid in Lovelace UI
Stars: ✭ 25 (-41.86%)
Mutual labels:  grid, layout
flex-box-grid
Responsive, mobile first Flexbox Grid
Stars: ✭ 39 (-9.3%)
Mutual labels:  grid, grid-layout
masonry-css
Create mosaic grid, like masonry, with css only
Stars: ✭ 17 (-60.47%)
Mutual labels:  grid, layout
griding
🧱 lean grid & responsive for react
Stars: ✭ 18 (-58.14%)
Mutual labels:  grid, layout
tb-grid
tb-grid is a super simple and lightweight 12 column responsive grid system utilizing css grid.
Stars: ✭ 19 (-55.81%)
Mutual labels:  grid, grid-layout

grid-layout

grid-layout is a layout engine which implements grid, can use in canvas/node-canvas.

it's support most of features from https://www.w3.org/TR/css-grid-1/ except direction/writing-mode styles.

Install

npm i @welefen/grid-layout

Usage

<script src="https://unpkg.com/@welefen/grid-layout/dist/gridLayout.js"></script>
<script>
const { Container, Node } = GridLayout;
</script>
import { Container, Node } from '@welefen/grid-layout';
const container = new Container({ // containerOptions
  width: 500,
  height: 500
});
[
  { width: 100, height: 100 },
  { width: 100, height: 100 }
].forEach(item => {
  const node = new Node(item); // nodeOptions
  container.appendChild(node);
});
container.calculateLayout();
const result = container.getAllComputedLayout();
// result is
/**
 * {
 *  top: 0
    left: 0
    width: 500
    height: 500,
    children: [{
      top: 0,
      left: 0,
      width: 100,
      height: 100
    }, ...]
 * }
 * /

containerOptions

{
  gridAutoFlow?: string;
  gridAutoColumns?: string;
  gridAutoRows?: string;
  gridColumnGap?: StringOrNumber;
  gridRowGap?: StringOrNumber;
  gridTemplateAreas?: string | string[][];
  gridTemplateRows?: string;
  gridTemplateColumns?: string;
  width: number;
  height: number;
  alignItems?: SelfAlignment;
  justifyItems?: SelfAlignment;
  alignContent?: ContentAlignment;
  justifyContent?: ContentAlignment;
}
type SelfAlignment = 'stretch' | 'center' | 'start' | 'end' | 'auto';
type ContentAlignment = 'stretch' | 'start' | 'center' | 'end' | 'space-between' | 'space-around' | 'space-evenly';
type StringOrNumber = string | number;

gridTemplateAreas config

// string
{
  gridTemplateAreas: `"a b c"
                      "d e f"`
}

// array
{
  gridTemplateAreas: [['a', 'b', 'c'],
                      ['d', 'e', 'f']]
}

nodeOptions

{
  gridArea?: string;
  gridColumnEnd?: StringOrNumber;
  gridColumnStart?: StringOrNumber;
  gridRowEnd?: StringOrNumber;
  gridRowStart?: StringOrNumber;
  alignSelf?: SelfAlignment;
  justifySelf?: SelfAlignment;
  paddingTop?: StringOrNumber;
  paddingRight?: StringOrNumber;
  paddingBottom?: StringOrNumber;
  paddingLeft?: StringOrNumber;
  padding?: any;
  marginTop?: StringOrNumber;
  marginRight?: StringOrNumber;
  marginBottom?: StringOrNumber;
  marginLeft?: StringOrNumber;
  margin?: StringOrNumber;
  borderTop?: StringOrNumber;
  borderRight?: StringOrNumber;
  borderBottom?: StringOrNumber;
  borderLeft?: StringOrNumber;
  border?: any;
  width?: StringOrNumber;
  height?: StringOrNumber;
  boxSizing?: string;
  order?: number;
  minWidth?: StringOrNumber;
  maxWidth?: StringOrNumber;
  minHeight?: StringOrNumber;
  maxHeight?: StringOrNumber;
  minContentWidth?: StringOrNumber;
  minContentHeight?: StringOrNumber;
  maxContentWidth?: StringOrNumber;
  maxContentHeight?: StringOrNumber;
}

Playground

git clone [email protected]:welefen/grid-layout.git;
npm i;
npm run build;
cd web;
npm i;
npm start;
# then visit http://127.0.0.1:8080/

online playground: https://welefen.com/lab/gridLayout/

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].