Build websites even faster with components on top of Tailwind CSS
Table of Contents
- Table of Contents
- Documentation
- Getting started
- Components
- Figma Design System
- Flowbite Blocks
- Flowbite Icons
- Flowbite GPT
- Pro version
- Hire us
- Learn Design Concepts
- Community
- Copyright and license
Documentation
For full documentation, visit flowbite.com.
Getting started
Flowbite can be included as a plugin into an existing Tailwind CSS project and it is supposed to help you build websites faster by having a set of web components to work with built with the utility classes from Tailwind CSS.
Install using NPM
Make sure that you have Node.js and Tailwind CSS installed. This guide works with Tailwind v4.
- Install Flowbite as a dependency using NPM by running the following command:
npm install flowbite
- Import the default theme variables from Flowbite inside your main
input.cssCSS file:
/* choose one of the following */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');
@import "flowbite/src/themes/default";
/* MINIMAL THEME
@import url('https://fonts.googleapis.com/css2?family=Open+Sans:ital,wght@0,300..800;1,300..800&display=swap');
@import "flowbite/src/themes/minimal";
*/
/* ENTERPRISE THEME
@import url('https://fonts.googleapis.com/css2?family=Shantell+Sans:ital,wght@0,300..800;1,300..800&display=swap');
@import "flowbite/src/themes/enterprise";
*/
/* PLAYFUL THEME
@import url('https://fonts.googleapis.com/css2?family=Google+Sans+Code:ital,wght@0,300..800;1,300..800&display=swap');
@import "flowbite/src/themes/playful";
*/
/* MONO THEME
@import "flowbite/src/themes/mono";
*/
- Import the Flowbite plugin file in your CSS:
@plugin "flowbite/plugin";
- Configure the source files of Flowbite in your CSS:
@source "../node_modules/flowbite";
- Include the JavaScript code that powers the interactive elements before the end of your `` tag:
<script src="../path/to/flowbite/dist/flowbite.min.js"></script>
Learn more about the Flowbite JavaScript API and functionalities in the JavaScript section.
If you have and old project with Tailwind CSS v3 then check out this guide to learn how to upgrade to v4.
Include using CDN
The quickest way to get started working with Flowbite is to include the CSS and JS into your project via CDN.
Require the following minified stylesheet inside the head tag:
<link href="https://cdn.jsdelivr.net/npm/flowbite@{{< current_version >}}/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@{{< current_version >}}/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.