Ecosyste.ms: Awesome

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

Awesome Lists | Featured Topics | Projects

https://github.com/hauptrolle/stitches-utils

Helpful stitches shorthand utilities combined in one package
https://github.com/hauptrolle/stitches-utils

css-in-js stitches stitches-utils

Last synced: about 2 months ago
JSON representation

Helpful stitches shorthand utilities combined in one package

Awesome Lists containing this project

README

        

# stitches-utils

[![All Contributors](https://img.shields.io/badge/all_contributors-2-orange.svg?style=flat-square)](#contributors-)

> Helpful stitches utilities like `marginY`, `marginX` etc. combined in one package

![GitHub release](https://img.shields.io/github/release/hauptrolle/stitches-utils.svg) ![issues](https://img.shields.io/github/issues/hauptrolle/stitches-utils)

---

## Installation:

`yarn add stitches-utils`

or

`nom install stitches-utils`

## Usage:

Import all utils

```jsx
import { createStyled } from "@stitches/react";
import * as utils from "stitches-utils";

export const { styled, css } = createStyled({
utils,
});
```

Import specific utils

```jsx
import { createStyled } from "@stitches/react";
import { mx, my } from "stitches-utils";

export const { styled, css } = createStyled({
utils: {
mx,
my,
},
});
```

## Utils overview:

| Utility | Properties |
| ------------ | ---------------------------------------------------- |
| m | marginTop, marginRight, marginBottom, marginLeft |
| mt | marginTop |
| mr | marginRight |
| mb | marginBottom |
| ml | marginLeft |
| mx, marginX | marginLeft, marginRight |
| my, marginY | marginTop, marginBottom |
| p | paddingTop, paddingRight, paddingBottom, paddingLeft |
| pt | paddingTop |
| pr | paddingRight |
| pb | paddingBottom |
| pl | paddingLeft |
| px, paddingX | paddingLeft, paddingRight |
| py, paddingY | paddingTop, paddingBottom |
| br | borderRadius |
| btlr | borderTopLeftRadius |
| btrr | borderTopRightRadius |
| bblr | borderBottomLeftRadius |
| bbrr | borderBottomRightRadius |
| w | width |
| minW | minWidht |
| maxW | maxWidth |
| h | height |
| minH | minHeight |
| maxH | maxHeight |
| boxSize | width, height |

## Custom utils:

It's also possible to build custom utils by using the `composeUtil` function.

```jsx
import { createStyled } from "@stitches/react";
import { composeUtil } from "stitches-utils";

const size = composeUtil("width", "height");

export const { styled, css } = createStyled({
utils: {
size,
},
});
```

## Contributors ✨

Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)):



Achim Rolle

💻 📖 💡 👀

Bernardo Raposo

💻 📖 💡 ⚠️ 🤔

This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome!