Flowbite
repository·main·Indexed 11 days ago
https://github.com/themesberg/flowbiteAn open-source library of interactive UI components built on top of Tailwind CSS. Version 4.0.2 provides ready-to-use components for navigation, forms, feedback, and data display, supporting ESM, CJS, TypeScript, and RTL layouts. It offers a programmatic JavaScript API, data-attribute-driven interactivity, and integration with Tailwind CSS v4.
What's inside Flowbite
- Flowbite Pro is a premium version that includes access to the Figma design system, all Flowbite Block sections, and a dashboard UI interface. Details can be found at flowbite.com/pro.
Get started with Flowbite
mainFlowbite is a library of components built on top of Tailwind CSS designed to help build websites faster. You can integrate Flowbite into your project using NPM, via CDN, or by using bundled JavaScript. It supports ESM, CJS, TypeScript, RTL (Right-to-Left) layouts, and integrates with various JavaScript and back-end frameworks.Access Flowbite design assets and extensions
mainFlowbite provides several ecosystem extensions for designers and developers:
- Figma Design System: Access Figma files for components via the Flowbite Figma page.
- Flowbite Blocks: Access 400+ pre-coded website sections built with Tailwind CSS and Flowbite at flowbite.com/blocks.
- Flowbite Icons: Use 450+ free SVG icons (solid and outline) designed for Tailwind CSS, with support for Figma and JSX (React) at flowbite.com/icons.
- Flowbite GPT: Use a custom-trained ChatGPT model to generate website sections and pages based on Flowbite and Tailwind CSS resources via Flowbite GPT.
Explore Flowbite UI Components
mainFlowbite is an open-source collection of UI components built using Tailwind CSS utility classes. It provides a wide range of ready-to-use components for building user interfaces, including navigation, forms, layout elements, and interactive widgets.
Key component categories include:
- Navigation & Layout: Navbar, Breadcrumbs, Sidebar, Footer, Pagination, Bottom Navigation, Tabs, Accordion.
- Forms & Inputs: Input Fields, Select, Textarea, Checkbox, Radio, Toggle, Datepicker, Timepicker, Number Input, Phone Input, Floating Label, Search Input.
- Feedback & Overlays: Alerts, Badges, Modals, Toasts, Tooltips, Popovers, Spinners, Progress Bars, Skeleton.
- Data Display: Tables, Cards, Lists, Avatars, Timelines, Charts, DataTables, Gallery (Masonry).
- Interactive Widgets: Carousel, Dropdowns, Drawer (offcanvas), Speed Dial, Stepper, Chat Bubbles, QR Code, WYSIWYG Editor.
Blazor Starter Projects and Libraries
mainFor developers looking for a pre-configured environment, there are two main resources:
- Tailwind Blazor Starter: An open-source project containing a baseline setup of Blazor, .NET, Tailwind CSS, and Flowbite. GitHub Repository.
- Flowbite Blazor: An official UI library for Blazor and .NET currently being developed by the community to provide native Blazor components. GitHub Repository.
RTL support in Flowbite UI components
mainAll Flowbite UI components support RTL by default. When thedir="rtl"attribute is present on the<html>element, all components and documentation examples will render correctly in mirrored mode. This is achieved through the use of logical properties and Tailwind CSS RTL variants within the component source code.Configure chart legends
mainTo display legend indicators in your charts, set
legend: { show: true }within your ApexCharts options object. You can control the legend's position using theposition: {x}option inside thelegendobject to place it at the top or bottom of the chart.const options = { legend: { show: true, position: { x: 'top' } } };Identify the default color palette
mainFlowbite uses a default color palette based on Tailwind CSS color scales. When customizing or referencing colors in your configuration or code, you can access these color groups using specific keys. For example, the Gray palette is accessed viacolors.gray(orcolors.coolGraydepending on the specific implementation context), Red viacolors.red, and Yellow/Amber viacolors.amber. Each color group contains a scale from50to900(e.g.,bg-red-50,text-red-600).Customize component styles for dark mode
mainFlowbite components include built-in dark mode support using the
dark:{*}variant. To customize how a component looks in dark mode, apply specific dark mode utility classes. When thedarkclass is present on thehtmlelement, thedark:variants will override the default styles.<div class="bg-white dark:bg-gray-800"> <h1 class="text-gray-900 dark:text-white">Dark mode</h1> <p class="text-gray-600 dark:text-gray-300"> Lorem ipsum... </p> </div>How the Accordion component works
mainThe Accordion component is a collection of vertically collapsing header and body elements used to show or hide information. It relies on Tailwind CSS utility classes for styling and Flowbite's JavaScript for interactivity via
dataattributes.Core Configuration
To control the behavior of the accordion, use the
data-accordionattribute on the container element:data-accordion="collapse": Only one child element can be active (expanded) at a time. Expanding one will automatically collapse any other open element.data-accordion="open": Multiple elements can be kept open simultaneously.
Required Attributes for Interactivity
For each accordion item, you must link the header to its corresponding body:
data-accordion-target="{selector}": Set this on the header element (usually a<button>). The value must be the ID or class of the accordion body element.aria-expanded="{true|false}": Set this on the header to indicate the current state (active or inactive).aria-controls="{id}": Set this on the header to reference the ID of the body element it controls.aria-labelledby="{id}": Set this on the body element to reference the ID of the header that labels it.
<div data-accordion="collapse"> <h2 id="accordion-heading-1"> <button type="button" data-accordion-target="#accordion-body-1" aria-expanded="true" aria-controls="accordion-body-1" > <span>Title</span> </button> </h2> <div id="accordion-body-1" class="hidden" aria-labelledby="accordion-heading-1"> <div>Content</div> </div> </div>Interact with components using Data Attributes
mainThe preferred way to use Flowbite's interactive components is through HTML data attributes. This allows you to add functionality without writing custom JavaScript.
For example, to control a modal, use attributes like
data-modal-targetanddata-modal-{toggle|show|hide}on your trigger elements.Enable Right-to-Left (RTL) support
mainFlowbite components support RTL natively. To enable it, add the
dir="rtl"attribute to your HTML element (usually the<html>tag).<html dir="rtl"> ...</html>