CopyLink
The link cell: a mono LTR URL that copies itself on click and says so.
import { CopyLink } from '@ergasti/bricks';Examples
Main cell and copy link
The first cell of an older table row (a name, a hint, an optional button to open it), and the small "copy link" control.
Code
import { CopyLink, MainCell } from '@ergasti/bricks';
function Cells() {
return (
<div style={{ display: 'flex', gap: 24, alignItems: 'center', flexWrap: 'wrap' }}>
<MainCell id={1} name="Laila Saeed" hint="201 orders" onOpen={() => {}} />
<CopyLink url="https://trndr.app/join/hushup" />
</div>
);
}Props
Prop
Type
Labels
Every word this component draws, in both languages. Override one per component and language with BricksProvider labels under the key copyLink, or with the component's own prop where it has one. A {name} is a value the component fills in.
| Key | English | Arabic |
|---|---|---|
copy | Copy {url} | انسخ {url} |
done | Copied | اتنسخ |
failed | Couldn't copy | معرفناش ننسخ |
Design guidance
How the BRICKS design system uses CopyLink. Written in docs/content/components/CopyLink.md; the props above are read from the code, which wins where the two disagree.
A table cell showing a URL in mono that copies itself when clicked and says "Copied"; use it in 0.1.x-style link columns.
CopyLink is the console's link cell: the URL as a link-styled button (12.5px mono, LTR, one line with ellipsis) and a polite live line under it that reads "Copied" or "Couldn't copy" for two seconds. The v3 screens use CopyLinkField (a field with a Copy button) for the invite link; CopyLink stays for compact table cells.
Anatomy
- Wrapper (
span.kit-copy): column,min-width: 0. - URL button (
button.kit-lnk.kit-mono,dir="ltr"): ellipsis on overflow. - Result (
span.kit-sub,aria-live="polite").
Variants
None.
States
| State | Trigger | Look |
|---|---|---|
| Default | — | URL as a link |
| Hover | pointer | Accent-dark, underlined |
| Focus-visible | Tab | Shared kit focus ring |
| Copied | clipboard OK | "Copied" / "اتنسخ" for 2000 ms |
| Failed | clipboard denied | "Couldn't copy" / "معرفناش ننسخ" |
| Long URL | wider than cell | Ellipsis; full URL in the accessible name |
Usage
interface Brand { id: number; name: string; slug: string }
const columns: DataColumn<Brand>[] = [
{ key: 'name', label: 'Brand', primary: true, render: (b) => <b>{b.name}</b> },
{ key: 'link', label: 'Join link', render: (b) => <CopyLink url={`https://trndr.app/join/${b.slug}`} /> },
];
const brands: Brand[] = [{ id: 1, name: 'HushUp', slug: 'hushup' }];
<DataTable label="Brands" columns={columns} rows={brands} rowKey={(b) => b.id} /><CopyLink url="https://trndr.app/join/hushup" />Where it appears
- 0.1.x console link columns. The v3 Brand › Home invite link uses
CopyLinkField. - Kit gallery.
Guidelines
Do
- Use it where the URL itself is the content of the cell.
Don't
- Don't use it for links people follow; use
ButtonLinkor a plain link.
RTL and Arabic
- URL forced LTR; result text follows the page.
Tokens
--color-text-primary, --color-accent-dark (link hover).
Accessibility
- The URL is a native
<button>named "Copy {url}" ("انسخ {url}"), so the name says the action and the full link even when the visible text is cut with an ellipsis. - The result line is an
aria-live="polite"span that is always in the DOM (empty until used), so "Copied" / "Couldn't copy" is announced after a click, then cleared after 2 seconds. - Focus: the shared link ring (
--focus-ringwith a small radius). On touch screens (≤1024px) the button gets a 44px hit area.
Found in the source
- ARIA attributes set:
aria-label,aria-live. - Its tests cover: “uses ARIA table roles with a labelled table and column headers”; “Enter on a row opens its drawer and keeps it open (Z2 QA: the Enter fell through to the drawer\”; “gives every cell its column label for the < 860px card layout”.
Read from the component's source and tests. See Accessibility for the patterns the library follows.
Related
CopyLinkField: the v3 field + Copy button.CouponChip copyable: copying a code.
See also: Avatar · MainCell · BulkBar · CreatorCell · DataTable · FilterChips
Source
src/kit/Table.tsx (line 23) on GitHub.