Giter VIP home page Giter VIP logo

tailwind-storybook's Introduction

Tailwind CSS + Storybook

This is a starter for Tailwind CSS and Storybook with React components.

Example of Storybook published to GitHub pages.

Installation

git clone https://github.com/audunru/tailwind-storybook.git

cd tailwind-storybook

yarn install

Running Storybook

yarn start-storybook

Running the React application

yarn start

Creating components

Take a look at the Button or Card component. You can duplicate this directory and its contents to get started making your own components.

Each component directory contains the following files:

File Contains
Button.css Imports the main index.css file, which contains classes from Tailwind CSS. You don't have to add anything here if you're just going to use Tailwind's classes directly in your components.
Button.js The Button component, which will be used by your React application and documented by Storybook.
Button.stories.js Contains the Storybook component documentation (called "stories"), and is used when the Storybook is generated.
Button.test.js Tests for the Button component that you can run with yarn test.
index.js Export for the Button component so you can import it in your app with import Button from "./components/Button".

Customizing Tailwind CSS

Take a look at tailwind.config.js.

Deploy to Github Pages

Change the repository URL in package.json to your own repository:

  "repository": {
    "type": "git",
    "url": "https://github.com/johnshickson/epic-storybook"
  },

Run:

yarn deploy-storybook

Background

To get Tailwind CSS working with Storybook and Create React App, you can setup Tailwind CSS as a postcss plugin in Storybook's webpack.config.js and Craco's craco.config.js. That's what this starter does, in case you were wondering.

tailwind-storybook's People

Contributors

audunru avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.