Flowbite

The most popular and open-source library of Tailwind CSS components

README

flowbite


Flowbite - Tailwind CSS components

Build websites even faster with components on top of Tailwind CSS

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.

1. Install Flowbite as a dependency using NPM by running the following command:

  1. ```bash
  2. npm install flowbite
  3. ```

2. Require Flowbite as a plugin inside the tailwind.config.js file:

  1. ```javascript
  2. module.exports = {

  3.     plugins: [
  4.         require('flowbite/plugin')
  5.     ]

  6. }
  7. ```

3. Make sure that you add the template path to the tailwind.config.js file:

  1. ```javascript
  2. module.exports = {

  3.     content: [
  4.         "./node_modules/flowbite/**/*.js"
  5.     ]

  6. }
  7. ```

4. Include the main JavaScript file to make interactive elements work:

  1. ```html
  2. <script src="../path/to/flowbite/dist/flowbite.js"></script>
  3. ```

Include via CDN


The quickest way to get started working with Flowbite is to simply include the CSS and JavaScript into your project via a CDN service such as UNPKG or CDNJS (content delivery networks).

Require the following minified stylesheet inside the head tag:

  1. ```html
  2. <link href="https://cdnjs.cloudflare.com/ajax/libs/flowbite/1.8.0/flowbite.min.css" rel="stylesheet" />
  3. ```

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

  1. ```html
  2. <script src="https://cdnjs.cloudflare.com/ajax/libs/flowbite/1.8.0/flowbite.min.js"></script>
  3. ```

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:

  1. ```javascript
  2. import 'flowbite';
  3. ```

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.

  1. ```html
  2. <button data-modal-target="defaultModal" data-modal-toggle="defaultModal" class="block text-white bg-blue-700 hover:bg-blue-800 focus:ring-4 focus:outline-none focus:ring-blue-300 font-medium rounded-lg text-sm px-5 py-2.5 text-center dark:bg-blue-600 dark:hover:bg-blue-700 dark:focus:ring-blue-800" type="button">
  3.   Toggle modal
  4. </button>
  5. !-- Main modal -->
  6. <div id="defaultModal" tabindex="-1" aria-hidden="true" class="fixed top-0 left-0 right-0 z-50 hidden w-full p-4 overflow-x-hidden overflow-y-auto md:inset-0 h-[calc(100%-1rem)] max-h-full">
  7.     <div class="relative w-full max-w-2xl max-h-full">
  8.         !-- Modal content -->
  9.         <div class="relative bg-white rounded-lg shadow dark:bg-gray-700">
  10.             !-- Modal header -->
  11.             <div class="flex items-start justify-between p-4 border-b rounded-t dark:border-gray-600">
  12.                 <h3 class="text-xl font-semibold text-gray-900 dark:text-white">
  13.                     Terms of Service
  14.                 </h3>
  15.                 <button type="button" class="text-gray-400 bg-transparent hover:bg-gray-200 hover:text-gray-900 rounded-lg text-sm p-1.5 ml-auto inline-flex items-center dark:hover:bg-gray-600 dark:hover:text-white" data-modal-hide="defaultModal">
  16.                     <svg aria-hidden="true" class="w-5 h-5" fill="currentColor" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" d="M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z" clip-rule="evenodd"></path></svg>
  17.                     <span class="sr-only">Close modal</span>
  18.                 </button>
  19.             </div>
  20.             !-- Modal body -->
  21.             <div class="p-6 space-y-6">
  22.                 <p class="text-base leading-relaxed text-gray-500 dark:text-gray-400">
  23.                     With less than a month to go before the European Union enacts new consumer privacy laws for its citizens, companies around the world are updating their terms of service agreements to comply.
  24.                 </p>
  25.                 <p class="text-base leading-relaxed text-gray-500 dark:text-gray-400">
  26.                     The European Union’s General Data Protection Regulation (G.D.P.R.) goes into effect on May 25 and is meant to ensure a common set of data rights in the European Union. It requires organizations to notify users as soon as possible of high-risk data breaches that could personally affect them.
  27.                 </p>
  28.             </div>
  29.             !-- Modal footer -->
  30.             <div class="flex items-center p-6 space-x-2 border-t border-gray-200 rounded-b dark:border-gray-600">
  31.                 <button data-modal-hide="defaultModal" type="button" class="text-white bg-blue-700 hover:bg-blue-800 focus:ring-4 focus:outline-none focus:ring-blue-300 font-medium rounded-lg text-sm px-5 py-2.5 text-center dark:bg-blue-600 dark:hover:bg-blue-700 dark:focus:ring-blue-800">I accept</button>
  32.                 <button data-modal-hide="defaultModal" type="button" class="text-gray-500 bg-white hover:bg-gray-100 focus:ring-4 focus:outline-none focus:ring-blue-300 rounded-lg border border-gray-200 text-sm font-medium px-5 py-2.5 hover:text-gray-900 focus:z-10 dark:bg-gray-700 dark:text-gray-300 dark:border-gray-500 dark:hover:text-white dark:hover:bg-gray-600 dark:focus:ring-gray-600">Decline</button>
  33.             </div>
  34.         </div>
  35.     </div>
  36. </div>
  37. ```

Figma Design System


If you need the Figma files for the components you can check out our website for more information:


Flowbite Blocks


Check out Flowbite Blocks to get access to over 330+ website sections coded in Tailwind CSS and Flowbite:


Flowbite Icons


Start using over 430+ free and open-source collection of solid and outline SVG icons built for Tailwind CSS and with support for Figma and JSX (React):


Pro version


Get access to all premium features including the Figma design system, access to all Flowbite Block sections and a dashboard UI interface:


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!


Community


If you need help or just want to discuss about the library join the community on Github:


For casual chatting with others using the library:


Video tutorials and presentations using Flowbite:


Copyright and license


The Flowbite name and logos are trademarks of Bergside Inc.