bypaws

Chip

Component

About

A small pill-shaped label used as a toggleable filter, a removable applied-filter tag, or a static tag, with optional icon and tone colors.

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

Code

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

Usage.tsx

"use client";

import Chip, { ChipGroup } from "@/components/ui/chip";
import { useState } from "react";

const APPLIED = [
  { id: "facility", label: "Facility: Valley-1" },
  { id: "priority", label: "Priority: high" },
  { id: "assignee", label: "Assignee: Gleb Sorokin" },
  { id: "due", label: "Due: this week" },
];

export default function RemovableChipsDemo() {
  const [applied, setApplied] = useState(APPLIED.map((a) => a.id));
  return (
    <div className="flex min-h-[160px] w-full items-center justify-center p-8">
      <ChipGroup aria-label="Applied filters">
        {APPLIED.filter((a) => applied.includes(a.id)).map((a) => (
          <Chip
            key={a.id}
            onRemove={() => setApplied((cur) => cur.filter((x) => x !== a.id))}
          >
            {a.label}
          </Chip>
        ))}
        {applied.length === 0 ? (
          <span className="ev-muted">No filters.</span>
        ) : null}
      </ChipGroup>
    </div>
  );
}

Dependencies

More by bypaws

View all
  • Popover

    Popover