Getting Started
Overview
Filter Sphere is a library for building filtering interfaces. It provides a set of components that you can use to build your own filtering interface.
Usage Summary
-
Install the Filter Sphere package using your favorite package manager:
Terminal window pnpm add @fn-sphere/filterTerminal window npm install @fn-sphere/filterTerminal window yarn add @fn-sphere/filter -
Filter Sphere uses zod to define your data schema. If not installed, run the following command:
Terminal window pnpm add zodTerminal window npm install zodTerminal window yarn add zod -
Define your data with zod. For example
const YOUR_DATA_SCHEMA = z.object({id: z.number(),name: z.string(),}); -
Start building your filtering interface with Filter Sphere components.
import {FilterSphereProvider,FilterBuilder,useFilterSphere,} from "@fn-sphere/filter";import { z } from "zod";// Define your data schemaconst schema = z.object({id: z.number(),name: z.string(),});export default function AdvancedFilter() {const { filterRule, predicate, context } = useFilterSphere({ schema });return (<FilterSphereProvider context={context}><FilterBuilder /></FilterSphereProvider>);}
Next Steps
- Install one of the out-of-the-box themes or create your own following the Theme Customization Guide.
- Check out our Example Guide for practical implementations.
- Explore the API Reference for detailed component information.