Flowbite - Tailwind CSS component library
Get started with the most popular open-source library of interactive UI components built with the utility classes from Tailwind CSS
Introduction #
Flowbite is an open-source library of UI components based on the utility-first Tailwind CSS framework featuring dark mode support, a Figma design system, templates, and more.
It includes all of the commonly used components that a website requires, such as buttons, dropdowns, navigation bars, modals, but also some more advanced interactive elements such as datepickers.
All of the elements are built using the utility classes from Tailwind CSS and vanilla JavaScript with support for TypeScript.
Here’s a quick overview of the Flowbite ecosystem including the open source Tailwind components library, the Figma design files, and the pro version.
Quickstart
Learn how to get started by downloading and configuring Flowbite locally on your machine and start developing.
Components
Explore the Tailwind CSS elements such as buttons, navbars, alerts, dropdowns and use them to build your website.
Figma design files
Prototype and design your website before coding with the Flowbite Figma file which is based on the Tailwind CSS classes.
Flowbite Icons
Free and open-source collection of over 430 solid and outline styled SVG icons to use with our UI component library and Figma.
Flowbite Blocks
Take your Figma and Tailwind CSS development to the next level with thousands more elements and pages with Flowbite Pro.
Upgrade to Pro
Check out over 450+ website sections and advanced UI components built with Tailwind CSS and the Flowbite Library.
Using Flowbite #
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 Flowbite 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 over 56 types of UI components including buttons, alerts, breadcrumbs, pagination, and navbars. Flowbite also includes some custom JavaScript that enables interactive components, such as dropdowns, modals, tooltips, and many more.
Getting started #
Flowbite 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 #
- Install the latest version of Flowbite using NPM:
npm install flowbite
- Include Flowbite as a plugin inside the
tailwind.config.js
file:
module.exports = {
plugins: [
require('flowbite/plugin')
]
}
- Additionally to your own
content
data you should addflowbite
to apply the classes from the interactive elements in thetailwind.config.js
file:
module.exports = {
content: [
"./node_modules/flowbite/**/*.js"
]
}
- Require the JavaScript code that powers the interactive elements before the end of your
<body>
tag:
<script src="../path/to/flowbite/dist/flowbite.min.js"></script>
Learn more about the Flowbite JavaScript API and functionalities in the JavaScript section.
Note: if you want to try out Flowbite with Tailwind v4-beta please check out the guide below.
Include via CDN #
If you want to quickly test out Flowbite you can easily include the following CSS and JavaScript files.
Require the following minified stylesheet inside the head
tag:
<link href="https://cdn.jsdelivr.net/npm/flowbite@2.5.2/dist/flowbite.min.css" rel="stylesheet" />
And include the following javascript file before the end of the body
element:
<script src="https://cdn.jsdelivr.net/npm/flowbite@2.5.2/dist/flowbite.min.js"></script>
Please remember that the best way to work with Tailwind CSS and Flowbite is by purging the CSS classes.
Bundled JavaScript #
One of the most popular way of using Flowbite is to include the bundled Javascript file which is UMD ready using a bundler such as Webpack or Parcel which makes sure that all of the data attributes and functionality will work out-of-the-box.
You can directly import the main JavaScript file inside your bundled app-bundle.js
file like this:
import 'flowbite';
This file has access to all of the components and it automatically applies event listeners to the data attributes.
Data attributes #
The preferred way to use the interactive UI components from Flowbite is via the data attributes interface which allows us to add functionality via the HTML element attributes and most of the examples on our documentation applies this strategy.
For example, to set up a modal component all you need to do is use data-modal-target
and data-modal-{toggle|show|hide}
to toggle, show, or hide the component by clicking on any trigger element.
Init functions #
You can also use the init functions to set up the event listeners yourself. Here’s an example how you can do it with Vue or Nuxt:
<script setup>
import { onMounted } from 'vue'
import { initFlowbite } from 'flowbite'
// initialize components based on data attribute selectors
onMounted(() => {
initFlowbite();
})
</script>
<template>
// Modal HTML markup with data attributes from Flowbite
</template>
The initFlowbite
function sets up all of the init functions for dropdowns, modals, navbars, tooltips and so on to hook onto the data attributes. Alternatively, you can also initialise each component category class separately with initDropdowns
or initModals
.
You can view more examples by browsing the components from Flowbite.
ESM and CJS #
Flowbite also offers an API for using the components programmatically and it supports both CJS and ESM for JavaScript which can be helpful if you need to expand the default capabilities of the data attributes interface and get access to function callbacks.
Here’s an example how you can import and create a new Modal component inside JavaScript:
import { Modal } from 'flowbite'
const $modalElement = document.querySelector('#modalEl');
const modalOptions = {
placement: 'bottom-right',
backdrop: 'dynamic',
backdropClasses: 'bg-gray-900/50 dark:bg-gray-900/80 fixed inset-0 z-40',
onHide: () => {
console.log('modal is hidden');
},
onShow: () => {
console.log('modal is shown');
},
onToggle: () => {
console.log('modal has been toggled');
}
}
const modal = new Modal($modalElement, modalOptions);
modal.show();
Check out the JavaScript behaviour section of each component’s page to learn how you can use this.
TypeScript #
Flowbite supports type declarations for the interactive UI components including object interfaces and parameter types. Check out the following examples to learn how you can use types with Flowbite.
Additionally to our code above, we will now import some relevant types from the Flowbite package, namely the ModalOptions
and ModalInterface
:
import { Modal } from 'flowbite'
import type { ModalOptions, ModalInterface } from 'flowbite'
import type { InstanceOptions } from 'flowbite';
// other code
Learn more about Flowbite and TypeScript in the quickstart guide.
Figma Design System #
The components from Flowbite 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 Flowbite’s Figma design system and start designing your Tailwind CSS projects before actually coding them.
Flowbite SVG Icons #
Check out a free and open-source collection of over 430 SVG icons with solid and outline styles to integrate with the UI components from Flowbite.
Learn more by browsing the Flowbite Icons page and interface to directly copy-paste the icons into your project as raw SVGs or React (JSX) code.
Flowbite GPT #
We’ve developed a custom trained ChatGPT model that you can use to generate website sections and pages based on the resources from Flowbite and Tailwind CSS.
Start generating with Flowbite GPT.
Pro version #
If you want to take your Tailwind development workflow to the next level you can check out the pro version of Flowbite which includes fully coded pages and layouts for application, marketing, and e-commerce user interfaces.
Work with us #
If you’re ready to take your application to the next level you can work with us on your project with developers who have been using Flowbite and Tailwind CSS.
Learn Design Concepts #
If you want to create even better Flowbite pages, learn design fundamentals from Teach Me Design - Enhance UI, a book that covers color theory, typography, UI and UX so you can make the most to implement the Flowbite Ecosystem!
Tailwind CSS 4.0 #
If you want to upgrade to v4-beta of Tailwind CSS with Flowbite you have to follow the v4 upgrade guide.
- Install the next versions of Tailwind CSS and Flowbite using NPM:
npm install tailwindcss@next @tailwindcss/postcss@next flowbite@next
- Add the PostCSS plugin inside the
postcss.config.js
file:
export default {
plugins: {
'@tailwindcss/postcss': {},
},
};
- Remove the old directives in your main CSS file and import Tailwind:
@import "tailwindcss";
- Use the
@config
directive to import the old configuration file from your project:
/* add this to copy the configuration settings from your project */
@config "./../tailwind.config.js";
- Compile the source CSS file using NPX:
npx @tailwindcss/cli -i main.css -o styles.css
Now you should be good to go! Check the deprecated changes from v3 to learn more about the new features.
Tailwind CSS 3.0 #
We recommend using the current stable 3.x version of Tailwind CSS until v4.0 becomes the standard version.
Tailwind CSS 2.0 #
Flowbite works with the 2.x version of Tailwind CSS.
WindiCSS #
Flowbite also works with WindiCSS by including the plugin inside the windi.config.js
file:
plugins: [
require('flowbite/plugin-windicss')
],
React #
If you’re using React as a front-end library you can also use the components from Flowbite including the interactive ones such as the dropdowns, modals, and tooltips as long as you install Tailwind CSS and Flowbite in an existing project.
Learn how to install Tailwind CSS and Flowbite with React.
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 Flowbite 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 Flowbite with Next.js and React.
Vue.js #
The components from Flowbite can also be used any new or existing Vue 3 projects as long as you install Tailwind CSS and Flowbite.
Learn how to install Tailwind CSS and Flowbite with Vue.js.
Nuxt #
If you’re using Vue 3 as a front-end library and Nuxt as a framework you can also use the components from Flowbite Vue 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 Flowbite with Nuxt and Vue 3.
Laravel #
If you’re running a Laravel application you can easily set up Tailwind CSS and Flowbite and start developing user interfaces based on the utility-first classes and components.
Learn how to install Tailwind CSS and Flowbite with Laravel.
Svelte #
If you’re using a Svelte application you can install a standalone Flowbite Svelte library and start developing modern websites using the components from Flowbite and the utility classes from Tailwind CSS.
Learn how to install Tailwind CSS and Flowbite with Svelte.
Angular #
You can read our official guide to learn how to set up a new Angular project together with Tailwind CSS and Flowbite to start building advanced web applications with Google’s framework.
Learn how to install Tailwind CSS and Flowbite with Angular.
Ruby on Rails #
If you’re using a Ruby on Rails project you can install Tailwind CSS with Flowbite and start building web pages using the utility-first classes and the interactive UI compnonents from Flowbite.
Learn how to install Tailwind CSS and Flowbite with Ruby on Rails.
Django #
Check out the Django integration guide with Tailwind CSS and Flowbite to set up all technologies and start developing even faster using the UI components from Flowbite.
Learn how to install Tailwind CSS and Flowbite with Django.
Flask #
Check out the Flask integration guide with Tailwind CSS and Flowbite to set up all technologies and start developing with a micro framework combined with the UI components from Flowbite.
Learn how to install Tailwind CSS and Flowbite with Flask.
Licensing #
The library of components from Flowbite is open source under the MIT License.
Contributions #
Flowbite is an open source library under the MIT license and anyone who would like to contribute to the codebase or design is welcome to do so.
Please reach out to us via the official Github repository and the main development team will get in touch as soon as possible.
Discord community #
Feel free to join our community on Discord to receive help, contribute to the project, or just discuss about Flowbite, Tailwind CSS, and web development in general.
YouTube channel #
You can also subscribe to the official Flowbite YouTube channel to view tutorials on how you can use the Flowbite ecosystem to design and build websites.
Authors #
- Zoltán Szőgyényi (web developer)
- Robert Tanislav (web designer)