Record Chip

A link to a record, like a contact, a matter, a folder or a LEAP card: a small square chip (24 px, 4 px radius). Values and labels use the round Tag instead.

BetaReady to use. Its API can still change in a minor release; the changelog says when.

import { RecordChip, RecordChipGroup } from "@leap-crm/design-system";

Playground

Change a prop and the component follows. Its code is under Props.

Jane Citizen

Props

label
icon
onRemove

Best practices

When to use it, and the rules that apply in particular places.

GuidancePractice
DoUse it to point at another record, like a matter's client or a linked contact, with href so the name opens the record.
DoPass an icon for the record's kind, like a person for a contact and a briefcase for a matter, so two records with similar names are told apart.
DoWrap chips that come and go in RecordChipGroup, so a removed chip fades and the row closes up behind it.
DoLet long names truncate. The name goes through Truncate, so the full name shows on hover in a narrow panel.
Don'tUse it for a value or a label, like a practice area. Use the round Tag, so a link to a record and a label never look alike.

Props

RecordChip

PropTypeDefaultDescription
label *string—The record's name, like a contact or a matter.
iconReactNode—A 14 px icon for the record's kind.
hrefstring—Makes the chip a link to the record.
onRemove() => void—Shows a remove × after the name. Called when it's pressed.
removeLabelstring—The remove button's name. "Remove <label>" by default.
classNamestring—Classes added to the root element, merged with its own. Tokens only.

RecordChipGroup

PropTypeDefaultDescription
children *ReactNode—The chips, each with a key, like a matter's people. One added or removed opens or closes its own space.
gapRowGap8The gap between chips, in px: 4, 6 or 8 (the default).
classNamestring—Classes added to the root element, merged with its own. Tokens only.

Code

What the playground shows, ready to copy.

import { PlusIcon, RecordChip } from "@leap-crm/design-system";

<RecordChip label="Jane Citizen" icon={<PlusIcon />} />

Keyboard

The keys it answers to. Tab moves between components, arrows move within them.

KeysWhat they do
EnterFollows a chip that is a link.
EnterSpacePresses a chip's button, like its remove ×.