# Flowbite React Full Documentation # Customize ## Colors # Colors - Flowbite React > Learn how to customize and override the default color system in Flowbite React, including base colors, semantic colors, and theme configuration for both Tailwind CSS v3 and v4 Flowbite React comes with a comprehensive color system that includes both base colors and semantic colors, along with additional theme configurations. This guide will show you how to use and customize these settings in your project. ## Default Theme Settings ### Background Images These background images are used for various UI components: ```js const backgroundImage = { "arrow-down-icon": "url('data:image/svg+xml,%3Csvg%20aria-hidden%3D%22true%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20fill%3D%22none%22%20viewBox%3D%220%200%2010%206%22%3E%3Cpath%20stroke%3D%22%236B7280%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%20stroke-width%3D%222%22%20d%3D%22m1%201%204%204%204-4%22%2F%3E%3C%2Fsvg%3E')", "check-icon": "url('data:image/svg+xml,%3Csvg%20aria-hidden%3D%27true%27%20xmlns%3D%27http://www.w3.org/2000/svg%27%20fill%3D%27none%27%20viewBox%3D%270%200%2016%2012%27%3E%3Cpath%20stroke%3D%27white%27%20stroke-linecap%3D%27round%27%20stroke-linejoin%3D%27round%27%20stroke-width%3D%273%27%20d%3D%27M1%205.917%205.724%2010.5%2015%201.5%27/%3E%3C/svg%3E')", "dash-icon": "url('data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20fill%3D%22none%22%20viewBox%3D%220%200%2016%2012%22%3E%3Cpath%20stroke%3D%22white%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%20stroke-width%3D%223%22%20d%3D%22M0.5%206h14%22%2F%3E%3C%2Fsvg%3E')", "dot-icon": "url('data:image/svg+xml,%3Csvg%20viewBox%3D%220%200%2016%2016%22%20fill%3D%22white%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Ccircle%20cx%3D%228%22%20cy%3D%228%22%20r%3D%223%22%2F%3E%3C%2Fsvg%3E')", }; ``` ### Box Shadows Additional box shadow utilities: ```js const boxShadow = { "sm-light": "0 2px 5px 0px rgba(255, 255, 255, 0.08)", }; ``` ### Color Map The complete set of colors with their full spectrum: ## Customizing Colors ### Tailwind CSS v3 For Tailwind CSS v3, you can customize colors by extending the theme in your `tailwind.config.js`: ```js /** @type {import('tailwindcss').Config} */ export default { theme: { extend: { colors: { // Override primary colors primary: { 50: "#F0F9FF", 100: "#E0F2FE", 200: "#BAE6FD", 300: "#7DD3FC", 400: "#38BDF8", 500: "#0EA5E9", 600: "#0284C7", 700: "#0369A1", 800: "#075985", 900: "#0C4A6E", }, }, }, }, }; ``` ### Tailwind CSS v4 Tailwind CSS v4 introduces a new color system based on CSS variables. To customize colors define your color variables in the base layer: ```css @import "tailwindcss"; @theme { --color-primary-50: #f0f9ff; --color-primary-100: #e0f2fe; --color-primary-200: #bae6fd; --color-primary-300: #7dd3fc; --color-primary-400: #38bdf8; --color-primary-500: #0ea5e9; --color-primary-600: #0284c7; --color-primary-700: #0369a1; --color-primary-800: #075985; --color-primary-900: #0c4a6e; } ``` --- ## Config # Configuration - Flowbite React > Learn how to configure Flowbite React using the config.json file to control component styles, automatic class generation, and more ## Configuration File The `.flowbite-react/config.json` file is a central configuration file that controls how Flowbite React generates and manages component styles. This guide explains its structure, features, and how it affects your application's behavior. ### Schema The configuration file follows this JSON Schema: ```json { "$schema": "http://json-schema.org/draft-07/schema#", "type": "object", "properties": { "components": { "description": "List of component names to generate styles for. Empty array enables automatic detection.", "type": "array", "items": { "type": "string", "enum": [ "*" // ...rest of the components ] }, "uniqueItems": true }, "dark": { "description": "Whether to generate dark mode styles", "type": "boolean", "default": true }, "path": { "description": "Path where components will be created, relative to the project root", "type": "string", "default": "src/components" }, "prefix": { "description": "Optional prefix to apply to all Tailwind CSS classes", "type": "string", "default": "" }, "rsc": { "description": "Whether to include the 'use client' directive for React Server Components", "type": "boolean", "default": true }, "tsx": { "description": "Whether to use TypeScript (.tsx) or JavaScript (.jsx) for component creation", "type": "boolean", "default": true }, "version": { "description": "The version of Tailwind CSS to use", "type": "number", "enum": [3, 4], "default": 4 } }, "required": ["components", "dark", "path", "prefix", "rsc", "tsx", "version"] } ``` ### Properties #### `components` - Type: `string[]` - Default: `[]` - Description: List of component names to generate Tailwind CSS classes for. - When empty (`[]`), enables automatic component detection - When populated, disables automatic detection and only generates styles for listed components - Use `"*"` to explicitly include all components (equivalent to listing every component) - When not using `"*"`, use valid component names (e.g., `Button`, `Card`, `Modal`). See the [schema](https://unpkg.com/flowbite-react/schema.json) for the full list of valid components. #### `dark` - Type: `boolean` - Default: `true` - Description: Whether to generate dark mode styles. #### `path` - Type: `string` - Default: `"src/components"` - Description: Path where components will be created, relative to the project root. Used by the CLI when creating new components. #### `prefix` - Type: `string` - Default: `""` - Description: Optional prefix to apply to all Tailwind CSS classes. Useful for avoiding class name conflicts. For detailed instructions on configuring and using prefixes, see the [Prefix](https://flowbite-react.com/docs/customize/prefix.md) documentation. #### `rsc` - Type: `boolean` - Default: `true` - Description: Whether to include the 'use client' directive for React Server Components. When set to `true`, the "use client" directive will be added at the top of created component files. #### `tsx` - Type: `boolean` - Default: `true` - Description: Whether to use TypeScript (.tsx) or JavaScript (.jsx) for component creation. When set to `false`, components will be created with .jsx extension. #### `version` - Type: `number` - Options: `3`, `4` - Default: `4` - Description: The version of Tailwind CSS to use. ## Automatic Class Generation The automatic class generation system works in two modes: ### 1. Automatic Mode (Default) When `components` array is empty: - Automatically scans your codebase for Flowbite React component imports - Generates styles for all detected components and their dependencies - Updates in real-time as you add/remove component imports - Watches for file changes during development Example config for automatic mode: ```json { "$schema": "https://unpkg.com/flowbite-react/schema.json", "components": [], "dark": true, "path": "src/components", "prefix": "", "rsc": true, "tsx": true, "version": 4 } ``` ### 2. Manual Mode When `components` array contains component names: - Disables automatic component detection - Only generates styles for explicitly listed components - Includes styles for component dependencies automatically - Shows warning: "Components specified in config.json. Automatic class generation is disabled." Example config for manual mode: ```json { "$schema": "https://unpkg.com/flowbite-react/schema.json", "components": ["Button", "Card", "Modal"], "dark": true, "path": "src/components", "prefix": "", "rsc": true, "tsx": true, "version": 4 } ``` ## Component Creation The CLI uses the configuration file to determine how to create new components: ```bash npx flowbite-react@latest create my-component ``` The component creation process is affected by these configuration options: - `path`: Determines where the component will be created - `rsc`: Determines whether to include the "use client" directive - `tsx`: Determines whether to use TypeScript (.tsx) or JavaScript (.jsx) For more information on creating custom components, see the [Custom Components](https://flowbite-react.com/docs/customize/custom-components.md) documentation. ## Build Process The build process handles style generation differently based on your configuration: ### Development (`flowbite-react dev`) 1. Reads the `config.json` file 2. If `components` is empty: - Watches for component imports across your codebase - Updates class list in real-time as components are added/removed - Generates styles for all detected components 3. If `components` has entries: - Generates styles only for listed components - Does not watch for new component imports - Shows warning about disabled automatic generation ### Production (`flowbite-react build`) 1. Creates the `.flowbite-react` output directory if needed 2. Generates the final `class-list.json` containing: - All required Tailwind CSS classes - Classes for component dependencies - Prefixed classes if prefix is specified 3. Optimizes the class list by: - Removing duplicates - Sorting for consistency - Converting utilities to match your Tailwind version ## Component Dependencies When generating styles, the system automatically includes dependencies: - Each component may depend on other components - Dependencies are defined in the `DEPENDENCY_LIST_MAP` - When a component is included (either automatically or manually), all its dependencies are also included - This ensures all necessary styles are available ## Best Practices **1. Start with Automatic Mode** - Leave `components` empty initially - Let the system detect your usage - Switch to manual mode if you need precise control **2. Use Manual Mode When** - You need to strictly control bundle size - You want to ensure specific components are included - You have complex dependency requirements **3. Prefix Considerations** - Use prefixes when integrating with other libraries - Keep prefixes short but meaningful - Consider your Tailwind version when choosing prefix format **4. Component Creation Settings** - Use `path` to organize components in your project structure - Set `rsc` to `false` if you're not using React Server Components - Set `tsx` to `false` if your project uses JavaScript instead of TypeScript --- ## Custom Components # Creating Custom Components - Flowbite React > Learn how to create your own themeable components using the Flowbite React theming system The Flowbite React theming system can be used to create your own themeable components. The system provides powerful utilities from `resolve-theme.ts` that handle theme resolution, merging, and inheritance. ## Using the CLI The easiest way to create a new custom component is to use the Flowbite React CLI: ```bash npx flowbite-react@latest create my-component ``` This will generate a new component with the proper structure and theming setup. The CLI uses the configuration from `.flowbite-react/config.json` to determine: 1. Where to create the component (`path`) 2. Whether to include the `"use client"` directive (`rsc`) 3. Whether to use TypeScript or JavaScript (`tsx`) You can customize these options in your config file `.flowbite-react/config.json`: ```json { "$schema": "https://unpkg.com/flowbite-react/schema.json", "components": [], "dark": true, "path": "src/components", "prefix": "", "rsc": true, "tsx": true, "version": 4 } ``` ## Component Blueprint Here's a minimal blueprint for creating Flowbite React components: ```tsx "use client"; import { createTheme } from "flowbite-react/helpers/create-theme"; import { get } from "flowbite-react/helpers/get"; import { resolveProps } from "flowbite-react/helpers/resolve-props"; import { useResolveTheme } from "flowbite-react/helpers/resolve-theme"; import { twMerge } from "flowbite-react/helpers/tailwind-merge"; import { useThemeProvider } from "flowbite-react/theme/provider"; import type { ThemingProps } from "flowbite-react/types"; import { forwardRef, type ComponentProps } from "react"; // 1. Extend the FlowbiteTheme and FlowbiteProps interfaces declare module "flowbite-react/types" { interface FlowbiteTheme { myComponent: MyComponentTheme; } interface FlowbiteProps { myComponent: Partial>; } } // 2. Theme structure export interface MyComponentTheme { base: string; color: MyComponentColors; } export interface MyComponentColors { info: string; success: string; error: string; } // 3. Default theme export const myComponentTheme = createTheme({ base: "flex items-center font-medium", color: { info: "text-blue-600", success: "text-green-600", error: "text-red-600", }, }); // 4. Props export interface MyComponentProps extends ComponentProps<"div">, ThemingProps { color?: keyof MyComponentColors; } // 5. Component export const MyComponent = forwardRef((props, ref) => { // Get theme from provider const provider = useThemeProvider(); // Resolve theme with proper inheritance const theme = useResolveTheme( [myComponentTheme, provider.theme?.myComponent, props.theme], [get(provider.clearTheme, "myComponent"), props.clearTheme], [get(provider.applyTheme, "myComponent"), props.applyTheme], ); // Resolve props with provider const { children, color = "info", className, ...restProps } = resolveProps(props, provider.props?.myComponent); return (
{children}
); }); MyComponent.displayName = "MyComponent"; ``` ## Using the Component ```tsx import { createTheme, ThemeProvider } from "flowbite-react"; import { MyComponent } from "./MyComponent"; // Custom theme const theme = createTheme({ myComponent: { base: "flex items-center gap-2 rounded-lg p-2", color: { info: "bg-blue-100 text-blue-800", success: "bg-green-100 text-green-800", error: "bg-red-100 text-red-800", }, }, }); function App() { return ( {/* Basic usage */} Default Component {/* With color */} Success Component {/* With theme override */} Custom Theme {/* With theme clearing */} Default Color Theme {/* With theme application control */} Merged Styles ); } ``` ## Component Features The component automatically supports: - Global theme inheritance - Component-level overrides - Provider-level props - Theme clearing and applying - Type safety ## Understanding the Blueprint Let's break down the key parts of the component blueprint: ### 1. Extend the FlowbiteTheme interface ```tsx declare module "flowbite-react/types" { interface FlowbiteTheme { myComponent: MyComponentTheme; } } ``` This is necessary to enable TypeScript type inference for your component's theme. ### 2. Theme Structure ```tsx export interface MyComponentTheme { base: string; color: MyComponentColors; } ``` This interface defines the structure of your component's theme. It should include all the customizable style aspects of your component. ### 3. Default Theme ```tsx const myComponentTheme = createTheme({ base: "flex items-center font-medium", color: { info: "text-blue-600", success: "text-green-600", error: "text-red-600", }, }); ``` The default theme provides the base styling for your component when no custom theme is applied. Using `createTheme` ensures type safety and enables Tailwind CSS IntelliSense. ### 4. Props Interface ```tsx export interface MyComponentProps extends ComponentProps<"div">, ThemingProps { color?: keyof MyComponentColors; } ``` The props interface extends: - `ComponentProps<"div">` - All standard HTML div props - `ThemingProps` - Theme-related props (`theme`, `clearTheme`, `applyTheme`) - Custom props specific to your component ### 5. Theme Resolution ```tsx const theme = useResolveTheme( [myComponentTheme, provider.theme?.myComponent, props.theme], [get(provider.clearTheme, "myComponent"), props.clearTheme], [get(provider.applyTheme, "myComponent"), props.applyTheme], ); ``` The `useResolveTheme` hook handles the complex logic of: - Merging themes from different sources - Applying theme clearing - Controlling how themes are merged or replaced ### 6. Props Resolution ```tsx const { children, color = "info", className, ...restProps } = resolveProps(props, provider.props?.myComponent); ``` The `resolveProps` helper merges component-specific props with provider-level props, with component props taking precedence. ## Advanced Component Patterns ### Compound Components For more complex components with multiple parts, you can create separate theme structures for each part: ```tsx export interface CardTheme { root: { base: string; children: string; }; img: { base: string; horizontal: string; }; header: { base: string; }; footer: { base: string; }; } ``` ### State-Based Styling For components with different states, include state variations in your theme: ```tsx export interface ButtonTheme { base: string; color: Record; disabled: string; loading: string; } ``` ### Responsive Components For responsive components, include different size variations: ```tsx export interface ModalTheme { base: string; show: { on: string; off: string; }; sizes: { sm: string; md: string; lg: string; xl: string; "2xl": string; "3xl": string; "4xl": string; "5xl": string; "6xl": string; "7xl": string; }; } ``` ## Best Practices 1. **Keep Theme Structures Flat**: Avoid deeply nested theme structures when possible 2. **Use Descriptive Names**: Name theme properties clearly to make customization intuitive 3. **Provide Sensible Defaults**: Default themes should work well without customization 4. **Document Theme Structure**: Include comments or documentation for complex theme properties 5. **Use Type Safety**: Always use TypeScript interfaces for theme structures 6. **Test with Different Themes**: Ensure your component works with various theme configurations By following these patterns, you can create flexible, themeable components that integrate seamlessly with the Flowbite React theming system. --- ## Dark Mode # Dark Mode - Flowbite React > Learn how to implement and customize dark mode in your React application using Flowbite and Tailwind CSS. Includes step-by-step instructions for theme switching, SSR support, and framework-specific integrations. ## Overview Flowbite React provides built-in dark mode functionality that seamlessly integrates with popular full-stack frameworks like Next.js, Remix, Astro, and Gatsby. The dark mode implementation fully supports server-side rendering (SSR) and offers an intuitive developer experience. ## Dark Mode Toggle The easiest way to implement dark mode in your application is by using the `DarkThemeToggle` component. This component automatically handles theme detection and provides a user-friendly interface for switching between light and dark modes. ```jsx import { DarkThemeToggle } from "flowbite-react"; export default function MyPage() { return ( // ... ); } ``` ## Theme Mode Hook For more granular control over theme management, Flowbite React provides the `useThemeMode` hook. This powerful hook handles: - Theme state management - Automatic theme detection - Theme persistence in LocalStorage - Cross-tab theme synchronization ### Hook API ```tsx type ThemeMode = "light" | "dark" | "auto"; declare const useThemeMode: () => { mode: ThemeMode; computedMode: ThemeMode; // "light" | "dark" setMode: (mode: ThemeMode) => void; toggleMode: () => void; clearMode: () => void; }; ``` ### Features 1. **Automatic Theme Persistence**: Your users' theme preferences are automatically saved in the browser's LocalStorage 2. **Cross-Tab Synchronization**: Theme changes are instantly synchronized across all open browser tabs 3. **No Additional Configuration**: All features work out of the box ## Disabling Dark Mode To completely disable dark mode class generation in your Flowbite React application, you should use both of the following methods: ### 1. Using the Configuration File First, disable dark mode in your build configuration by setting the `dark` property to `false` in your `.flowbite-react/config.json` file: ```json {4} { "$schema": "https://unpkg.com/flowbite-react/schema.json", "components": [], "dark": false, "path": "src/components", "prefix": "", "rsc": true, "tsx": true, "version": 4 } ``` This method prevents dark mode classes from being generated during the build process, which reduces your CSS bundle size. ### 2. Using the ThemeInit Component When you have custom configuration in your `.flowbite-react/config.json` (including disabling dark mode), you must render the `ThemeInit` component at the root level of your application to sync the runtime with your configuration: ```jsx // src/App.tsx import { ThemeInit } from "../.flowbite-react/init"; function App() { return ( <> {/* Your application */} ); } ``` > **Important**: The configuration file approach affects build-time class generation, while the ThemeInit component ensures your runtime behavior matches your configuration. ## Framework Integration For detailed, framework-specific implementation instructions, refer to our comprehensive integration guides: - [AdonisJS Dark Mode](https://flowbite-react.com/docs/guides/adonisjs#dark-mode.md) - [Astro Dark Mode](https://flowbite-react.com/docs/guides/astro#dark-mode.md) - [Gatsby Dark Mode](https://flowbite-react.com/docs/guides/gatsby#dark-mode.md) - [Next.js Dark Mode](https://flowbite-react.com/docs/guides/nextjs#dark-mode.md) - [Remix Dark Mode](https://flowbite-react.com/docs/guides/remix#dark-mode.md) --- ## Prefix # Prefix - Flowbite React > Learn how you can change the Tailwind CSS classes prefix used by the components in Flowbite React By following these steps, you can easily customize the Tailwind CSS prefix in your Flowbite React project, ensuring better compatibility with other CSS frameworks and avoiding class name conflicts. ## Setting the Prefix ### Flowbite React Configuration To set a custom prefix for Flowbite React components, modify the `prefix` property in your `.flowbite-react/config.json` file: ```json {6} { "$schema": "https://unpkg.com/flowbite-react/schema.json", "components": [], "dark": true, "path": "components", "prefix": "tw", "rsc": true, "tsx": true, "version": 4 } ``` ### Tailwind CSS Configuration You must also configure the prefix in your Tailwind CSS setup. The configuration syntax differs between Tailwind CSS versions: #### Tailwind CSS v3 In Tailwind CSS v3, you can use any prefix including special characters: ```js /** @type {import('tailwindcss').Config} */ export default { prefix: "tw-", // ... rest of your config }; ``` #### Tailwind CSS v4 In Tailwind CSS v4, the prefix cannot contain special characters (like hyphens). Use simple strings like `tw` instead of `tw-`: ```css @import "tailwindcss" prefix(tw); ``` ## Update Your React Application When you have custom configuration in your `.flowbite-react/config.json` (including a custom prefix), you must render the `ThemeInit` component at the root level of your application to sync the runtime with your configuration: ```tsx // src/App.tsx import { ThemeInit } from "../.flowbite-react/init"; export default function App() { return ( <> {/* Your application */} ); } ``` This configuration will ensure that all Flowbite React components use the specified prefix for their Tailwind CSS classes. The prefix will be automatically applied to all component classes. --- ## Theme (updated) # Theme - Flowbite React > Learn how to customize the appearance of Flowbite React components using the theming system Flowbite React provides a flexible theming system that allows you to customize the appearance of components. The system is built on top of Tailwind CSS and supports multiple levels of customization. ## Component-Level Customization The simplest way to customize a component is by using the `className` prop, which allows you to override or extend the default styles: ```tsx import { Button } from "flowbite-react"; function App() { return ; } ``` ## Theme Provider For application-wide customization, use the `ThemeProvider` component. The `createTheme` helper provides TypeScript and Tailwind CSS IntelliSense support: ```tsx import { Button, createTheme, ThemeProvider } from "flowbite-react"; const customTheme = createTheme({ button: { color: { primary: "bg-red-500 hover:bg-red-600", secondary: "bg-blue-500 hover:bg-blue-600", }, size: { lg: "px-6 py-3 text-lg", }, }, }); function App() { return ( ); } ``` ## Theme Resolution and Inheritance The theming system follows this resolution order: 1. Component-specific `clearTheme` prop 2. Component-specific `theme` prop 3. Nearest parent `ThemeProvider` theme 4. Default component theme When using nested `ThemeProvider` components, the following rules apply: Unless `root={true}` is specified: - Child providers inherit and merge all theme values from their parent - They only override the specific values they define - Parent values for undefined properties are preserved When `root={true}` is specified: - The theme provider ignores all parent theme values - No merging occurs with parent themes - Only the specified theme and default theme values are used - This affects all theme-related props (`theme`, `clearTheme`, `applyTheme`) and component props ## Nested Themes ```tsx import { Button, createTheme, ThemeProvider } from "flowbite-react"; const mainTheme = createTheme({ button: { color: { primary: "bg-blue-500 hover:bg-blue-600", }, size: { lg: "px-6 py-3", }, }, }); const sectionTheme = createTheme({ button: { color: { primary: "bg-green-500 hover:bg-green-600", // size.lg from mainTheme is preserved }, }, }); function App() { return ( {/* Inherits size.lg from mainTheme */} ); } ``` ### Preventing Theme Inheritance ```tsx import { Button, createTheme, ThemeProvider } from "flowbite-react"; const mainTheme = createTheme({ button: { color: { primary: "bg-blue-500 hover:bg-blue-600", }, size: { lg: "px-6 py-3", }, }, }); const isolatedTheme = createTheme({ button: { color: { primary: "bg-green-500 hover:bg-green-600", }, // No size definitions }, }); function App() { return ( {/* root={true} prevents merging with mainTheme */} ); } ``` ### Theme Merging Strategy The theme system uses the following merging strategy: 1. **Props Merging**: Component props from parent and child `ThemeProvider`s are deep merged 2. **Theme Merging**: Theme values are merged using [tailwind-merge](https://www.npmjs.com/package/tailwind-merge) for intelligent Tailwind CSS class handling 3. **Clear Theme Merging**: `clearTheme` values are deep merged between providers 4. **Apply Theme Merging**: `applyTheme` configurations are deep merged between providers The use of `tailwind-merge` ensures: - Automatic conflict resolution between Tailwind CSS classes - Support for both Tailwind CSS v3 and v4 (automatically detected) - Proper handling of complex class combinations - Efficient merging without duplicate utilities For example: ```tsx import { Button, createTheme, ThemeProvider } from "flowbite-react"; const baseTheme = createTheme({ button: { base: "rounded-lg shadow-md", color: { primary: "bg-blue-500 text-white", }, }, }); const customTheme = createTheme({ button: { base: "border-2", color: { primary: "bg-red-500", }, }, }); function App() { return ( {/* Merges themes: rounded-lg shadow-md border-2 */} {/* Replaces base completely: only border-2 remains */} {/* Replaces color completely: loses text-white */} ); } ``` ## Theme Modification Tools The combination of `theme`, `clearTheme`, and `applyTheme` props provides granular control over component styling. Here are examples showing different levels of customization: ### Component Level Control ```tsx import { Card, createTheme } from "flowbite-react"; const cardTheme = createTheme({ card: { root: { base: "rounded-xl bg-white shadow-md", children: "space-y-4 p-6", }, img: { base: "rounded-t-xl", horizontal: "h-full w-full rounded-l-xl", }, }, }); function App() { return ( <> {/* Basic theme override */} Basic Theme Override {/* Clear specific nested properties */} Selective Clearing {/* Control how new styles are applied */} Controlled Style Application {/* Combining all three props */} Complex Style Control ); } ``` ### Nested Component Control ```tsx import { createTheme, Navbar, NavbarCollapse, NavbarLink, ThemeProvider } from "flowbite-react"; const navTheme = createTheme({ navbar: { root: { base: "bg-white shadow-lg", }, collapse: { base: "w-full md:block md:w-auto", list: "mt-4 flex flex-col md:mt-0 md:flex-row md:space-x-8", }, link: { base: "block px-3 py-2", active: { on: "text-blue-600", off: "text-gray-900", }, }, }, }); function App() { return ( {/* Control collapse styles */} {/* Control individual link styles */} Custom Link ); } ``` ### Form Components Control ```tsx import { createTheme, Label, TextInput } from "flowbite-react"; const formTheme = createTheme({ label: { root: { base: "text-sm font-medium", disabled: "opacity-50", colors: { default: "text-gray-900", error: "text-red-700", }, }, }, textInput: { base: "block w-full", field: { base: "rounded-lg border", input: { base: "px-3 py-2", sizes: { sm: "text-sm", md: "text-base", }, colors: { gray: "border-gray-300 bg-gray-50", error: "border-red-500 bg-red-50", }, }, }, }, }); function App() { return (
{/* Label with error state */} {/* Input with custom styling */} {/* Combining multiple controls */} ); } ``` These examples demonstrate how to: - Use nested theme properties for precise control - Clear specific style categories while preserving others - Control how new styles are merged or replaced - Combine multiple theme controls for complex customization - Handle component-specific theme variations - Manage state-dependent styles (active, disabled, etc.) ## Clearing Theme Values The `clearTheme` prop allows you to selectively or completely remove theme values, reverting them to their default styles. When a theme value is cleared, it's set to an empty string. ### Basic Usage ```tsx import { Button, createTheme, ThemeProvider } from "flowbite-react"; const theme = createTheme({ button: { color: { primary: "bg-red-500 hover:bg-red-600", }, base: "rounded-lg", }, }); function App() { return ( {/* Clear specific theme property */} {/* Clear all button theme values */} ); } ``` ### Selective Clearing You can clear specific nested properties while keeping others: ```tsx import { Card, createTheme, ThemeProvider } from "flowbite-react"; const theme = createTheme({ card: { root: { base: "rounded-xl shadow-lg", children: "space-y-4 p-6", }, }, }); function App() { return ( Regular Card {/* Keeps rounded-xl and shadow-lg, but clears padding and spacing */} ); } ``` ## Applying Theme Values The `applyTheme` prop provides fine-grained control over how theme values are merged. It supports two modes: - `"merge"` (default): Combines the new theme values with existing ones - `"replace"`: Completely replaces existing theme values ### Merging vs Replacing ```tsx import { Button, createTheme, ThemeProvider } from "flowbite-react"; const baseTheme = createTheme({ button: { base: "rounded-lg shadow-md", color: { primary: "bg-blue-500 text-white", }, }, }); const customTheme = createTheme({ button: { base: "border-2", color: { primary: "bg-red-500", }, }, }); function App() { return ( {/* Merges themes: rounded-lg shadow-md border-2 */} {/* Replaces base completely: only border-2 remains */} {/* Replaces color completely: loses text-white */} ); } ``` ### Inheritance Control The `applyTheme` prop is particularly useful when working with nested components: ```tsx import { createTheme, Navbar, NavbarCollapse, NavbarLink, ThemeProvider } from "flowbite-react"; const theme = createTheme({ navbar: { root: { base: "bg-white shadow-lg", }, collapse: { base: "w-full md:block md:w-auto", list: "mt-4 flex flex-col md:mt-0 md:flex-row md:space-x-8", }, }, }); function App() { return ( Custom Layout ); } ``` ### Theme Resolution Order When both `clearTheme` and `applyTheme` are used, the resolution follows this order: 1. Apply `clearTheme` to remove specified values 2. Apply component-specific `theme` prop 3. Apply `applyTheme` rules to control how new values are merged 4. Inherit from parent `ThemeProvider` (unless `root={true}`) 5. Fall back to default component theme This system provides complete control over theme inheritance and application while maintaining a predictable behavior. ## Provider-Level Props The `ThemeProvider` component accepts a `props` prop that allows you to set default props for all components within its scope. These props are merged with any component-specific props, with component props taking precedence: ```tsx import { Button, ThemeProvider } from "flowbite-react"; function App() { return ( {/* Will be large and green */} {/* Will be large and red (color prop overrides provider) */} {/* Nested providers merge props by default */} {/* Will be small and green */} {/* root={true} prevents props inheritance */} {/* Will be small with default color */} ); } ``` Props are resolved in the following order: 1. Component-specific props 2. Nearest parent `ThemeProvider` props 3. Default component props Like themes, provider props are deep merged between parent and child providers unless `root={true}` is specified. ## Component-Specific Theme You can also apply a custom theme to a specific component instance using the `theme` prop: ```tsx import { Button, createTheme } from "flowbite-react"; const buttonTheme = createTheme({ button: { color: { custom: "bg-purple-500 text-white hover:bg-purple-600", }, }, }).button; function App() { return ( ); } ``` ## Type Safety and IntelliSense The `createTheme` helper ensures type safety and enables Tailwind CSS IntelliSense in your IDE: ```tsx import { createTheme } from "flowbite-react"; // Full theme customization const theme = createTheme({ button: { color: { primary: "bg-blue-500 hover:bg-blue-600", // ✓ Tailwind CSS IntelliSense custom: 123, // ✗ Type error: expected string }, }, }); // Single component theme const buttonTheme = createTheme({ button: { size: { xl: "px-8 py-4 text-xl", // ✓ Tailwind CSS IntelliSense }, }, }).button; ``` This helps catch errors early and provides better development experience with auto-completion for Tailwind CSS classes. For information on how to create your own themeable components that work with this system, see the [Creating Custom Components](https://flowbite-react.com/docs/customize/custom-components.md) guide. --- # Components ## Accordion # React Accordion - Flowbite > Use the accordion component and its options to expand and collapse the content inside each panel based on state reactivity from React and Tailwind CSS The accordion component from Flowbite React can be used to toggle the visibility of the content of each accordion panel tab by expanding the collapsing the trigger element based on multiple examples and styles. The reactivity and state is handled by React and the components is built using the Tailwind CSS framework meaning that you can easily customize the styles and colors of the accordion. To use the accordion component, you need to import the `` component from `flowbite-react`: ```jsx import { Accordion } from "flowbite-react"; ``` ## Default accordion Use this example of the `` component and the `` and `` subcomponents to create an accordion with multiple panels. ```tsx // index.tsx import { Accordion, AccordionContent, AccordionPanel, AccordionTitle } from "flowbite-react"; export function Component() { return ( What is Flowbite?

Flowbite is an open-source library of interactive components built on top of Tailwind CSS including buttons, dropdowns, modals, navbars, and more.

Check out this guide to learn how to  get started  and start developing websites even faster with components on top of Tailwind CSS.

Is there a Figma file available?

Flowbite is first conceptualized and designed using the Figma software so everything you see in the library has a design equivalent in our Figma file.

Check out the Figma design system based on the utility classes from Tailwind CSS and components from Flowbite.

What are the differences between Flowbite and Tailwind UI?

The main difference is that the core components from Flowbite are open source under the MIT license, whereas Tailwind UI is a paid product. Another difference is that Flowbite relies on smaller and standalone components, whereas Tailwind UI offers sections of pages.

However, we actually recommend using both Flowbite, Flowbite Pro, and even Tailwind UI as there is no technical reason stopping you from using the best of two worlds.

Learn more about these technologies:

); } ``` ## Collapse all Use this example to automatically collapse all of the accordion panels by passing the `collapseAll` prop to the `` component. ```tsx // index.tsx import { Accordion, AccordionContent, AccordionPanel, AccordionTitle } from "flowbite-react"; export function Component() { return ( What is Flowbite?

Flowbite is an open-source library of interactive components built on top of Tailwind CSS including buttons, dropdowns, modals, navbars, and more.

Check out this guide to learn how to  get started  and start developing websites even faster with components on top of Tailwind CSS.

Is there a Figma file available?

Flowbite is first conceptualized and designed using the Figma software so everything you see in the library has a design equivalent in our Figma file.

Check out the Figma design system based on the utility classes from Tailwind CSS and components from Flowbite.

What are the differences between Flowbite and Tailwind UI?

The main difference is that the core components from Flowbite are open source under the MIT license, whereas Tailwind UI is a paid product. Another difference is that Flowbite relies on smaller and standalone components, whereas Tailwind UI offers sections of pages.

However, we actually recommend using both Flowbite, Flowbite Pro, and even Tailwind UI as there is no technical reason stopping you from using the best of two worlds.

Learn more about these technologies:

); } ``` ## Theme To learn more about how to customize the appearance of components, please see the [Theme docs](https://flowbite-react.com/docs/customize/theme.md). ```json { "root": { "base": "divide-y divide-gray-200 border-gray-200 dark:divide-gray-700 dark:border-gray-700", "flush": { "off": "rounded-lg border", "on": "border-b" } }, "content": { "base": "p-5 first:rounded-t-lg last:rounded-b-lg dark:bg-gray-900" }, "title": { "arrow": { "base": "h-6 w-6 shrink-0", "open": { "off": "", "on": "rotate-180" } }, "base": "flex w-full items-center justify-between p-5 text-left font-medium text-gray-500 first:rounded-t-lg last:rounded-b-lg dark:text-gray-400", "flush": { "off": "hover:bg-gray-100 focus:ring-4 focus:ring-gray-200 dark:hover:bg-gray-800 dark:focus:ring-gray-800", "on": "bg-transparent dark:bg-transparent" }, "heading": "", "open": { "off": "", "on": "bg-gray-100 text-gray-900 dark:bg-gray-800 dark:text-white" } } } ``` ## References - [Flowbite Accordion](https://flowbite.com/docs/components/accordion/) --- ## Alert # React Alert - Flowbite > Get started with the alert component to show contextual information to the user such as when validating forms or showing errors based on React and Tailwind CSS The alert component can be used to show a contextual text to the user such as a success or error message after form validation inside an alert box where you can choose from multiple colors, sizes, and styles. The examples below are styled with Tailwind CSS and the reactivity is handled by React and you can also add any type of content inside the alert box. To start using the alert box you need to import the `` component from the `flowbite-react` package: ```jsx import { Alert } from "flowbite-react"; ``` ## Default alert The default alert component is a simple alert box with a text inside it and you can use the `color` prop to change the color of the alert box and the `title` prop to add a title to the alert box. Inside of the `` component you can add any type of content such as text, images, or other components as they will be considered children of the alert box. ```tsx // index.tsx import { Alert } from "flowbite-react"; export function Component() { return ( Info alert! Change a few things up and try submitting again. ); } ``` ## Alert with icon Use the `icon` prop to add an icon to the alert box and you can use any icon from the [React Icons](https://react-icons.github.io/react-icons/) library. ```tsx // index.tsx "use client"; import { Alert } from "flowbite-react"; import { HiInformationCircle } from "react-icons/hi"; export function Component() { return ( Info alert! Change a few things up and try submitting again. ); } ``` ## Dismissible alert You can use the `onDismiss` prop on the `` component to add a dismiss button to the alert box by adding a function inside of it that will be called when the user clicks on the dismiss button. ```tsx // index.tsx "use client"; import { Alert } from "flowbite-react"; export function Component() { return ( alert('Alert dismissed!')}> Info alert! Change a few things up and try submitting again. ); } ``` ## Rounded alert To make the alert box rounded you can use the `rounded` prop on the `` component. ```tsx // index.tsx import { Alert } from "flowbite-react"; export function Component() { return ( Info alert! Change a few things up and try submitting again. ); } ``` ## Border accent Add a border accent to the alert box by applying the `withBorderAccent` prop on the `` component. ```tsx // index.tsx import { Alert } from "flowbite-react"; export function Component() { return ( Info alert! Change a few things up and try submitting again. ); } ``` ## Additional content Add additional content by using the `additionalContent` prop and add any type of content inside of it. ```tsx // index.tsx "use client"; import { Alert } from "flowbite-react"; import { HiEye, HiInformationCircle } from "react-icons/hi"; export function Component() { return ( } color="warning" icon={HiInformationCircle}> Info alert! Change a few things up and try submitting again. ); } function ExampleAdditionalContent() { return ( <>
More info about this info alert goes here. This example text is going to run a bit longer so that you can see how spacing within an alert works with this kind of content.
); } ``` ## All options This is an example with all of the available options and props for the alert component. ```tsx // index.tsx "use client"; import { Alert } from "flowbite-react"; import { HiEye, HiInformationCircle } from "react-icons/hi"; export function Component() { return ( } color="success" icon={HiInformationCircle} onDismiss={() => alert('Alert dismissed!')} rounded > Info alert! Change a few things up and try submitting again. ); } ``` ## Theme To learn more about how to customize the appearance of components, please see the [Theme docs](https://flowbite-react.com/docs/customize/theme.md). ```json { "base": "flex flex-col gap-2 p-4 text-sm", "borderAccent": "border-t-4", "closeButton": { "base": "-m-1.5 ml-auto inline-flex h-8 w-8 rounded-lg p-1.5 focus:ring-2", "icon": "h-5 w-5", "color": { "info": "bg-cyan-100 text-cyan-500 hover:bg-cyan-200 focus:ring-cyan-400 dark:bg-cyan-200 dark:text-cyan-600 dark:hover:bg-cyan-300", "gray": "bg-gray-100 text-gray-500 hover:bg-gray-200 focus:ring-gray-400 dark:bg-gray-700 dark:text-gray-300 dark:hover:bg-gray-800 dark:hover:text-white", "failure": "bg-red-100 text-red-500 hover:bg-red-200 focus:ring-red-400 dark:bg-red-200 dark:text-red-600 dark:hover:bg-red-300", "success": "bg-green-100 text-green-500 hover:bg-green-200 focus:ring-green-400 dark:bg-green-200 dark:text-green-600 dark:hover:bg-green-300", "warning": "bg-yellow-100 text-yellow-500 hover:bg-yellow-200 focus:ring-yellow-400 dark:bg-yellow-200 dark:text-yellow-600 dark:hover:bg-yellow-300", "red": "bg-red-100 text-red-500 hover:bg-red-200 focus:ring-red-400 dark:bg-red-200 dark:text-red-600 dark:hover:bg-red-300", "green": "bg-green-100 text-green-500 hover:bg-green-200 focus:ring-green-400 dark:bg-green-200 dark:text-green-600 dark:hover:bg-green-300", "yellow": "bg-yellow-100 text-yellow-500 hover:bg-yellow-200 focus:ring-yellow-400 dark:bg-yellow-200 dark:text-yellow-600 dark:hover:bg-yellow-300", "blue": "bg-blue-100 text-blue-500 hover:bg-blue-200 focus:ring-blue-400 dark:bg-blue-200 dark:text-blue-600 dark:hover:bg-blue-300", "cyan": "bg-cyan-100 text-cyan-500 hover:bg-cyan-200 focus:ring-cyan-400 dark:bg-cyan-200 dark:text-cyan-600 dark:hover:bg-cyan-300", "pink": "bg-pink-100 text-pink-500 hover:bg-pink-200 focus:ring-pink-400 dark:bg-pink-200 dark:text-pink-600 dark:hover:bg-pink-300", "lime": "bg-lime-100 text-lime-500 hover:bg-lime-200 focus:ring-lime-400 dark:bg-lime-200 dark:text-lime-600 dark:hover:bg-lime-300", "dark": "bg-gray-100 text-gray-500 hover:bg-gray-200 focus:ring-gray-400 dark:bg-gray-200 dark:text-gray-600 dark:hover:bg-gray-300", "indigo": "bg-indigo-100 text-indigo-500 hover:bg-indigo-200 focus:ring-indigo-400 dark:bg-indigo-200 dark:text-indigo-600 dark:hover:bg-indigo-300", "purple": "bg-purple-100 text-purple-500 hover:bg-purple-200 focus:ring-purple-400 dark:bg-purple-200 dark:text-purple-600 dark:hover:bg-purple-300", "teal": "bg-teal-100 text-teal-500 hover:bg-teal-200 focus:ring-teal-400 dark:bg-teal-200 dark:text-teal-600 dark:hover:bg-teal-300", "light": "bg-gray-50 text-gray-500 hover:bg-gray-100 focus:ring-gray-200 dark:bg-gray-600 dark:text-gray-200 dark:hover:bg-gray-700 dark:hover:text-white" } }, "color": { "info": "border-cyan-500 bg-cyan-100 text-cyan-700 dark:bg-cyan-200 dark:text-cyan-800", "gray": "border-gray-500 bg-gray-100 text-gray-700 dark:bg-gray-700 dark:text-gray-300", "failure": "border-red-500 bg-red-100 text-red-700 dark:bg-red-200 dark:text-red-800", "success": "border-green-500 bg-green-100 text-green-700 dark:bg-green-200 dark:text-green-800", "warning": "border-yellow-500 bg-yellow-100 text-yellow-700 dark:bg-yellow-200 dark:text-yellow-800", "red": "border-red-500 bg-red-100 text-red-700 dark:bg-red-200 dark:text-red-800", "green": "border-green-500 bg-green-100 text-green-700 dark:bg-green-200 dark:text-green-800", "yellow": "border-yellow-500 bg-yellow-100 text-yellow-700 dark:bg-yellow-200 dark:text-yellow-800", "blue": "border-blue-500 bg-blue-100 text-blue-700 dark:bg-blue-200 dark:text-blue-800", "cyan": "border-cyan-500 bg-cyan-100 text-cyan-700 dark:bg-cyan-200 dark:text-cyan-800", "pink": "border-pink-500 bg-pink-100 text-pink-700 dark:bg-pink-200 dark:text-pink-800", "lime": "border-lime-500 bg-lime-100 text-lime-700 dark:bg-lime-200 dark:text-lime-800", "dark": "border-gray-600 bg-gray-800 text-gray-200 dark:bg-gray-900 dark:text-gray-300", "indigo": "border-indigo-500 bg-indigo-100 text-indigo-700 dark:bg-indigo-200 dark:text-indigo-800", "purple": "border-purple-500 bg-purple-100 text-purple-700 dark:bg-purple-200 dark:text-purple-800", "teal": "border-teal-500 bg-teal-100 text-teal-700 dark:bg-teal-200 dark:text-teal-800", "light": "border-gray-400 bg-gray-50 text-gray-600 dark:bg-gray-500 dark:text-gray-200" }, "icon": "mr-3 inline h-5 w-5 shrink-0", "rounded": "rounded-lg", "wrapper": "flex items-center" } ``` ## References - [Flowbite Alerts](https://flowbite.com/docs/components/alerts/) --- ## Avatar # React Avatar - Flowbite > Use the avatar component to show user profile images and placeholders in different sizes, colors and shapes based on React and Tailwind CSS The avatar component from Flowbite React can be used to show a visual representation of a user or team account for your application based on multiple examples, colors, sizes and shapes. All of the example are built as React components and you can access custom props and methods to customize the component and you can also use Tailwind CSS classes to style the component. To start using the avatar component you need to import it from the `flowbite-react` package: ```jsx import { Avatar } from "flowbite-react"; ``` ## Default avatar Here's a default example of the `` component where you can use the `img` prop to pass the image URL, the `alt` prop to pass a description of the image for accessibility and the `rounded` prop to make the avatar rounded. ```tsx // index.tsx import { Avatar } from "flowbite-react"; export function Component() { return (
); } ``` ## Avatar with border Use the `bordered` prop to add a border style to the avatar. ```tsx // index.tsx import { Avatar } from "flowbite-react"; export function Component() { return (
); } ``` ## Avatar placeholder If the user doesn't have an image you can use the `placeholder` prop to show a placeholder image and you can still pass the `rounded` prop to make the avatar rounded and other options. ```tsx // index.tsx import { Avatar } from "flowbite-react"; export function Component() { return (
); } ``` ## Placeholder initials Alternatively to the placeholder image you can use the `placeholderInitials` prop to show the user initials. ```tsx // index.tsx import { Avatar } from "flowbite-react"; export function Component() { return (
); } ``` ## Dot indicator You can use the `status` prop to show a dot indicator on the avatar and you can use the `statusPosition` prop to change the position of the dot indicator. This is useful to show the user status like online, offline, busy, away, and more. ```tsx // index.tsx import { Avatar } from "flowbite-react"; export function Component() { return (
); } ``` ## Stacked layout Stack multiple avatars together by using the `` component and by passing the `stacked` prop to the child components of the group. The `` component can be used to show the total number of avatars in the group by passing the `total` prop and a link to the `href` prop to view all users. ```tsx // index.tsx import { Avatar, AvatarGroup, AvatarGroupCounter } from "flowbite-react"; export function Component() { return (
); } ``` ## Avatar with text Use this example to show an avatar with text (ie. user name, email, etc) by passing the custom markup inside the `` component. This is useful for admin dashboard interfaces while the user is logged in. ```tsx // index.tsx import { Avatar } from "flowbite-react"; export function Component() { return (
Jese Leos
Joined in August 2014
); } ``` ## Avatar dropdown Use the `` component to show a dropdown menu when clicking on the avatar component. This example is often used to show the user settings, account settings, and more. ```tsx // index.tsx import { Avatar, Dropdown, DropdownDivider, DropdownHeader, DropdownItem } from "flowbite-react"; export function Component() { return ( } arrowIcon={false} inline > Bonnie Green name@flowbite.com Dashboard Settings Earnings Sign out ); } ``` ## Colors If you want to change the default color of the avatar component you can pass the `color` prop. Colors that you can choose from are gray, light, purple, success, pink, and more. ```tsx // index.tsx import { Avatar } from "flowbite-react"; export function Component() { return (
); } ``` ## Sizes Change the default size of the avatar component by passing the `size` prop. Sizes that you can choose from are xs, sm, md, lg, and xl. ```tsx // index.tsx import { Avatar } from "flowbite-react"; export function Component() { return (
); } ``` ## Override image element You can override the default image element by passing the `img` prop to the `` component. This is useful if you want to use a different image element like `` from Next.js. ```tsx // index.tsx "use client"; import { Avatar } from "flowbite-react"; import Image from "next/image"; export function Component() { return (
( )} /> ( )} />
); } ``` ## Theme To learn more about how to customize the appearance of components, please see the [Theme docs](https://flowbite-react.com/docs/customize/theme.md). ```json { "root": { "base": "flex items-center justify-center space-x-4 rounded", "inner": "relative", "bordered": "p-1 ring-2", "rounded": "rounded-full", "color": { "dark": "ring-gray-800 dark:ring-gray-800", "failure": "ring-red-500 dark:ring-red-700", "gray": "ring-gray-500 dark:ring-gray-400", "info": "ring-cyan-400 dark:ring-cyan-800", "light": "ring-gray-300 dark:ring-gray-500", "purple": "ring-purple-500 dark:ring-purple-600", "success": "ring-green-500 dark:ring-green-500", "warning": "ring-yellow-300 dark:ring-yellow-500", "pink": "ring-pink-500 dark:ring-pink-500" }, "img": { "base": "rounded", "off": "relative overflow-hidden bg-gray-100 dark:bg-gray-600", "on": "", "placeholder": "absolute -bottom-1 h-auto w-auto text-gray-400" }, "size": { "xs": "h-6 w-6", "sm": "h-8 w-8", "md": "h-10 w-10", "lg": "h-20 w-20", "xl": "h-36 w-36" }, "stacked": "ring-2 ring-gray-300 dark:ring-gray-500", "statusPosition": { "bottom-left": "-bottom-1 -left-1", "bottom-center": "-bottom-1", "bottom-right": "-bottom-1 -right-1", "top-left": "-left-1 -top-1", "top-center": "-top-1", "top-right": "-right-1 -top-1", "center-right": "-right-1", "center": "", "center-left": "-left-1" }, "status": { "away": "bg-yellow-400", "base": "absolute h-3.5 w-3.5 rounded-full border-2 border-white dark:border-gray-800", "busy": "bg-red-400", "offline": "bg-gray-400", "online": "bg-green-400" }, "initials": { "text": "font-medium text-gray-600 dark:text-gray-300", "base": "relative inline-flex items-center justify-center overflow-hidden bg-gray-100 dark:bg-gray-600" } }, "group": { "base": "flex -space-x-4" }, "groupCounter": { "base": "relative flex h-10 w-10 items-center justify-center rounded-full bg-gray-700 text-xs font-medium text-white ring-2 ring-gray-300 hover:bg-gray-600 dark:ring-gray-500" } } ``` ## References - [Flowbite Avatar](https://flowbite.com/docs/components/avatar/) --- ## Badge # React Badge - Flowbite > Get started with the badge component to add labels or counters inside paragraphs, buttons, and inputs based on multiple colors and sizes from React and Tailwind CSS The badge component can be used to show text, labels, and counters inside a small box or circle element which can be placed inside paragraphs, buttons, dropdowns, menu items, and more. You can choose from multiple examples of badges based on the color, size, and icon and even use it as a link component by leveraging the properties from React and classes from Tailwind CSS. To start using the badge component you need to import it from `flowbite-react`: ```jsx import { Badge } from "flowbite-react"; ``` ## Default badges Here's a list of default `` component examples where you can use the `color` property to change the color of the badge based on contextual colors such as info, gray, success, and more. ```tsx // index.tsx import { Badge } from "flowbite-react"; export function Component() { return (
Default Dark Failure Success Warning Indigo Purple Pink
); } ``` ## Badge as link Use the badge as a link component by wrapping it with an anchor element. ```tsx // index.tsx import { Badge } from "flowbite-react"; export function Component() { return ( ); } ``` ## Badge with icon Add an icon to the badge by using the `icon` property and pass the icon component as a value. This can be used to show the status of a task or a notification often used for admin dashboards and user feeds. ```tsx // index.tsx "use client"; import { Badge } from "flowbite-react"; import { HiCheck, HiClock } from "react-icons/hi"; export function Component() { return (
2 minutes ago 3 days ago
); } ``` ## Badge with icon only An alternative style for the badge component is by only showing an icon without any text. You can do this by removing the children from the component and only using the `icon` property. ```tsx // index.tsx "use client"; import { Badge } from "flowbite-react"; import { HiCheck, HiClock } from "react-icons/hi"; export function Component() { return (
); } ``` ## Sizes Update the size of the badge component by using the `size` property and passing the size as a value. You can choose from `xs` and `sm` sizes. ```tsx // index.tsx import { Badge } from "flowbite-react"; export function Component() { return (
Default Dark Failure Success Warning Indigo Purple Pink
); } ``` ## Theme To learn more about how to customize the appearance of components, please see the [Theme docs](https://flowbite-react.com/docs/customize/theme.md). ```json { "root": { "base": "flex h-fit items-center gap-1 font-semibold", "color": { "info": "bg-cyan-100 text-cyan-800 hover:bg-cyan-200 dark:bg-cyan-200 dark:text-cyan-800 dark:hover:bg-cyan-300", "gray": "bg-gray-100 text-gray-800 hover:bg-gray-200 dark:bg-gray-700 dark:text-gray-300 dark:hover:bg-gray-600", "failure": "bg-red-100 text-red-800 hover:bg-red-200 dark:bg-red-200 dark:text-red-900 dark:hover:bg-red-300", "success": "bg-green-100 text-green-800 hover:bg-green-200 dark:bg-green-200 dark:text-green-900 dark:hover:bg-green-300", "warning": "bg-yellow-100 text-yellow-800 hover:bg-yellow-200 dark:bg-yellow-200 dark:text-yellow-900 dark:hover:bg-yellow-300", "indigo": "bg-indigo-100 text-indigo-800 hover:bg-indigo-200 dark:bg-indigo-200 dark:text-indigo-900 dark:hover:bg-indigo-300", "purple": "bg-purple-100 text-purple-800 hover:bg-purple-200 dark:bg-purple-200 dark:text-purple-900 dark:hover:bg-purple-300", "pink": "bg-pink-100 text-pink-800 hover:bg-pink-200 dark:bg-pink-200 dark:text-pink-900 dark:hover:bg-pink-300", "blue": "bg-blue-100 text-blue-800 hover:bg-blue-200 dark:bg-blue-200 dark:text-blue-900 dark:hover:bg-blue-300", "cyan": "bg-cyan-100 text-cyan-800 hover:bg-cyan-200 dark:bg-cyan-200 dark:text-cyan-900 dark:hover:bg-cyan-300", "dark": "bg-gray-600 text-gray-100 hover:bg-gray-500 dark:bg-gray-900 dark:text-gray-200 dark:hover:bg-gray-700", "light": "bg-gray-200 text-gray-800 hover:bg-gray-300 dark:bg-gray-400 dark:text-gray-900 dark:hover:bg-gray-500", "green": "bg-green-100 text-green-800 hover:bg-green-200 dark:bg-green-200 dark:text-green-900 dark:hover:bg-green-300", "lime": "bg-lime-100 text-lime-800 hover:bg-lime-200 dark:bg-lime-200 dark:text-lime-900 dark:hover:bg-lime-300", "red": "bg-red-100 text-red-800 hover:bg-red-200 dark:bg-red-200 dark:text-red-900 dark:hover:bg-red-300", "teal": "bg-teal-100 text-teal-800 hover:bg-teal-200 dark:bg-teal-200 dark:text-teal-900 dark:hover:bg-teal-300", "yellow": "bg-yellow-100 text-yellow-800 hover:bg-yellow-200 dark:bg-yellow-200 dark:text-yellow-900 dark:hover:bg-yellow-300" }, "size": { "xs": "p-1 text-xs", "sm": "p-1.5 text-sm" } }, "icon": { "off": "rounded px-2 py-0.5", "on": "rounded-full p-1.5", "size": { "xs": "h-3 w-3", "sm": "h-3.5 w-3.5" } } } ``` ## References - [Flowbite Badge](https://flowbite.com/docs/components/badge/) --- ## Banner # React Sticky Banner - Flowbite > Use the banner component to show marketing messages and CTA buttons at the top or bottom side of your website based on the utility classes from Tailwind CSS Get started with the sticky banner component coded with Tailwind CSS and Flowbite to show marketing, informational and CTA messages to your website visitors fixed to the top or bottom part of the page as the user scroll down the main content area. Explore the following examples based on various styles, sizes, and positionings to leverage the sticky banner component and increase marketing conversions with a responsive element supporting dark mode. To start using the banner component you need to import it from `flowbite-react`: ```jsx import { Banner } from "flowbite-react"; ``` ## Default sticky banner Use this free example to show a text message for announcement with a CTA link, an icon element and a close button to dismiss the banner. ```tsx // index.tsx import { Banner, BannerCollapseButton } from "flowbite-react"; import { HiX } from "react-icons/hi"; import { MdAnnouncement } from "react-icons/md"; export function Component() { return (

New brand identity has been launched for the  Flowbite Library

); } ``` ## Bottom banner position This example can be used to position the sticky banner to the bottom side of the page instead of the top side. ```tsx // index.tsx import { Banner, BannerCollapseButton } from "flowbite-react"; import { HiArrowRight, HiX } from "react-icons/hi"; import { MdPercent } from "react-icons/md"; export function Component() { return (

Get 5% commision per sale  Become a partner

); } ``` ## Marketing CTA banner Use this free example to show a text message for announcement with a CTA link, an icon element and a close button to dismiss the banner. Set a different width by using the `max-w-{*}` utility classes from Tailwind CSS. ```tsx // index.tsx import { Banner, BannerCollapseButton, Button } from "flowbite-react"; import { HiX } from "react-icons/hi"; export function Component() { return (
Flowbite Logo Flowbite

Build websites even faster with components on top of Tailwind CSS

); } ``` ## Newsletter sign-up banner This example can be used to encourage your website visitors to sign up to your email newsletter by showing an inline form inside the sticky banner on the top side of your page. ```tsx // index.tsx import { Banner, BannerCollapseButton, Button, Label, TextInput } from "flowbite-react"; import { HiX } from "react-icons/hi"; export function Component() { return (
); } ``` ## Informational banner This example can be used to share important information with your website visitors by showing a heading and a paragraph inside the sticky banner and two CTA buttons with links. ```tsx // index.tsx import { Banner, BannerCollapseButton } from "flowbite-react"; import { FaBookOpen } from "react-icons/fa"; import { HiArrowRight, HiX } from "react-icons/hi"; export function Component() { return (

Integration is the key

You can integrate Flowbite with many tools to make your work even more efficient and lightning fast based on Tailwind CSS.

); } ``` ## Theme **This component is a work in progress, and currently doesn't have a theme.** It may in future updates. To learn more about how to customize the appearance of components, please see the [Theme docs](https://flowbite-react.com/docs/customize/theme.md). ## References - [Flowbite Banner](https://flowbite.com/docs/components/banner/) --- ## Breadcrumb # React Breadcrumb - Flowbite > Get started with the breadcrumb component to show the current page location based on the URL structure using React and Tailwind CSS The breadcrumb component can be used to indicate the current page's location within a navigational hierarchy and you can choose from multiple examples, colors, and sizes built with React and based on the utility classes from Tailwind CSS. To start using the breadcrumb component you need to import it from `flowbite-react`: ```jsx import { Breadcrumb } from "flowbite-react"; ``` ## Default breadcrumb Use the `` component and the child `` components to create and indicate a series of page structure and URLs to help the user navigate through the website. You can use the `href` prop from React to make the breadcrumb items clickable and the `icon` prop to add an icon to the breadcrumb item such as for the homepage. ```tsx // index.tsx "use client"; import { Breadcrumb, BreadcrumbItem } from "flowbite-react"; import { HiHome } from "react-icons/hi"; export function Component() { return ( Home Projects Flowbite React ); } ``` ## Background color You can add a solid background style to the breadcrumb component by adding the `bg-gray-50` class to the component from Tailwind CSS. ```tsx // index.tsx "use client"; import { Breadcrumb, BreadcrumbItem } from "flowbite-react"; import { HiHome } from "react-icons/hi"; export function Component() { return ( Home Projects Flowbite React ); } ``` ## Theme To learn more about how to customize the appearance of components, please see the [Theme docs](https://flowbite-react.com/docs/customize/theme.md). ```json { "root": { "base": "", "list": "flex items-center" }, "item": { "base": "group flex items-center", "chevron": "mx-1 h-4 w-4 text-gray-400 group-first:hidden md:mx-2", "href": { "off": "flex items-center text-sm font-medium text-gray-500 dark:text-gray-400", "on": "flex items-center text-sm font-medium text-gray-700 hover:text-gray-900 dark:text-gray-400 dark:hover:text-white" }, "icon": "mr-2 h-4 w-4" } } ``` ## References - [Flowbite Breadcrumbs](https://flowbite.com/docs/components/breadcrumb/) --- ## Button # React Button - Flowbite > Enable user interaction with the button component to perform actions on your website as links, for payment, form submission, social buttons and more based on React and Tailwind CSS The button component is a common UI component found on the web that allows users to trigger certain actions on your website such as submitting a form, navigating to a new page, or downloading a file. The examples from the Flowbite React library allows you to customise the buttons with different colors, sizes, icons, and more. All examples are built with React and Tailwind CSS. In order to start using the button component you need to import it from Flowbite React: ```jsx import { Button } from "flowbite-react"; ``` ## Default buttons Use this example to create a default button by using the ` ); } ``` ## Button pills Add the `pill` property to the ` ); } ``` ## Gradient monochrome These beautifully colored buttons built with the gradient color utility classes from Tailwind CSS can be used as a creative alternative to the default button styles. ```tsx // index.tsx import { Button } from "flowbite-react"; export function Component() { return (
); } ``` ## Gradient duotone These buttons use a style that includes two contrasted colors creating an impressive mesh gradient effect. ```tsx // index.tsx import { Button } from "flowbite-react"; export function Component() { return (
); } ``` ## Outline buttons Use the `outline` property to create an outline button with transparent background and colored border. ```tsx // index.tsx import { Button } from "flowbite-react"; export function Component() { return (
); } ``` ## Button sizes You can update the size of the button by adding the `size` property to the ` ); } ``` ## Buttons with icon You can add icons to the buttons by adding it inside the ` ); } ``` ## Button with label This example can be used to show a notification count or helper text inside a button using the [Badge](https://flowbite-react.com/docs/components/badge.md) component. ```tsx // index.tsx import { Badge, Button } from "flowbite-react"; export function Component() { return ( ); } ``` ## Button with only icons Create a button with only icons by adding the `iconOnly` property to the ` ); } ``` ## Button with loading state Use the following [Spinner](https://flowbite-react.com/docs/components/spinner.md) component to indicate a loader animation inside buttons: ```tsx // index.tsx import { Button, Spinner } from "flowbite-react"; export function Component() { return (
); } ``` ## Disabled buttons You can disable the button by adding the `disabled` property to the `; } ``` ## Override Button base component The `as` prop provides you the ability to transform the ` ); } ``` ## Theme To learn more about how to customize the appearance of components, please see the [Theme docs](https://flowbite-react.com/docs/customize/theme.md). ```json { "base": "relative flex items-center justify-center rounded-lg text-center font-medium focus:outline-none focus:ring-4", "disabled": "pointer-events-none opacity-50", "fullSized": "w-full", "grouped": "rounded-none border-l-0 first:rounded-s-lg first:border-l last:rounded-e-lg focus:ring-2", "pill": "rounded-full", "size": { "xs": "h-8 px-3 text-xs", "sm": "h-9 px-3 text-sm", "md": "h-10 px-5 text-sm", "lg": "h-12 px-5 text-base", "xl": "h-[52px] px-6 text-base" }, "color": { "default": "bg-primary-700 text-white hover:bg-primary-800 focus:ring-primary-300 dark:bg-primary-600 dark:hover:bg-primary-700 dark:focus:ring-primary-800", "alternative": "border border-gray-200 bg-white text-gray-900 hover:bg-gray-100 hover:text-primary-700 focus:ring-gray-100 dark:border-gray-600 dark:bg-gray-800 dark:text-gray-400 dark:hover:bg-gray-700 dark:hover:text-white dark:focus:ring-gray-700", "blue": "bg-blue-700 text-white hover:bg-blue-800 focus:ring-blue-300 dark:bg-blue-600 dark:hover:bg-blue-700 dark:focus:ring-blue-800", "cyan": "bg-cyan-700 text-white hover:bg-cyan-800 focus:ring-cyan-300 dark:bg-cyan-600 dark:hover:bg-cyan-700 dark:focus:ring-cyan-800", "dark": "bg-gray-800 text-white hover:bg-gray-900 focus:ring-gray-300 dark:bg-gray-800 dark:hover:bg-gray-700 dark:focus:ring-gray-700", "gray": "bg-gray-700 text-white hover:bg-gray-800 focus:ring-gray-300 dark:bg-gray-600 dark:hover:bg-gray-700 dark:focus:ring-gray-800", "green": "bg-green-700 text-white hover:bg-green-800 focus:ring-green-300 dark:bg-green-600 dark:hover:bg-green-700 dark:focus:ring-green-800", "indigo": "bg-indigo-700 text-white hover:bg-indigo-800 focus:ring-indigo-300 dark:bg-indigo-600 dark:hover:bg-indigo-700 dark:focus:ring-indigo-800", "light": "border border-gray-300 bg-white text-gray-900 hover:bg-gray-100 focus:ring-gray-100 dark:border-gray-600 dark:bg-gray-800 dark:text-white dark:hover:border-gray-600 dark:hover:bg-gray-700 dark:focus:ring-gray-700", "lime": "bg-lime-700 text-white hover:bg-lime-800 focus:ring-lime-300 dark:bg-lime-600 dark:hover:bg-lime-700 dark:focus:ring-lime-800", "pink": "bg-pink-700 text-white hover:bg-pink-800 focus:ring-pink-300 dark:bg-pink-600 dark:hover:bg-pink-700 dark:focus:ring-pink-800", "purple": "bg-purple-700 text-white hover:bg-purple-800 focus:ring-purple-300 dark:bg-purple-600 dark:hover:bg-purple-700 dark:focus:ring-purple-800", "red": "bg-red-700 text-white hover:bg-red-800 focus:ring-red-300 dark:bg-red-600 dark:hover:bg-red-700 dark:focus:ring-red-800", "teal": "bg-teal-700 text-white hover:bg-teal-800 focus:ring-teal-300 dark:bg-teal-600 dark:hover:bg-teal-700 dark:focus:ring-teal-800", "yellow": "bg-yellow-400 text-white hover:bg-yellow-500 focus:ring-yellow-300 dark:bg-yellow-600 dark:hover:bg-yellow-400 dark:focus:ring-yellow-900" }, "outlineColor": { "default": "border border-primary-700 text-primary-700 hover:border-primary-800 hover:bg-primary-800 hover:text-white focus:ring-primary-300 dark:border-primary-600 dark:text-primary-500 dark:hover:border-primary-700 dark:hover:bg-primary-700 dark:hover:text-white dark:focus:ring-primary-800", "blue": "border border-blue-700 text-blue-700 hover:border-blue-800 hover:bg-blue-800 hover:text-white focus:ring-blue-300 dark:border-blue-500 dark:text-blue-500 dark:hover:border-blue-700 dark:hover:bg-blue-700 dark:hover:text-white dark:focus:ring-blue-800", "cyan": "border border-cyan-700 text-cyan-700 hover:border-cyan-800 hover:bg-cyan-800 hover:text-white focus:ring-cyan-300 dark:border-cyan-500 dark:text-cyan-500 dark:hover:border-cyan-700 dark:hover:bg-cyan-700 dark:hover:text-white dark:focus:ring-cyan-800", "dark": "border border-gray-800 text-gray-800 hover:border-gray-900 hover:bg-gray-900 hover:text-white focus:ring-gray-300 dark:border-gray-600 dark:text-gray-400 dark:hover:bg-gray-600 dark:hover:text-white dark:focus:ring-gray-800", "gray": "border border-gray-700 text-gray-700 hover:border-gray-800 hover:bg-gray-800 hover:text-white focus:ring-gray-300 dark:border-gray-600 dark:text-gray-400 dark:hover:border-gray-700 dark:hover:bg-gray-700 dark:hover:text-white dark:focus:ring-gray-800", "green": "border border-green-700 text-green-700 hover:border-green-800 hover:bg-green-800 hover:text-white focus:ring-green-300 dark:border-green-600 dark:text-green-500 dark:hover:border-green-700 dark:hover:bg-green-700 dark:hover:text-white dark:focus:ring-green-800", "indigo": "border border-indigo-700 text-indigo-700 hover:border-indigo-800 hover:bg-indigo-800 hover:text-white focus:ring-indigo-300 dark:border-indigo-600 dark:text-indigo-400 dark:hover:border-indigo-700 dark:hover:bg-indigo-700 dark:hover:text-white dark:focus:ring-indigo-800", "lime": "border border-lime-700 text-lime-700 hover:border-lime-800 hover:bg-lime-800 hover:text-white focus:ring-lime-300 dark:border-lime-600 dark:text-lime-500 dark:hover:border-lime-700 dark:hover:bg-lime-700 dark:hover:text-white dark:focus:ring-lime-800", "pink": "border border-pink-700 text-pink-700 hover:border-pink-800 hover:bg-pink-800 hover:text-white focus:ring-pink-300 dark:border-pink-600 dark:text-pink-500 dark:hover:border-pink-700 dark:hover:bg-pink-700 dark:hover:text-white dark:focus:ring-pink-800", "purple": "border border-purple-700 text-purple-700 hover:border-purple-800 hover:bg-purple-800 hover:text-white focus:ring-purple-300 dark:border-purple-600 dark:text-purple-400 dark:hover:border-purple-700 dark:hover:bg-purple-700 dark:hover:text-white dark:focus:ring-purple-800", "red": "border border-red-700 text-red-700 hover:border-red-800 hover:bg-red-800 hover:text-white focus:ring-red-300 dark:border-red-600 dark:text-red-500 dark:hover:border-red-700 dark:hover:bg-red-700 dark:hover:text-white dark:focus:ring-red-800", "teal": "border border-teal-700 text-teal-700 hover:border-teal-800 hover:bg-teal-800 hover:text-white focus:ring-teal-300 dark:border-teal-600 dark:text-teal-400 dark:hover:border-teal-700 dark:hover:bg-teal-700 dark:hover:text-white dark:focus:ring-teal-800", "yellow": "border border-yellow-400 text-yellow-400 hover:border-yellow-500 hover:bg-yellow-500 hover:text-white focus:ring-yellow-300 dark:border-yellow-300 dark:text-yellow-300 dark:hover:border-yellow-400 dark:hover:bg-yellow-400 dark:hover:text-white dark:focus:ring-yellow-900" } } ``` ## References - [Flowbite Buttons](https://flowbite.com/docs/components/buttons/) --- ## Button group # React Button Group - Flowbite > Button groups allow you to stack together multiple buttons in a single line horizontally based on multiple styles and sizes using React and Tailwind CSS The button group component from Flowbite React can be used to stack multiple button elements and group them visually together. It can often be used to create a navigation menu or a toolbar. Choose from multiple examples and you can update properties such as the color, size, and appearance using the props from React and utility classes from Tailwind CSS. To start using the component you need to import it from the Flowbite React library: ```jsx import { Button } from "flowbite-react"; ``` ## Default button group Use this example of the `` component by adding the `Button` component as a child element and stack them together. You can also use the `color` prop to change the color of the buttons. ```tsx // index.tsx import { Button, ButtonGroup } from "flowbite-react"; export function Component() { return ( ); } ``` ## Button group with icons Import one of the icons from the `react-icons` library and add it as a child element to the ` ); } ``` ## Outline button group By passing the outline prop to the `` component you can create a button group with outline buttons with no background and solid borders. ```tsx // index.tsx import { Button, ButtonGroup } from "flowbite-react"; export function Component() { return ( ); } ``` ## Outline button group with icons Here's an example on how you can use both the outline and icon props together. ```tsx // index.tsx import { Button, ButtonGroup } from "flowbite-react"; import { HiAdjustments, HiCloudDownload, HiUserCircle } from "react-icons/hi"; export function Component() { return ( ); } ``` ## Color options Use the `color` prop to change the color of the buttons. ```tsx // index.tsx import { Button, ButtonGroup } from "flowbite-react"; export function Component() { return ( ); } ``` ## Theme To learn more about how to customize the appearance of components, please see the [Theme docs](https://flowbite-react.com/docs/customize/theme.md). ```json { "base": "inline-flex rounded-md shadow-sm" } ``` ## References - [Flowbite Button Group](https://flowbite.com/docs/components/button-group/) --- ## Card # React Card - Flowbite > Get started with the card component to show content in a box such as titles, descriptions, and images based on multiple styles and sizes built with React The card component can be used to show a wide variety of content such as previews of blog posts, user profiles, pricing plans, and more. Choose from one of the many examples built with React and the utility classes from Tailwind CSS. To start using the card component you will need to import it from `flowbite-react`: ```jsx import { Card } from "flowbite-react"; ``` ## Default card Use this example to show a simple card component with a title and description and apply the `href` tag to the `` component to set a hyperlink to the card. ```tsx // index.tsx import { Card } from "flowbite-react"; export function Component() { return (
Noteworthy technology acquisitions 2021

Here are the biggest enterprise technology acquisitions of 2021 so far, in reverse chronological order.

); } ``` ## Card with CTA button By also importing the `
); } ``` ## Card with image Add an image to the card by using the `imgSrc` prop and set the `imgAlt` prop to add an alt text to the image. ```tsx // index.tsx import { Card } from "flowbite-react"; export function Component() { return (
Noteworthy technology acquisitions 2021

Here are the biggest enterprise technology acquisitions of 2021 so far, in reverse chronological order.

); } ``` ## Card with custom image render function Specify your own render function for the image component for the card by using the `renderImage` prop. This is especially useful when using the component with NextJS or Gatsby. ```tsx // index.tsx "use client"; import { Card } from "flowbite-react"; import Image from "next/image"; export function Component() { return ( image 1} >
Noteworthy technology acquisitions 2021

Here are the biggest enterprise technology acquisitions of 2021 so far, in reverse chronological order.

); } ``` ## Horizontal card Use the `horizontal` prop to show the card in a horizontal layout. ```tsx // index.tsx import { Card } from "flowbite-react"; export function Component() { return (
Noteworthy technology acquisitions 2021

Here are the biggest enterprise technology acquisitions of 2021 so far, in reverse chronological order.

); } ``` ## User profile card Use this example to show a user card with a profile picture, name, job title, buttons and a dropdown menu. ```tsx // index.tsx import { Card, Dropdown, DropdownItem } from "flowbite-react"; import Image from "next/image"; export function Component() { return (
Bonnie image
Bonnie Green
Visual Designer
); } ``` ## Card with form You can also add form elements inside of the card component such as for sign up or login forms. ```tsx // index.tsx import { Button, Card, Checkbox, Label, TextInput } from "flowbite-react"; export function Component() { return (
); } ``` ## E-commerce card Use this example to show a product card with an image (product preview), title, price, rating stars and buttons built for E-commerce websites. ```tsx // index.tsx import { Card } from "flowbite-react"; export function Component() { return (
Apple Watch Series 7 GPS, Aluminium Case, Starlight Sport
5.0
); } ``` ## CTA card Use this component to display a call to action card for mobile applications where you feature download buttons for App Store and Google Play. ```tsx // index.tsx import { Card } from "flowbite-react"; export function Component() { return (
Work fast from anywhere

Stay up to date and move work forward with Flowbite on iOS & Android. Download the app today.

); } ``` ## Card with list Use this component to display a card with a list of items such as your latest customers or latest orders that include an image, descriptive text and a link to view more. ```tsx // index.tsx import { Card } from "flowbite-react"; import Image from "next/image"; export function Component() { return (
Latest Customers
View all
  • Neil image

    Neil Sims

    email@windster.com

    $320
  • Bonnie image

    Bonnie Green

    email@windster.com

    $3467
  • Michael image

    Michael Gough

    email@windster.com

    $67
  • Lana image

    Lana Byrd

    email@windster.com

    $367
  • Thomas image

    Thomes Lean

    email@windster.com

    $2367
); } ``` ## Pricing card Use the pricing card component to show the pricing of your product or service. ```tsx // index.tsx import { Card } from "flowbite-react"; export function Component() { return (
Standard plan
$ 49 /month
  • 2 team members
  • 20GB Cloud storage
  • Integration help
  • Sketch Files
  • API Access
  • Complete documentation
  • 24×7 phone & email support
); } ``` ## Crypto card (web3) This component can be used for crypto and web3 related projects where you can choose which wallet you want to connect with (ie. Metamask, Coinbase). ```tsx // index.tsx import { Card } from "flowbite-react"; export function Component() { return (
Connect wallet

Connect with one of our available wallet providers or create a new one.

); } ``` ## Theme To learn more about how to customize the appearance of components, please see the [Theme docs](https://flowbite-react.com/docs/customize/theme.md). ```json { "root": { "base": "flex rounded-lg border border-gray-200 bg-white shadow-md dark:border-gray-700 dark:bg-gray-800", "children": "flex h-full flex-col justify-center gap-4 p-6", "horizontal": { "off": "flex-col", "on": "flex-col md:max-w-xl md:flex-row" }, "href": "hover:bg-gray-100 dark:hover:bg-gray-700" }, "img": { "base": "", "horizontal": { "off": "rounded-t-lg", "on": "h-96 w-full rounded-t-lg object-cover md:h-auto md:w-48 md:rounded-none md:rounded-l-lg" } } } ``` ## References - [Flowbite Card](https://flowbite.com/docs/components/card/) --- ## Carousel # React Carousel - Flowbite > Get started with the carousel component to showcase images and content and slide through them using custom controls, intervals, and indicators with React and Tailwind CSS Use the responsive carousel component to allow users to slide through multiple items and navigate between them using the control buttons and indicators. Choose from multiple examples and options to update the intervals, make the carousel static and set custom control button and indicator by configuring React and the utility classes from Tailwind CSS. To start using the carousel component you first need to import it from Flowbite React: ```jsx import { Carousel } from "flowbite-react"; ``` ## Default carousel Use this example by adding a series of images inside of the `` component. ```tsx // index.tsx import { Carousel } from "flowbite-react"; export function Component() { return (
... ... ... ... ...
); } ``` ## Static carousel Pass the `slide` prop to the carousel component to make it static and disable the automatic sliding functionality. This does not disable the control or indicator buttons. ```tsx // index.tsx import { Carousel } from "flowbite-react"; export function Component() { return (
... ... ... ... ...
); } ``` ## Sliding interval Use the `slideInterval` prop to set the interval between slides in milliseconds. The default value is `3000`. ```tsx // index.tsx import { Carousel } from "flowbite-react"; export function Component() { return (
... ... ... ... ...
); } ``` ## Custom controls Use the `leftControl` and `rightControl` props to set custom control buttons. ```tsx // index.tsx import { Carousel } from "flowbite-react"; export function Component() { return (
... ... ... ... ...
); } ``` ## Indicators Add custom indicators or disable them by passing the `indicators` prop to the `` component. ```tsx // index.tsx import { Carousel } from "flowbite-react"; export function Component() { return (
... ... ... ... ... ... ... ... ... ...
); } ``` ## Pause On Hover To conditionally pause the carousel on mouse hover (desktop), or touch and hold (mobile), you can use the `pauseOnHover` property on the `` component. Default value is `false`. ```tsx // index.tsx import { Carousel } from "flowbite-react"; export function Component() { return (
... ... ... ... ...
); } ``` ## Slider content Instead of images you can also use any type of markup and content inside the carousel such as simple text. ```tsx // index.tsx import { Carousel } from "flowbite-react"; export function Component() { return (
Slide 1
Slide 2
Slide 3
); } ``` ## Handle `onSlideChanged` event To hook events to slide changed you can use `onSlideChange` property. ```tsx // index.tsx "use client"; import { Carousel } from "flowbite-react"; export function Component() { return (
console.log("onSlideChange()", index)}>
Slide 1
Slide 2
Slide 3
); } ``` ## Theme To learn more about how to customize the appearance of components, please see the [Theme docs](https://flowbite-react.com/docs/customize/theme.md). ```json { "root": { "base": "relative h-full w-full", "leftControl": "absolute left-0 top-0 flex h-full items-center justify-center px-4 focus:outline-none", "rightControl": "absolute right-0 top-0 flex h-full items-center justify-center px-4 focus:outline-none" }, "indicators": { "active": { "off": "bg-white/50 hover:bg-white dark:bg-gray-800/50 dark:hover:bg-gray-800", "on": "bg-white dark:bg-gray-800" }, "base": "h-3 w-3 rounded-full", "wrapper": "absolute bottom-5 left-1/2 flex -translate-x-1/2 space-x-3" }, "item": { "base": "absolute left-1/2 top-1/2 block w-full -translate-x-1/2 -translate-y-1/2", "wrapper": { "off": "w-full shrink-0 transform cursor-default snap-center", "on": "w-full shrink-0 transform cursor-grab snap-center" } }, "control": { "base": "inline-flex h-8 w-8 items-center justify-center rounded-full bg-white/30 group-hover:bg-white/50 group-focus:outline-none group-focus:ring-4 group-focus:ring-white sm:h-10 sm:w-10 dark:bg-gray-800/30 dark:group-hover:bg-gray-800/60 dark:group-focus:ring-gray-800/70", "icon": "h-5 w-5 text-white sm:h-6 sm:w-6 dark:text-gray-800" }, "scrollContainer": { "base": "flex h-full snap-mandatory overflow-y-hidden overflow-x-scroll scroll-smooth rounded-lg", "snap": "snap-x" } } ``` ## References - [Flowbite Carousel](https://flowbite.com/docs/components/carousel/) --- ## Clipboard # React Clipboard - Flowbite > Use the clipboard component to copy text, data or lines of code to the clipboard with a single click based on various styles and examples coded with Tailwind CSS and Flowbite The copy to clipboard component allows you to copy text, lines of code, contact details or any other data to the clipboard with a single click on a trigger element such as a button. This component can be used to copy text from an input field, textarea, code block or even address fields in a form element. These components are built with Tailwind CSS and Flowbite React and can be found on the internet on websites such as Bitly, Cloudflare, Amazon AWS and almost all open-source projects and documentations. Import the component from `flowbite-react` to use the clipboard element: ```jsx import { Clipboard } from "flowbite-react"; ``` ## Default copy to clipboard Use this example to copy the content of an input text field by clicking on a button and update the button text. ```tsx // index.tsx import { Clipboard } from "flowbite-react" export function Component() { return (
); } ``` ## Input with copy button This example can be used to copy the content of an input field by clicking on a button with an icon positioned inside the form element and also show a tooltip with a message when the text has been copied. ```tsx // index.tsx import { ClipboardWithIcon } from "flowbite-react"; export function Component() { return (
); } ``` ## Copy button with text Use this example to show a copy button inside the input field with a text label and icon that updates to a success state when the text has been copied. ```tsx // index.tsx import { ClipboardWithIconText } from "flowbite-react" export function Component() { return (
); } ``` ## Theme To learn more about how to customize the appearance of components, please see the [Theme docs](https://flowbite-react.com/docs/customize/theme.md). ```json { "button": { "base": "inline-flex w-full items-center justify-center rounded-lg bg-blue-700 px-5 py-3 hover:bg-blue-800 focus:outline-none focus:ring-4 focus:ring-blue-300 dark:bg-blue-600 dark:hover:bg-blue-700 dark:focus:ring-blue-800", "label": "text-center text-sm font-medium text-white sm:w-auto" }, "withIcon": { "base": "absolute end-2 top-1/2 inline-flex -translate-y-1/2 items-center justify-center rounded-lg p-2 text-gray-500 hover:bg-gray-100 dark:text-gray-400 dark:hover:bg-gray-800", "icon": { "defaultIcon": "h-4 w-4", "successIcon": "h-4 w-4 text-blue-700 dark:text-blue-500" } }, "withIconText": { "base": "absolute end-2.5 top-1/2 inline-flex -translate-y-1/2 items-center justify-center rounded-lg border border-gray-200 bg-white px-2.5 py-2 text-gray-900 hover:bg-gray-100 dark:border-gray-600 dark:bg-gray-800 dark:text-gray-400 dark:hover:bg-gray-700", "icon": { "defaultIcon": "me-1.5 h-3 w-3", "successIcon": "me-1.5 h-3 w-3 text-blue-700 dark:text-blue-500" }, "label": { "base": "inline-flex items-center", "defaultText": "text-xs font-semibold", "successText": "text-xs font-semibold text-blue-700 dark:text-blue-500" } } } ``` ## References - [Flowbite Datepicker](https://flowbite.com/docs/components/clipboard/) --- ## Datepicker # React Datepicker - Flowbite > Use the datepicker component to select a date from a calendar view based on an input element by selecting the day, month, and year values using React and Tailwind CSS The Datepicker component from Flowbite React is an advanced UI element that you can use to allow users to pick a date from a calendar view by selecting the day, month, and year values which then will be available in the input field and state of the component. Follow the examples below to see how you can use the Datepicker component by importing it from the Flowbite React library, customize the colors and behaviour of the component by overriding the default theme variables and using the props from React. Import the component from `flowbite-react` to use the datepicker element: ```jsx import { Datepicker } from "flowbite-react"; ``` ## Default Datepicker Use this example to show a simple datepicker component. ```tsx // index.tsx import { Datepicker } from "flowbite-react"; export function Component() { return ; } ``` ## Localization Use the `language` prop to set the language of the datepicker component. The `labelTodayButton` and `labelClearButton` can also be used to update the text of the buttons. ```tsx // index.tsx import { Datepicker } from "flowbite-react"; export function Component() { return ; } ``` ## Filter dates You can use the `filterDate` prop to filter out specific dates from the datepicker component. This is useful if you want to disable certain dates or only allow selection of weekdays, for example. The `Views` enum can be used to determine the current view of the datepicker, such as `Days`, `Months`, `Years` or `Decades`. ```tsx // index.tsx "use client"; import { Datepicker, Views } from "flowbite-react"; export function Component() { const filterFn = (date: Date, view: Views) => { if (view === Views.Days) { const day = date.getDay(); return day >= 1 && day <= 5; } return true; }; return ; } ``` ## Limit the date By using the `minDate` and `maxDate` props you can limit the date range that the user can select. ```tsx // index.tsx import { Datepicker } from "flowbite-react"; export function Component() { return ; } ``` ## Week start The `weekStart` prop can be used to set the first day of the week inside the datepicker component. ```json { "0": "Sunday", "1": "Monday", "2": "Tuesday", "3": "Wednesday", "4": "Thursday", "5": "Friday", "6": "Saturday" } ``` ```tsx // index.tsx import { Datepicker } from "flowbite-react"; export function Component() { return ( ); } ``` ## Autohide By setting the `autoHide` prop you can either enable or disable automatically hiding the datepicker component when selecting a value. ```tsx // index.tsx import { Datepicker } from "flowbite-react"; export function Component() { return ; } ``` ## Title You can use the `title` prop to set a title for the datepicker component. ```tsx // index.tsx import { Datepicker } from "flowbite-react"; export function Component() { return } ``` ## Inline Use the `inline` prop to show the datepicker component without having to click inside an input field. ```tsx // index.tsx import { Datepicker } from "flowbite-react"; export function Component() { return ; } ``` ## Controlled Date/Datepicker. Use ``. Pass `null` to clear the input. ## Theme To learn more about how to customize the appearance of components, please see the [Theme docs](https://flowbite-react.com/docs/customize/theme.md). ```json { "root": { "base": "relative" }, "popup": { "root": { "base": "absolute top-10 z-50 block pt-2", "inline": "relative top-0 z-auto", "inner": "inline-block rounded-lg bg-white p-4 shadow-lg dark:bg-gray-700" }, "header": { "base": "", "title": "px-2 py-3 text-center font-semibold text-gray-900 dark:text-white", "selectors": { "base": "mb-2 flex justify-between", "button": { "base": "rounded-lg bg-white px-5 py-2.5 text-sm font-semibold text-gray-900 hover:bg-gray-100 focus:outline-none focus:ring-2 focus:ring-gray-200 dark:bg-gray-700 dark:text-white dark:hover:bg-gray-600", "prev": "", "next": "", "view": "" } } }, "view": { "base": "p-1" }, "footer": { "base": "mt-2 flex space-x-2", "button": { "base": "w-full rounded-lg px-5 py-2 text-center text-sm font-medium focus:ring-4 focus:ring-primary-300", "today": "bg-primary-700 text-white hover:bg-primary-800 dark:bg-primary-600 dark:hover:bg-primary-700", "clear": "border border-gray-300 bg-white text-gray-900 hover:bg-gray-100 dark:border-gray-600 dark:bg-gray-700 dark:text-white dark:hover:bg-gray-600" } } }, "views": { "days": { "header": { "base": "mb-1 grid grid-cols-7", "title": "h-6 text-center text-sm font-medium leading-6 text-gray-500 dark:text-gray-400" }, "items": { "base": "grid w-64 grid-cols-7", "item": { "base": "block flex-1 cursor-pointer rounded-lg border-0 text-center text-sm font-semibold leading-9 text-gray-900 hover:bg-gray-100 dark:text-white dark:hover:bg-gray-600", "selected": "bg-primary-700 text-white hover:bg-primary-600", "disabled": "text-gray-500" } } }, "months": { "items": { "base": "grid w-64 grid-cols-4", "item": { "base": "block flex-1 cursor-pointer rounded-lg border-0 text-center text-sm font-semibold leading-9 text-gray-900 hover:bg-gray-100 dark:text-white dark:hover:bg-gray-600", "selected": "bg-primary-700 text-white hover:bg-primary-600", "disabled": "text-gray-500" } } }, "years": { "items": { "base": "grid w-64 grid-cols-4", "item": { "base": "block flex-1 cursor-pointer rounded-lg border-0 text-center text-sm font-semibold leading-9 text-gray-900 hover:bg-gray-100 dark:text-white dark:hover:bg-gray-600", "selected": "bg-primary-700 text-white hover:bg-primary-600", "disabled": "text-gray-500" } } }, "decades": { "items": { "base": "grid w-64 grid-cols-4", "item": { "base": "block flex-1 cursor-pointer rounded-lg border-0 text-center text-sm font-semibold leading-9 text-gray-900 hover:bg-gray-100 dark:text-white dark:hover:bg-gray-600", "selected": "bg-primary-700 text-white hover:bg-primary-600", "disabled": "text-gray-500" } } } } } ``` ## References - [Flowbite Datepicker](https://flowbite.com/docs/plugins/datepicker/) --- ## Drawer # React Drawer (offcanvas) - Flowbite > The Drawer component can be used as a hidden off-canvas sidebar for navigation and to show other information based on multiple styles and placements Use the Drawer component (or "off-canvas") to show a fixed element relative to the document page from any side for navigation, contact forms, informational purposes or other user actions. You can set multiple options such as the placement, activate body scrolling, show or hide the backdrop and even use the swipeable edge functionality to show a small part of the drawer when it is not shown completely. To start using the drawer component you need to import it from `flowbite-react`: ```jsx import { Drawer } from "flowbite-react"; ``` ## Default drawer ```tsx // index.tsx "use client"; import { Button, Drawer, DrawerHeader, DrawerItems } from "flowbite-react"; import { useState } from "react"; export function Component() { const [isOpen, setIsOpen] = useState(true); const handleClose = () => setIsOpen(false); return ( <>

Supercharge your hiring by taking advantage of our  limited-time sale  for Flowbite Docs + Job Board. Unlimited access to over 190K top-ranked candidates and the #1 design job board.

); } ``` ## Drawer navigation Use this example to show a navigational sidebar inside the drawer component. ```tsx // index.tsx "use client"; import { Button, Drawer, DrawerHeader, DrawerItems, Sidebar, SidebarItem, SidebarItemGroup, SidebarItems, TextInput, } from "flowbite-react"; import { useState } from "react"; import { HiChartPie, HiClipboard, HiCollection, HiInformationCircle, HiLogin, HiPencil, HiSearch, HiShoppingBag, HiUsers, } from "react-icons/hi"; export function Component() { const [isOpen, setIsOpen] = useState(true); const handleClose = () => setIsOpen(false); return ( <>
<>} />
Dashboard Products Users list Sign in Sign up Docs Components Help
); } ``` ## Contact form Use this example to show a contact form inside the drawer component. ```tsx // index.tsx "use client"; import { Button, Drawer, DrawerHeader, DrawerItems, Label, Textarea, TextInput } from "flowbite-react"; import { useState } from "react"; import { HiEnvelope } from "react-icons/hi2"; export function Component() { const [isOpen, setIsOpen] = useState(true); const handleClose = () => setIsOpen(false); return ( <>