Ecosyste.ms: Awesome

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

Awesome Lists | Featured Topics | Projects

https://github.com/mattrothenberg/tailwindcss-stack-plugin

A Tailwind plugin for custom "stack" utility classes
https://github.com/mattrothenberg/tailwindcss-stack-plugin

Last synced: 3 months ago
JSON representation

A Tailwind plugin for custom "stack" utility classes

Awesome Lists containing this project

README

        

## tailwindcss-stack-plugin
A Tailwind plugin for custom "stack" utility classes.1

**Demo**: https://rzpuh.sse.codesandbox.io/

## Installation

```bash
yarn add tailwind-stack-plugin --dev
```

## Tailwind Configuration

In your `tailwind.config.js`, be sure to:
- Require the plugin
- Define at least (1) `stack` theme value
- Specify which variant(s) you want to apply to the `.stack-*` classes

```js
module.exports = {
theme: {
stack: {
sm: "8px",
md: "16px",
lg: "24px",
xl: "48px"
},
},
variants: {
stack: ["responsive"]
},
plugins: [require("tailwind-stack-plugin")]
};
```

## Usage (Vertical)

```html



Vertical Stack









```

Screen Shot 2020-03-25 at 10 31 29 AM

## Usage (Inline)

```html



Inline Stack









```

Screen Shot 2020-03-25 at 10 36 18 AM

---

1 What's a "stack?" :thinking:

As the [war on margin](https://mxstbr.com/thoughts/margin) continues on, front-end developers have invented clever ways of decoupling spacing details from their component implementations.

One such abstraction is the **stack** component – a parent node that leverages the cascade to ensure that its children are equally spaced apart (either vertically or horizontally).

```jsx
// Credit: https://mxstbr.com/thoughts/margin



```

Prior Art
- https://seek-oss.github.io/braid-design-system/components/Stack/
- https://every-layout.dev/layouts/stack/
- https://chakra-ui.com/stack