A compact, anchor-based tag — optionally a link and/or removable.
Use Chip for tags, filters, selected values, or small inline labels. Like Button it is anchor-based (built on the same useAnchorProps engine), so it can act as a link (href / as={Link}) or as a button (onClick / type="submit"), and it can render a remove control via onClose.
There is no @uxf/form twin. For a static, non-interactive status label use Lozenge; for a numeric count use Badge.
import { Chip } from "@uxf/ui/chip";
// plain tag
<Chip color="blue">Marketing</Chip>
// removable
<Chip color="green" onClose={() => removeTag(id)}>Design</Chip>
// link
import Link from "next/link";
<Chip as={Link} color="blue" href="/tags/news">News</Chip>
Extends Omit<AnchorHTMLAttributes<HTMLAnchorElement>, "color" | "type"> and UseAnchorProps, so standard <a> attributes (href, target, rel, download, onClick, className, children, …) are accepted.
| Prop | Type | Default | Description |
|---|---|---|---|
color | ChipColor | "default" | Color scheme. |
size | ChipSize | "default" | Size. |
variant | ChipVariant | "default" | Visual emphasis. |
onClose | MouseEventHandler | — | When set, renders a remove button; called on click (its own click is stopped from propagating). |
suppressFocus | boolean | false | Sets tabIndex={-1} on the chip and its remove button (removes them from the tab order). |
as | "a" | NextLink | "a" | Element to render. Pass Next.js Link for client-side navigation. |
analyticsCallback | () => void | — | Called when the chip is activated (from UseAnchorProps). |
isDisabled | boolean | false | Non-interactive state (from UseAnchorProps). |
isLoading | boolean | false | Busy state (from UseAnchorProps). |
type | "submit" | — | Submits the closest <form> on activation. The only accepted type. |
A string child is wrapped in <span class="uxf-chip__text">; other children are rendered as-is.
Built-in values (from theme.ts):
| Group | Values |
|---|---|
color | default, primary, orange, red, yellow, pink, purple, indigo, green, blue |
size | small, default, large |
variant | low, medium, default |
ChipColors, ChipSizes and ChipVariants are open interfaces, so a project can add its own values via module augmentation:
// chip.d.ts
declare module "@uxf/ui/chip/theme" {
interface ChipColors {
brand: true;
}
}
Interactive behaviour comes from useAnchorProps (same as Button): with href it is a link, with onClick or type="submit" it gets role="button", and rel="noopener noreferrer" is added automatically for target="_blank". isDisabled / isLoading drive the busy/disabled classes and remove it from the tab order.
Client component ("use client").
Import the component stylesheet once in your global CSS:
@import url("@uxf/ui/css/chip.css");
Also requires the global @uxf/ui token layer, set up once per app — see @uxf/ui setup.
The remove button's label is resolved via useUxfTranslation under the uxf-ui-chip:remove-item key (translations shipped in translations.ts).