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

flxbx

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

flxbx

A minimalistic flexbox library for React

  • 1.0.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
decreased by-100%
Maintainers
1
Weekly downloads
 
Created
Source

flxbx

A minimalistic flexbox library for React

	[![Build Status](https://travis-ci.org/rcdexta/flxbx.svg?branch=master)](https://travis-ci.org/rcdexta/flxbx)
[![npm version](https://badge.fury.io/js/flxbx.svg)](https://badge.fury.io/js/flxbx)

Why?

Most react libraries for flexbox are bloated. I wrote this for myself as a utility to contain the minimal directives for flexbox to quickly prototype a custom layout with container containing multiple children each with their own flex attributes

Features

  • minimalistic and light weight
  • direct wrapper to flexbox specification

Getting Started

Use npm or yarn to add this as dependency

npm install -save flxbx

or

yarn add flxbx

Usage

Flxbx defined two components to describe flexbox specification for parent container as well as child components.

Consider the layout below:

alt tag

This can be defined using the following DSL. Read through the values assigned to props to better understand the layout used. Note that Box is just an arbitrary component used to visually represent the effect of flex layout and is not part of the library.

<FlxBx reverse={true} justify='center' align='center'>
	<Box num={1} />
	<Box num={2} />
	<Box num={3} />
	<Box num={4} />
</FlxBx>

To tweak the position of individual child elements, read throught the next example

alt tag

<FlxBx>
	<FlxEl element={Box} num={1} />
	<FlxEl element={Box} num={2} align='center' />
	<FlxEl element={Box} num={3} grow='0.4' />
	<FlxEl element={Box} num={4} align='flex-end'/>
</FlxBx>

FlxEl takes a component as element prop and passes all other props not relevant to flxbx library.

Please check the examples in the storybook for detailed documentation about possible prop values

Documentation

FlxBx

Parent component to define the container level flex properties

NameTypeDescription (default value)Flexbox Reference
directionstringHow flex items are placed in the flex container defining the main axis and the direction (row)flex-direction
reversebooleanReverse flex direction (false)-
justifystringDefines how the browser distributes space between and around content items along the main axis of their container (flex-start)justify-content
alignstringdefines how the browser distributes space between and around flex items along the cross-axis of their container (flex-start)align-items

FlxEl

Wrapper component for defining flex properties for child elements

NameTypeDescription (default value)Flexbox Reference
elementobjectActual component to be rendered as child-
alignstringaligns flex items of the current flex line overriding the align-items value (auto)align-self
basisstringspecifies the flex basis which is the initial main size of a flex item (auto)flex-basis
growstringspecifies the flex grow factor of a flex item. It specifies what amount of space inside the flex container the item should take up (0)flex-grow
shrinkstringspecifies the flex shrink factor of a flex item. Flex items will shrink to fill the container according to the flex-shrink number, when the default width of flex items is wider than the flex container (1)flex-shrink

License

MIT

Keywords

FAQs

Package last updated on 03 Sep 2017

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