Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/nachoaIvarez/flexbox-react

Unopinionated, standard compliant flexbox component. No propietary APIs. Nothing but flexbox.
https://github.com/nachoaIvarez/flexbox-react

flexbox layout react spec-compliant

Last synced: about 2 months ago
JSON representation

Unopinionated, standard compliant flexbox component. No propietary APIs. Nothing but flexbox.

Awesome Lists containing this project

README

        

## This project sunsetting
I created this a relatively long time ago, gave it visibility on the internet and used it in multiple projects, in production, like many of you. Time passed and I can no longer devote time to `flexbox-react`, so I'm not longer maintaining this repo.

I'm glad for the appearances of other libraries iterating in this concept I created (and I take pride on this) —From [material-ui](https://material-ui.com/system/flexbox/) to [chakra-ui](https://chakra-ui.com/box) and even [google's native android flexbox layout library](https://github.com/google/flexbox-layout).

Thanks to all contributors along the way!

# flexbox-react



Build Status


NPM Version


Downloads


Dependency Status


License

## Intro
Unopinionated, standard compliant flexbox components.

## Why
You should not learn any proprietary syntax, classnames or API's for this.
If you know how to use flexbox, you know how to use `flexbox-react` components.

No more ``, ``, ``, ``, `` or any other
arbitrarily named and _spec_ ed components to layout your apps.

No more `first={true}`, `ternary={true}`, `spaced={true}`,`grouped={true}`
or any other arbitrarily named and _spec_ ed props to layout your apps.

`flexbox-react` is agnostic of which post/pre css build flow you have, it works out of the box. It's agnostic to it. You could have all your styling on css files. Or all inlined. This sits just in the middle. It might be a good idea to see your components and know how they are laid out without jumping between css files or arbitrary, layout-exclusive components specifications.

## How
No hardcoded, bloated, unnecessary vendor prefixes, by
caniuse. Just those your browser needs, based
on your `userAgent`.

No need to import any new stylesheet or to add any styles to your
existing stylesheets. It works out of the box, just by using the
component.

## Install

```sh
yarn add flexbox-react
# or
npm install --save flexbox-react
```

## Usage
```js
import Flexbox from 'flexbox-react';

// ...


Header


Content


Footer

```
*Sticky footer!*

As you can see, there're some extra props as _layout_ ing helpers. Those are `height`, `minHeight`, `maxHeight`, `width`, `minWidth`, `maxWidth`, `padding`, `paddingTop`, `paddingRight`, `paddingBottom`, `paddingLeft`, `margin`, `marginTop`, `marginRight`, `marginBottom`, and `marginLeft`. The idea of `flexbox-react` is to be a complete solution to build layouts. Since, well, flexbox is a complete solution to build layouts. It's all about the sugar. Feel free to create an issue or submit a PR if you think there's room for improvement here!

### Semantic HTML tags

If you need to use a tag other than `

` for the layout, like `` or ``, you can pass an extra `element` prop to the `` component:

```html

...

```

which will render to this:

```html

...

```

## Props
Take a look at
[Flexbox PropTypes](https://github.com/nachoaIvarez/flexbox-react/blob/master/src/Flexbox.jsx#L68-L141). No mysteries. As said, you just need to know actual flexbox properties not any proprietary syntax for them. If you're not familiar with flexbox, [this is a good starting point](https://css-tricks.com/snippets/css/a-guide-to-flexbox/).

If TypeScript is your cup of tea, check the [type definitions](https://github.com/nachoaIvarez/flexbox-react/blob/master/src/index.d.ts), we support them too.

## License

MIT © [Ignacio Álvarez](http://github.com/nachoaIvarez)

[npm-url]: https://npmjs.org/package/flexbox-react
[npm-image]: https://img.shields.io/npm/v/flexbox-react.svg

[depstat-url]: https://david-dm.org/nachoaIvarez/flexbox-react
[depstat-image]: https://david-dm.org/nachoaIvarez/flexbox-react.svg

[download-badge]: http://img.shields.io/npm/dm/flexbox-react.svg