0.1.1 • Published 4 years ago

@shinobi5/grid-layout v0.1.1

Weekly downloads
-
License
-
Repository
github
Last release
4 years ago

Usage

  <head>
    <script 
      src="https://unpkg.com/@shinobi5/grid-layout@0.1.0/lib/grid-layout.js" 
      defer 
    ></script>
  </head>
  <body>
    <main>
      <grid-layout 
        breakpoints="400px, 800px, 1200px"
        space="5px, 10px, 20px, 40px" 
        cols="1, 2, 3, 4" 
        col="1fr, 1fr 2fr, 2fr"
        rowsrange="auto, 200px"
        align="center"
        justify="start-end"
      >
        <div>item 1</div>
        <div>item 2</div>
        <div>item 3</div>
        <div>item 4</div>
      </grid-layout>
    </main>  
  </body>

API

As this component is still a v0 version there's a good chance this API will change as I start to use the component and discover improvements that are needed. Consider this API unstable at this stage

Options are set via attributes on the <grid-layout>. HTML attributes can only accept a single type: String.

Note: for attributes that accept a list of values applied at each breakpoint, the first value in the list is the initial value (the value applied before the first breakpoint)

OptionTypeDescription
alignStringValue is passed to align-items and align-content
breakpointsStringA list of comma separated breakpoint values (breakpoint values are applied tomin-width media queries)
colsStringA comma separated list of columns at each breakpoint
colStringA comma separated list of column settings at each breakpoint
justifyStringValue is passed to justify-items and justify-content
rowsrangeStringA comma separated list of values passed to minmax for grid-auto-columns
spaceStringA comma separated list of gap values at each breakpoint

Browser support

Layout component uses the shadowDOM to encapsulate the styles and CSS Grid Layout for the container properties. This means no support for IE11.

Development

Project requires deno and velociraptor to be installed

Start server at localhost:1234

vr start

Compile component

vr build