Ecosyste.ms: Awesome

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

Awesome Lists | Featured Topics | Projects

https://github.com/bukinoshita/space

A spacing util
https://github.com/bukinoshita/space

design space spacing system theme ui

Last synced: 2 months ago
JSON representation

A spacing util

Awesome Lists containing this project

README

        

# Space

> A spacing util

## Install

```bash
$ yarn add @bukinoshita/space
```

## Usage

Example with [styled-jsx](https://github.com/zeit/styled-jsx).

```ts
// theme/space.ts
import { Space } from '@bukinoshita/space'

// It uses the `4px` grid by default
export const space = new Space()
```

```tsx
// components/my-component.tsx
import { space } from 'theme/spacing'

const MyComponent = () => (


Nice


{`
h1 {
margin-bottom: ${space.spacing(2)} // 8px;
color: black;
}
`}


)
```

You can find more [example here](/examples).

## API

### Space(grid, unit)

#### grid

Type: `number`

Default: `4`

Optional

#### unit

Type: `string`

Default: `px`

Optional

### .spacing(value)

#### value

Type: `number`

Required

## License

MIT © [Bu Kinoshita](https://bukinoshita.com)