Filter Builder

An enterprise-grade, highly customizable dynamic filter builder. It empowers users to create complex query rules with nested AND/OR logic, making it the perfect companion for advanced data tables, search interfaces, and CRM dashboards.

Complex Premium Plan

Availability

Included in Premium Plans

This flagship component is part of Future UI's monthly & yearly Premium plans and is not distributed via the free public CLI.

Import

import { DEFAULT_OPERATORS } from "@/components/ui/filter-builder"
Layout Variant
Color Theme

Named Keys & Props

Pass these exact named keys as props on <DEFAULT_OPERATORS />. Click any color pill to copy the prop.

colorDefault is "default"(Black & White)
variantVisual style
"solid""outline""ghost""link"
themeSurface theme
"default""modern""clean""futuristic""brutal""halftone"
shapeCorner shape
"default""square""rounded""sharp"
spacingInner spacing
"default""2x""4x""6x""8x"
sizeComponent size
"default""sm""md""lg""xl""full"

Usage Example

A basic implementation example to get you started.

Example Implementation
import { FilterBuilder, createEmptyGroup } from"@/components/ui/filter-builder";
import { useState } from"react";

// 1. Define the fields available to your users
const myFields = [
 { id:"status", label:"Status", type:"select", options: [
 { value:"todo", label:"To Do"},
 { value:"done", label:"Done"}
 ]},
 { id:"email", label:"Email Address", type:"text"},
 { id:"created_at", label:"Date Created", type:"date"}
];

export default function AdvancedSearch() {
 // 2. Initialize with an empty group or persisted data
 const [data, setData] = useState(() => createEmptyGroup(myFields));

 // 3. Render the builder and listen for onChange events
 return (
 <div className="p-6 bg-background rounded-xl border">
 <FilterBuilder 
 initialData={data} 
 onChange={(newData) => {
 setData(newData);
 console.log("New Query State:", newData);
 }} 
 fields={myFields}
 variant="solid"
 theme="modern"
 color="default"
 />
 </div>
 );
}

Features

Key capabilities and highlights.

Key Capabilities
  • ◆Nested Groups: Supports unlimited levels of nested AND/OR logic groups to handle complex query requirements.
  • ◆Headless Architecture: Powered by a robust Context API that separates state management from presentation.
  • ◆Drag & Drop: Features clean HTML5 native drag-and-drop for reordering rules and groups without heavy external dependencies.
  • ◆Animations: Fully animated with Framer Motion, providing buttery smooth state transitions when adding, removing, or reordering rules.
  • ◆Custom Dropdowns: Includes a built-in headless dropdown system that perfectly matches all 5 aesthetic variants.
  • ◆Variants: Supports Default (SaaS), Minimal (Clean), Enterprise (High Contrast), Compact (Dense Data), and Glass (Premium Translucent) themes.
  • ◆Data Agnostic: Outputs a clean, serialized JSON tree that can be easily parsed into SQL, MongoDB queries, or API payloads.

Notes

Important implementation details to consider.

Implementation Details
  • ◆Plan: Included in Future UI Monthly & Yearly Premium Plans.
  • ◆Setup Fields: Define your schema using the'FilterField'type. Supported types include'text','number','date','select','boolean', etc.
  • ◆State Management: The component expects an'initialData'object of type'FilterGroup'. It emits changes via the'onChange'callback.
  • ◆Custom Operators: While it ships with default operators (Equals, Contains, GT, LT, etc.), you can override them by passing your own'operators'array.
  • ◆Variants: Use the'variant'prop to instantly switch the visual aesthetic to match your specific dashboard design.