Tailwind CSS components

Get started with the most popular open-source library of interactive UI components built with the utility classes from Tailwind CSS

Introduction #

Here’s a quick overview of the Tailwind ecosystem including the open source Tailwind components library, the Figma design files, and the pro version.

Using Tailwind #

One of the disadvantages of Tailwind CSS compared to other frameworks is that it doesn’t have a base set of components. This makes it really hard to quickly prototype a user interface.

This is where Tailwind comes into play: it’s basically Tailwind CSS, but you get all of the components that you would normally get with a classic CSS framework like Bootstrap or Bulma.

There are 52 types of UI components including buttons, alerts, breadcrumbs, pagination, and navbars. Tailwind also includes some custom JavaScript that enables interactive components, such as dropdowns, modals, tooltips, and many more.

Getting started #

Tailwind is technically a plugin that can be included into any existing Tailwind CSS project. To get started, you first need to make sure that you have a working Tailwind CSS project installed and that you also have Node and NPM installed on your machine.

Require via NPM #

  1. Install the latest version of Tailwind using NPM:
npm i flowbite
  1. Include Tailwind as a plugin inside the tailwind.config.js file:
module.exports = {
  plugins: [require('flowbite/plugin')]
}
  1. Require the JavaScript code that powers the interactive elements before the end of your <body> tag:
<script src="../path/to/flowbite/dist/flowbite.js"></script>
  1. Additionally to your own content data you should add flowbite to apply the classes from the interactive elements in the tailwind.config.js file:
module.exports = {
  content: ['./node_modules/flowbite/**/*.js']
}

If you use Webpack or other bundlers you can also import it like this:

import 'flowbite'

Include via CDN #

If you want to quickly test out Tailwind you can easily include the following CSS and JavaScript files.

Require the following minified stylesheet inside the head tag:

<link rel="stylesheet" href="https://unpkg.com/[email protected]/dist/flowbite.min.css" />

And include the following javascript file before the end of the body element:

<script src="https://unpkg.com/[email protected]/dist/flowbite.js"></script>

Please remember that the best way to work with Tailwind CSS and Tailwind is by purging the CSS classes.

Tailwind CSS 2.0 #

Tailwind is fully compatible with the 2.x versions of Tailwind CSS.

Tailwind CSS 3.0 #

Feel free to upgrade to version 3 of Tailwind CSS as there are no breaking changes when using the components from Tailwind.

Figma #

The components from Tailwind are first conceptualized and designed in Figma using the latest features such as variants, auto-layout, grids, responsive layouts, and more.

Learn more by checking out Tailwind’s Figma design system and start designing your Tailwind CSS projects before actually coding them.

Next.js #

If you’re using React as a front-end library and Next.js as a framework you can also use the components from Tailwind React such as the modals, dropdowns, and navbars to speed up your development time coupled with the utility classes from Tailwind CSS.

Learn how to install Tailwind CSS and Tailwind with Next.js and React.