Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

layout-blocks

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

layout-blocks

Reusable layout components for your React project

  • 0.2.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
3
decreased by-81.25%
Maintainers
1
Weekly downloads
 
Created
Source

Layout Blocks

Reusable layout components for your React project

npm i layout-blocks

Components

Box

Pad all sides (or none at all)

import { Box } from 'layout-blocks'
proptypedescriptiondefault
paddingstringpadding value for contentvar(--s1)
asstringHTML element to renderdiv

Breakout

Break out of a containing element

import { Breakout } from 'layout-blocks'
proptypedescriptiondefault
asstringHTML element to renderdiv

Center

Center content horizontally

import { Center } from 'layout-blocks'
proptypedescriptiondefault
maxstringMaximum width to limit contentvar(--measure)
centerTextbooleanAlso center the text withinfalse
gutterstringSpace on each side of the content0
intrinsicbooleanCenter children based on content widthfalse
asstringHTML element to renderdiv

Container

Contain children (enforces relative positioning)

import { Container } from 'layout-blocks'
proptypedescriptiondefault
asstringHTML element to renderdiv

Cover

"Cover" a height and vertically center the content within (like Hero elements)

import { Cover } from 'layout-blocks'
proptypedescriptiondefault
centeredIndexnumber1-based index of what child to center vertically (has no effect when there is one child)2
spacestringSpacing between child elementsvar(--s1)
minHeightstringMinimum height to cover100vh
isPaddedbooleanAlso use the space value to pad the containerfalse
asstringHTML element to renderdiv

Frame

Properly crop an image/video to an aspect ratio

import { Frame } from 'layout-blocks'
proptypedescriptiondefault
ratiostringAspect ratio of element ([width]:[height])16:9
asstringHTML element to renderdiv

Grid

Display a grid of items with a minimum width

import { Grid } from 'layout-blocks'
proptypedescriptiondefault
minstringMinimum width of children250px
spacestringSpace value used for gap between childrenvar(--s1)
asstringHTML element to renderdiv

Group

Show an overflowing group of things horizontally, each with maybe a different width

import { Group } from 'layout-blocks'
proptypedescriptiondefault
alignstringVertical alignment (start, center, end, stretch)center
justifystringHorizontal alignment (start, center, end, space-between, space-around, space-evenly)start
spacestringSpace value used for gap between childrenvar(--s1)
asstringHTML element to renderdiv

Position

Position content outside of it's normal flow

import { Position } from 'layout-blocks'
proptypedescriptiondefault
marginstringSpace to offset from the edge of the containing elementvar(--s1)
fixedbooleanContain the element to the viewport (instead of the document)false
xstringPositioning along x-axis (left, center, right, full)center
ystringPositioning along y-axis (top, center, bottom, full)center
asstringHTML element to renderdiv

Sidebar

Show a sidebar/content horizontal layout that stacks vertically at a certain threshold

import { Sidebar } from 'layout-blocks'
proptypedescriptiondefault
sidestringSide to treat as the sidebarleft
sideWidthstringWidth value to limit the sidebar to in horizontal modefalse
contentMinstringPercentage value to use as the breakpoint for the element opposite the sidebar (going under this percentage switches over to a vertical layout)50%
spacestringSpace between elements (sidebar and content)0
stretchbooleanStretch sidebar to match content (and vice versa)false
asstringHTML element to renderdiv

Stack

Vertically position a list of things (with optional spacing)

import { Stack } from 'layout-blocks'
proptypedescriptiondefault
spacestringVertical space between child elementsvar(--s1)
recursivebooleanRecursively apply spacing (for nested stacks)false
asstringHTML element to renderdiv

Switcher

Show a list of things horizontally, then stack when a container thershold is met

import { Switcher } from 'layout-blocks'
proptypedescriptiondefault
thresholdstringBreakpoint to layout items in a vertical stackvar(--measure)
spacestringSpace value used for the gap between childrenvar(--s1)
limitnumberNumber of items to limit to one row4
asstringHTML element to renderdiv

Keywords

FAQs

Package last updated on 08 Mar 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc