0.1.1 • Published 4 years ago

@savignano/use-flex v0.1.1

Weekly downloads
-
License
MIT
Repository
github
Last release
4 years ago

Use component props to define flex css.

NPM Version NPM Downloads CircleCI codecov.io BundleSize Dependencies DevDependencies PeerDependencies Patreon

use-flex is a JavaScript library for styling user interfaces.

  • Declarative: Define the styles you need and enjoy the benefit of cached css without the cost of inline style redefinition.
  • Flexible: No pun intended. Props that do not have css definitions will be inline styled. You may also pass a style prop. Have a className you'd like incorporated? Pass in a className prop and have it concatenated.
  • Powerful: Have your own css classes? Pass a customMapping object and serve your own css with component props.

Installation

npm install @savignano/use-flex

Usage

Here is an example to get you started:

import React from 'react';
import ReactDOM from 'react-dom';
import useFlex from '@savignano/use-flex';

function Section({ children, ...rest }) {
  const { className, style } = useFlex(rest)
  return (
    <section className={className} style={style}>
      {children}
    </section>
  )
}

function App() {
  return (
    <Section alignItems="center" flexFlow="row wrap" justifyContent="center">
      <p>This</p>
      <p>content</p>
      <p>is horizontal</p>
    </Section>
  );
}

ReactDOM.render(<App />, document.querySelector('#app'));

Examples

Codesandbox

Contributing

  • see CONTRIBUTING.md
0.1.0

4 years ago

0.1.1

4 years ago

0.0.9

4 years ago

0.0.8

4 years ago

0.0.5

4 years ago

0.0.4

4 years ago

0.0.7

4 years ago

0.0.6

4 years ago

0.0.3

4 years ago

0.0.2

4 years ago

0.0.1

4 years ago