All components

Badge with Dismiss

Badge with Dismiss is a React and Tailwind CSS feedback component from Bund UI, licensed MIT. Copy it and paste it into your project.

Bund UI MIT feedback

What it is

Badge with Dismiss is a React and Tailwind CSS feedback component from Bund UI, licensed MIT. Copy it and paste it into your project.

How to use it

Open it in the catalogue, press copy, and paste it into your project. The prompt you copy carries the code and the rules that tell your agent to reproduce it without changing anything.

Open in the catalogue

Five free copies a month. No card.

Needs

npm i lucide-react

Licence

This component comes from Bund UI and is redistributed under the MIT licence, which permits commercial use. The copyright notice travels with the code.

Badge with Dismiss

examples/components/badge/with-dismiss/page.tsx
"use client";

import { useState } from "react";
import { Badge } from "@/components/ui/badge";
import { XIcon } from "lucide-react";

export default function BadgeWithDismiss() {
  const [badges, setBadges] = useState([
    { id: 1, label: "Next.js" },
    { id: 2, label: "Tailwind CSS" },
    { id: 3, label: "Laravel" }
  ]);

  function removeBadge(id: number) {
    setBadges((prev) => prev.filter((badge) => badge.id !== id));
  }

  return (
    <div className="flex items-center justify-center gap-2">
      {badges.map(({ id, label }) => (
        <Badge
          key={id}
          variant="secondary"
          className="flex cursor-pointer items-center gap-1 hover:opacity-80"
          onClick={() => removeBadge(id)}>
          {label}
          <XIcon className="size-3" />
        </Badge>
      ))}
    </div>
  );
}

Similar components