• CMSnpm version

    • Overview
    • ContentBuilder
    • InviteUserForm
    • LoginForm
    • RenewPasswordForm
  • UInpm version

    • Overview
    • Accordion
    • AlertBubble
    • AnnouncementBar
    • Avatar
    • AvatarFileInput
    • Badge
    • Button
    • ButtonGroup
    • ButtonList
    • Calendar
    • Checkbox
    • CheckboxButton
    • CheckboxInput
    • CheckboxList
    • Chip
    • ColorRadio
    • ColorRadioGroup
    • Combobox
    • DatePicker
    • DatePickerInput
    • DateRangePicker
    • DateRangePickerInput
    • DatetimePicker
    • DatetimePickerInput
    • Dialog
    • Dropdown
    • Dropzone
    • ErrorMessage
    • FileInput
    • FlashMessages
    • FormComponent
    • Icon
    • IconButton
    • ImageGallery
    • InfoBox
    • Input
    • Label
    • Layout
    • Lightbox
    • ListItem
    • Loader
    • Lozenge
    • Menu
    • Message
    • Modal
    • ✅ ModalDialog
    • ✅ ModalHeader
    • MultiCombobox
    • MultiSelect
    • Pagination
    • Paper
    • Popover
    • Radio
    • RadioGroup
    • RasterImage
    • Select
    • ✅ Tabs
    • TextInput
    • TextLink
    • Textarea
    • TimePicker
    • TimePickerInput
    • Toggle
    • Tooltip
    • Typography
  • Formnpm version

    • Overview
    • AvatarFileInput
    • CheckboxButton
    • CheckboxInput
    • CheckboxList
    • ColorRadioGroup
    • Combobox
    • DatePickerInput
    • DateRangePickerInput
    • DatetimePickerInput
    • Dropzone
    • FileInput
    • Form
    • FormRenderer
    • GpsInput
    • MoneyInput
    • MultiCombobox
    • MultiSelect
    • NumberInput
    • PasswordInput
    • RadioGroup
    • Select
    • TextInput
    • Textarea
    • TimePickerInput
    • Toggle
  • DataGridnpm version

    • Overview
    • DataGrid
    • DataGridCustomExample
    • ExportButton
    • FilterList
    • Filters
    • FiltersButton
    • FulltextInput
    • HiddenColumns
    • HiddenColumnsButton
    • Pagination
    • RowCounts
    • RowsPerPageSelect
    • SelectedRowsToolbar
    • TableV2
    • ToolbarControl
    • ToolbarCustoms
    • ToolbarTabs
  • Wysiwygnpm version

    • Overview
  • Resizernpm version

    • Overview
  • Routernpm version

    • Overview
  • Corenpm version

    • Overview
  • Core-Reactnpm version

    • Overview
  • Stylesnpm version

    • Overview
  • Localizenpm version

    • Overview
  • Analyticsnpm version

    • Overview
  • Datepickernpm version

    • Overview
  • Icons-generatornpm version

    • Overview
  • Smart-addressnpm version

    • Overview
  • E2Enpm version

    • Overview
  • E2E-Playwrightnpm version

    • Overview
View source on GitLab

Chip

A compact, anchor-based tag — optionally a link and/or removable.

When to use

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.

Usage

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>

Props

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.

Variants & states

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.

Requirements

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).

Default
Open in new tab