The most popular library of interactive components built with Tailwind CSS
npm install flowbite-test

Build websites even faster with components on top of Tailwind CSS
------
- Table of Contents
- Documentation
- Getting started
- Install using NPM
- Include via CDN
- Bundled JavaScript
- Data attributes
- Init functions
- ESM and CJS
- TypeScript
- RTL support
- JavaScript Frameworks
- Back-end Frameworks
- Components
- Figma Design System
- Flowbite Blocks
- Flowbite Icons
- Flowbite GPT
- Pro version
- Hire us
- Learn Design Concepts
- Community
- Copyright and license
For full documentation, visit flowbite.com.
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.
Make sure that you have Node.js and Tailwind CSS installed. This guide works with Tailwind v4.
1. Install Flowbite as a dependency using NPM by running the following command:
```
npm install flowbite
2. Import the default theme variables from Flowbite inside your main input.css CSS file:
`
/ choose one of the following /
@import "flowbite/src/themes/default";
/*
@import "flowbite/src/themes/minimal";
@import "flowbite/src/themes/enterprise";
@import "flowbite/src/themes/playful";
@import "flowbite/src/themes/mono";
*/
`
3. Import the Flowbite plugin file in your CSS:
``
@plugin "flowbite/plugin";
4. Configure the source files of Flowbite in your CSS:
``
@source "../node_modules/flowbite";
5. Include the JavaScript code that powers the interactive elements before the end of your
tag:`
`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.
$3
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:`html
`And include the following JavaScript file before the end of the
body element:`html
`Please remember that the best way to work with Tailwind CSS and Flowbite is by purging the CSS classes.
$3
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:`javascript
import 'flowbite';
`This file has access to all of the components and it automatically applies event listeners to the data attributes.
$3
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.`html
`#### 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:
`
// Modal HTML markup with data attributes from Flowbite
`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.
$3
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:
`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.
$3
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:`javascript
import { Modal } from 'flowbite'
import type { ModalOptions, ModalInterface } from 'flowbite'// other code
`Generally speaking, all of the components have an interface definition that you can use whenever you create a new object to make sure that you're using the correct types of parameters and methods.
When creating a new modal you can set the
ModalInterface as the main type:`javascript
const modal: ModalInterface = new Modal($modalElement, modalOptions);
`Flowbite also supports type definitions for the options object so if you want to set the placement of the modal based on types, here's how you would do that:
`javascript
const modalOptions: ModalOptions = {
placement: 'top-right'
}const modal: ModalInterface = new Modal($modalElement, modalOptions);
`Learn more about Flowbite and TypeScript in the quickstart guide.
$3
All of the Flowbite UI components have native RTL support and you can easily set it up by using the
dir="rtl"` attribute on the HTML element. Read more about Flowbite and RTL support here.The awesome open-source community also built and currently maintains the following standalone libraries for React, Vue, Svelte, Angular and Qwik:
- π Flowbite React Library
- π Flowbite Vue Library
- πΈ Flowbite Svelte Library
- π Flowbite Angular Library
- πΏ Flowbite Qwik Library
We also wrote integration guides for the following front-end frameworks and libraries:
- π Flowbite with React guide
- π Flowbite with Next.js guide
- π Flowbite with Remix guide
- π Flowbite with Vue guide
- π Flowbite with Nuxt guide
- π Flowbite with Svelte guide
- π Flowbite with Astro guide
- π Flowbite with MeteorJS guide
- π Flowbite with Gatsby guide
- π Flowbite with SolidJS guide
- π Flowbite with Qwik guide
Flowbite has a great integration with most of the back-end frameworks because it relies on vanilla JavaScript:
- π Using Flowbite with Laravel
- πΌ Using Flowbite with Symfony
- π Using Flowbite with Ruby on Rails 7
- π Using Flowbite with Phoenix (Elixir)
- πΈ Using Flowbite with Django
- πΆ Using Flowbite with Flask
Flowbite is an open source collection of UI components built with the utility classes from Tailwind CSS that you can use as a starting point when coding user interfaces and websites.
If you need the Figma files for the components you can check out our website for more information:
π¨ Get access to the Figma design files
Check out Flowbite Blocks to get access to over 400+ website sections coded in Tailwind CSS and Flowbite:
π¦ Check out Flowbite Blocks
Start using over 450+ free and open-source collection of solid and outline SVG icons built for Tailwind CSS and with support for Figma and JSX (React):
π Check out the icons
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.
π€ Generate with Flowbite GPT
Get access to all premium features including the Figma design system, access to all Flowbite Block sections and a dashboard UI interface:
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.
πββοΈ Work with us
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!
If you need help or just want to discuss about the library join the community on Github:
β¨οΈ Discuss about Flowbite on GitHub
For casual chatting with others using the library:
π¬ Join the Flowbite Discord Server
Video tutorials and presentations using Flowbite:
π₯ Subscribe to our YouTube channel
The Flowbite name and logos are trademarks of Bergside Inc.
- π Read about the licensing terms
- π Brand guideline and trademark usage agreement