Giter VIP home page Giter VIP logo

olistic / flexbox-react Goto Github PK

View Code? Open in Web Editor NEW

This project forked from nachoaivarez/flexbox-react

0.0 1.0 1.0 1.1 MB

Unopinionated, standard compliant flexbox components. You don't need to learn any propietary syntax. If you know how to use flexbox, you know how to use flexbox-react components.

Home Page: http://nachoaIvarez.github.io/flexbox-react

License: Other

JavaScript 93.83% TypeScript 6.17%

flexbox-react's Introduction

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 <Container>, <SpacedBox>, <Column>, <View>, <Section> 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, unnecesary 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

yarn add flexbox-react

or

npm i --save flexbox-react

Usage

import Flexbox from 'flexbox-react';

//...
<Flexbox flexDirection="column" minHeight="100vh">

  <Flexbox element="header" height="60px">
    Header
  </Flexbox>

  <Flexbox flexGrow={1}>
    Content
  </Flexbox>

  <Flexbox element="footer" height="60px">
    Footer
  </Flexbox>

</Flexbox>

Sticky footer!

As you can see, there's 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 it 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 <div> for the layout, like <header> or <section>, you can pass an extra element prop to the <Flexbox /> component:

<Flexbox element="header" height="80px">
  ...
</Flexbox>

which will render to this:

<header style="display: flex; height: 80px;">
  ...
</header>

Props

Take a look at Flexbox PropTypes. No mysteries. As said, you just need to know actual flexbox properties not any propietary syntax for them, if you're not familiar with flexbox, here is a good starting point.

If TypeScript is your cup of tea, check the type definitions, we support them too.

License

MIT © Ignacio Álvarez

flexbox-react's People

Contributors

hoppula avatar nachoaivarez avatar nicholasgonzalezsc avatar olistic avatar stevejay avatar

Watchers

 avatar

Forkers

thondery

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.