alexander-rukin

Filter Chip

Component

About

A small toggleable button used to filter a list or switch between categories, with a rectangular "filter" look and a pill-shaped "tab" look that can show a count.

Built with React and Tailwind. Copy the prompt and paste it into Claude Code, Cursor or Lovable: your agent adds Filter Chip to your project and fits it to your theme.

Code

How Filter Chip is used: the demo's code. The component's own source comes with a free account.

Usage.tsx

import Chip from "@/components/ui/chip";
import { useTheme } from "@/components/ui/chip-utils/theme";
import { useState } from "react";

export default function ChipTabDemo() {
  const { C } = useTheme();
  const [active, setActive] = useState("Mine");
  const chips: { label: string; count: number }[] = [
    { label: "All", count: 24 },
    { label: "Mine", count: 8 },
    { label: "Important", count: 3 },
    { label: "Done", count: 13 },
  ];
  return (
    <div
      style={{
        display: "flex",
        gap: 8,
        flexWrap: "wrap",
        alignItems: "center",
        padding: 24,
        background: C.canvas,
      }}
    >
      {chips.map((c) => (
        <Chip
          key={c.label}
          label={c.label}
          variant="tab"
          count={c.count}
          active={c.label === active}
          onClick={() => setActive(c.label)}
        />
      ))}
    </div>
  );
}

More by alexander-rukin

View all
  • Carousel

    Carousel

    16
  • Combobox

    Combobox

  • Textarea

    Textarea

  • Tooltip

    Tooltip

  • Card

    Card

  • Range Slider

    Range Slider

  • Progress

    Progress

  • Kit Button

    Kit Button