# react-spaceform

> React component to manage form layouts.

Latest version **0.2.2** (published 2018-01-25) · MIT license · 0 weekly downloads

## Install

```sh
npm install react-spaceform
pnpm add react-spaceform
yarn add react-spaceform
bun add react-spaceform
```

## Health

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

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.2.2 |
| Published | 2018-01-25 |
| First published | 2018-01-23 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Dependencies | 2 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Maintainers | t1mmaas |

## Links

- npm: https://www.npmjs.com/package/react-spaceform
- Repository: https://github.com/nanot1m/react-spaceform
- Homepage: https://github.com/nanot1m/react-spaceform#readme
- Issues: https://github.com/nanot1m/react-spaceform/issues
- npm.io page: https://npm.io/package/react-spaceform

## Dependencies (2)

- [react-jss](https://npm.io/package/react-jss.md) ^8.2.1
- [create-react-context](https://npm.io/package/create-react-context.md) ^0.1.4

## Recent versions

- 0.2.2 (latest) — 2018-01-25
- 0.2.1 — 2018-01-24
- 0.2.0 — 2018-01-24
- 0.1.0 — 2018-01-24
- 0.0.1 — 2018-01-23

## README

# react-spaceform

React component to manage form layouts.

## Installation

```bash
yarn add react-spaceform
```

## Examples

Top aligned labels

```js
<Form>
  <FormRow>
    <FormLabel>Login</FormLabel>
    <FormControl>
      <input placeholder="login" />
    </FormControl>
  </FormRow>
  <FormRow>
    <FormLabel>Password</FormLabel>
    <FormControl>
      <input placeholder="password" type="password" />
    </FormControl>
  </FormRow>
  <FormRow>
    <FormLabel />
    <FormControl>
      <input type="submit" value="Sign in" />
    </FormControl>
  </FormRow>
</Form>
```

Left aligned labels

```js
<Form labelWidth="80px" labelAlign="left">
  <FormRow>
    <FormLabel>Login</FormLabel>
    <FormControl>
      <input placeholder="login" />
    </FormControl>
  </FormRow>
  <FormRow>
    <FormLabel>Password</FormLabel>
    <FormControl>
      <input placeholder="password" type="password" />
    </FormControl>
  </FormRow>
  <FormRow>
    <FormLabel />
    <FormControl>
      <input type="submit" value="Sign in" />
    </FormControl>
  </FormRow>
</Form>
```

Right aligned labels

```js
<Form labelWidth="80px" labelAlign="right">
  <FormRow>
    <FormLabel>Login</FormLabel>
    <FormControl>
      <input placeholder="login" />
    </FormControl>
  </FormRow>
  <FormRow>
    <FormLabel>Password</FormLabel>
    <FormControl>
      <input placeholder="password" type="password" />
    </FormControl>
  </FormRow>
  <FormRow>
    <FormLabel />
    <FormControl>
      <input type="submit" value="Sign in" />
    </FormControl>
  </FormRow>
</Form>
```

By default spacing is equal to 4px. To change it
pass prop spacing to Form

```js
<Form labelWidth="80px" labelAlign="right" spacing={10}>
  <FormRow>
    <FormLabel>Login</FormLabel>
    <FormControl>
      <input placeholder="login" />
    </FormControl>
  </FormRow>
  <FormRow>
    <FormLabel>Password</FormLabel>
    <FormControl>
      <input placeholder="password" type="password" />
    </FormControl>
  </FormRow>
  <FormRow>
    <FormLabel />
    <FormControl>
      <input type="submit" value="Sign in" />
    </FormControl>
  </FormRow>
</Form>
```

## API

There are 4 base components

```js static
import { Form, FormRow, FormLabel, FormControl } from "react-spaceform";
```

### Form

#### Props

| name       | type                     | default | description         |
| ---------- | ------------------------ | ------- | ------------------- |
| width      | `string` or `number`     |         | form width          |
| labelWidth | `string` or `number`     |         | labels width        |
| labelAlign | `top`, `left` or `right` | `top`   | label position      |
| spacing    | `number`                 | 4       | spacing base number |

Components `FormRow`, `FormLabel` and `FormControl` accepts any
valid react html-attributes.

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