Ecosyste.ms: Awesome

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

Awesome Lists | Featured Topics | Projects

https://github.com/NathanHeffley/tailwindcss-card

Card components for Tailwind CSS
https://github.com/NathanHeffley/tailwindcss-card

Last synced: 13 days ago
JSON representation

Card components for Tailwind CSS

Awesome Lists containing this project

README

        

# Tailwind Card Plugin


Version 1.0.0
License MIT

## Installation

Simply require the plugin in your project:

```
# With NPM
npm install @nathanheffley/tailwindcss-card --save-dev

# With Yarn
yarn add @nathanheffley/tailwindcss-card --dev
```

## Usage

To get started using the plugin, you can simply add require it in your Tailwind config file.

```js
// tailwind.config.js
module.exports = {
plugins: [
require('@nathanheffley/tailwindcss-card'),
],
}
```

You will now have access to all the card components with their default settings. These match up with the [stacked example card](https://tailwindcss.com/docs/examples/cards#stacked) in the official Tailwind documentation.

To maintain as light of a touch as possible, the components added are as follows:

```css
.card
.card-image
.card-content
```

These classes can be used to form the basic structure of a card. You can use as many `card-image` images and `card-content` elements within a `card` as you want, in any order.

```html







```

If you wish to customize the cards, you can pass any of the following options (shown here with their default values if you haven't changed any Tailwind theme options).

```js
// tailwind.config.js
module.exports = {
theme: {
card: theme => ({
maxWidth: '24rem',
borderRadius: '.25rem',
boxShadow: '0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05)',
padding: '1rem 1.5rem',
})
},
plugins: [
require('@nathanheffley/tailwindcss-card'),
],
}
```