# @savignano/use-flex

> Use component props to define flex css.

Latest version **0.1.1** (published 2020-01-20) · MIT license · 0 weekly downloads

## Install

```sh
npm install @savignano/use-flex
pnpm add @savignano/use-flex
yarn add @savignano/use-flex
bun add @savignano/use-flex
```

## Health

**Score 30/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.1 |
| Published | 2020-01-20 |
| First published | 2020-01-16 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 11.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | yes |
| GitHub stars | 1 |
| Author | Paul Savignano |
| Maintainers | paulsavignano |
| Keywords | React, React Hooks, Css flex |

## Links

- npm: https://www.npmjs.com/package/@savignano/use-flex
- Repository: https://github.com/PaulSavignano/use-flex
- Homepage: https://github.com/PaulSavignano/use-flex#readme
- Issues: https://github.com/PaulSavignano/use-flex/issues
- npm.io page: https://npm.io/package/@savignano/use-flex

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 0.1.1 (latest) — 2020-01-20
- 0.1.0 — 2020-01-20
- 0.0.9 — 2020-01-20
- 0.0.8 — 2020-01-16
- 0.0.7 — 2020-01-16
- 0.0.6 — 2020-01-16
- 0.0.5 — 2020-01-16
- 0.0.4 — 2020-01-16
- 0.0.3 — 2020-01-16
- 0.0.2 — 2020-01-16
- 0.0.1 — 2020-01-16

## README

<h1 align="center">Use Flex</h1>

<div align="center">

Use component props to define flex css.

[![NPM Version](https://img.shields.io/npm/v/@savignano/use-flex.svg?style=flat)](https://www.npmjs.com/package/@savignano/use-flex)
[![NPM Downloads](https://img.shields.io/npm/dm/@savignano/use-flex.svg?style=flat)](https://npmcharts.com/compare/@savignano/use-flex?minimal=true)
[![CircleCI](https://img.shields.io/circleci/build/github/PaulSavignano/use-flex/master.svg)](https://circleci.com/gh/PaulSavignano/use-flex/tree/master)
[![codecov.io](https://codecov.io/gh/PaulSavignano/use-flex/branch/master/graph/badge.svg)](https://codecov.io/gh/PaulSavignano/use-flex)
[![BundleSize](https://img.shields.io/bundlephobia/minzip/@savignano/use-flex.svg)](https://bundlephobia.com/result?p=@savignano/use-flex)
[![Dependencies](https://david-dm.org/PaulSavignano/use-flex/master/status.svg)](https://david-dm.org/PaulSavignano/use-flex/master)
[![DevDependencies](https://david-dm.org/PaulSavignano/use-flex/master/dev-status.svg)](https://david-dm.org/PaulSavignano/use-flex/master?type=dev)
[![PeerDependencies](https://david-dm.org/PaulSavignano/use-flex/master/peer-status.svg)](https://david-dm.org/PaulSavignano/use-flex/master?type=peer)
[![Patreon](https://img.shields.io/badge/patreon-support%20the%20author-blue.svg)](https://www.patreon.com/PaulSavignano)

</div>

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.
<br />

## Installation
```
npm install @savignano/use-flex
```

## Usage
Here is an example to get you started:

```jsx
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](https://codesandbox.io/s/use-flex-4rhj7?fontsize=14&hidenavigation=1&theme=dark)

## Contributing
- see CONTRIBUTING.md

---
_Source: https://npm.io/package/@savignano/use-flex · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
