# 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 (
);
}
```
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.
);
}
```
## 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.
);
}
```
## 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 Greenname@flowbite.comDashboardSettingsEarningsSign 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 (
DefaultDarkFailureSuccessWarningIndigoPurplePink
);
}
```
## 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 (
);
}
```
## 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 (
);
}
```
## 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 (
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
ProjectsFlowbite 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
ProjectsFlowbite 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 `