1.1.1 • Published 3 years ago

reaflex v1.1.1

Weekly downloads
3
License
MIT
Repository
github
Last release
3 years ago

reaflex

Easy Flexbox in React

npm version

Install

npm i reaflex

Or

yarn add reaflex

It expects the following to be installed as peer dependencies

  • react >= 16.8.0
  • react-dom >= 16.8.0
  • styled-components >= 4.4.1
  • prop-types >= 15.7.0

Use

import { Flex, Item } from "reaflex";

const MyComponent = () => {
  return (
    <Flex direction="column" alignItems="center" justifyContent="center">
      <Item alignSelf="flex-end">Hello</Item>
      <Item as="span">Flex</Item>
      <Item alignSelf="flex-start">Box</Item>
    </Flex>
  );
};

Props

Flex
PropTypeDescription
asReact.ElementTypeThe element to render. Defaults to div.
inlinebooleanSets the display property to inline-flex when true and flex otherwise. Defaults to false.
directionstringSets the flex-direction property.
alignItemsstringSets the align-items property.
justifyContentstringSets the justify-content property.
wrapstringSets the flex-wrap property.
flowstringSets the flex-flow property.
gapstringSets the gap property.
rowGapstringSets the row-gap property.
columnGapstringSets the column-gap property.
Item
PropTypeDescription
asReact.ElementTypeThe element to render. Defaults to div.
ordernumberSets the order property.
alignSelfstringSets the align-self property.
growstring or numberSets the flex-grow property.
shrinkstring or numberSets the flex-shrink property.
basisstringSets the flex-basis property.
flexstring or numberSets the flex property.

Demo

See it running in action in this demo.

License

MIT Copyright (c) Maroun Baydoun.