Skip to Content
BBRICKSv0.7.4
KitPrimitives

ButtonLink

A link that looks like a Button (the mock's a.btn: "Contact TRNDR", "Export CSV", "See all", "Find creators"). It is a link, so Enter follows it and Space scrolls the page, as for any link. The words, arrows included, are the caller's. Copy key buttonLink (newTab); an aria-label you pass replaces the whole name, new-tab words included. An unsafe href draws a disabled link (role="link" aria-disabled, not focusable) with your other attributes.

import { ButtonLink } from '@ergasti/bricks';

Examples

Every Button variant and size, on an <a>: "Find creators", "See all →", a small "Export CSV" that downloads. The words, arrows included, are yours.

Code
import { ButtonLink } from '@ergasti/bricks';

function Links() {
  return (
    <div style={{ display: 'flex', flexWrap: 'wrap', gap: 12, alignItems: 'center' }}>
      <ButtonLink href="#find" variant="rasp">Find creators</ButtonLink>
      <ButtonLink href="#all" variant="ghost">See all →</ButtonLink>
      <ButtonLink href="/brand/creators.csv" size="sm" download>Export CSV</ButtonLink>
      <ButtonLink href="/receipts/88531.pdf" size="sm" download="receipt-88531.pdf">Receipt</ButtonLink>
    </div>
  );
}

External and unsafe

external opens a new tab (rel="noopener noreferrer") and tells assistive tech "(opens in a new tab)". An unsafe href from data (javascript:) keeps the words but draws a disabled button with no link.

Code
import { ButtonLink } from '@ergasti/bricks';

function ExternalAndUnsafe() {
  return (
    <div style={{ display: 'flex', flexWrap: 'wrap', gap: 12, alignItems: 'center', background: 'var(--ink)', borderRadius: 18, padding: 20 }}>
      <ButtonLink href="https://wa.me/201000000000" variant="lime" size="sm" external>Contact TRNDR</ButtonLink>
      <ButtonLink href="javascript:alert(1)" variant="white">Open full profile</ButtonLink>
    </div>
  );
}

Props

Prop

Type

Also accepts the react and dom attributes of the element it renders; they are passed through.

Labels

Every word this component draws, in both languages. Override one per component and language with BricksProvider labels under the key buttonLink, or with the component's own prop where it has one. A {name} is a value the component fills in.

buttonLink
KeyEnglishArabic
newTab(opens in a new tab)(بيفتح في تاب جديدة)

Design guidance

How the BRICKS design system uses ButtonLink. Written in docs/content/components/ButtonLink.md; the props above are read from the code, which wins where the two disagree.

A link styled exactly like a Button; use it when the action goes somewhere (a page, a new tab, a file download) rather than doing something in place.

ButtonLink is the mock's a.btn ("Contact TRNDR", "Export CSV", "See all →", "Find creators"). It shares Button's class list, so the two never look different, but it stays a link: Enter follows it and Space scrolls the page. Every href passes through safeHref; an unsafe URL (javascript:, data:) renders the words as a disabled, unfocusable link with no href.

Anatomy

  1. Link (a.kit-btn, no underline) with the Button look.
  2. Label: children, arrows included (the caller's words).
  3. New-tab text (span.kit-sr, with external): "(opens in a new tab)" for assistive tech only.

Variants

Same variant and size values as Button:

variantLookTypical link
'default'White, line"See all →", "Export CSV"
'ink'Solid inkPrimary neutral navigation
'rasp'Solid raspberry"Find creators" (Home empty state)
'white'White on darkHero links
'ghost'Text onlyLow-emphasis "See all"
'lime'Lime, olive textSidebar "Contact TRNDR"
'on-dark'White outlineHero "Where it went"
'danger'Red textRare
'ok'GreenRare

size: 'md' (default) or 'sm'.

Behaviour propEffectWhen
externaltarget="_blank", rel="noopener noreferrer", hidden "(opens in a new tab)"WhatsApp / outside sites
downloadtrue keeps the server's file name, a string names itCSV exports, receipts

States

StateTriggerLook
Default / hover / focus-visible / activeas Buttonas Button (--focus-ring)
Unsafe hrefhref fails safeHref<span role="link" aria-disabled="true">, kit-btn--off (50 % opacity), not focusable, onClick dropped
ExternalexternalOpens a new tab; the name includes the new-tab words

Usage

<Card.Header title="Top creators this month" actions={<ButtonLink size="sm" href="/brand/creators">See all →</ButtonLink>} />

The sidebar's support link:

<SidebarCard title="Need help?" action={<ButtonLink variant="lime" size="sm" external href="https://wa.me/201000000000">Contact TRNDR</ButtonLink>} />

A CSV export in a list toolbar:

<ListToolbar search={search} sort={sort}
  actions={<ButtonLink size="sm" download href="/api/brand/creators.csv">Export CSV</ButtonLink>} />

Where it appears

  • Brand › sidebar › "Contact TRNDR" card.
  • Brand › Home › "See all" links, empty state "Find creators".
  • Brand › Creators / Payments › "Export CSV".
  • Screens: Home, Creators, Payments › Wallet.

Guidelines

Do

  • Use ButtonLink for navigation and downloads; Button for in-place actions.
  • Put arrows in the label ("See all →") and mirror them in Arabic copy.
  • Mark outside links external.

Don't

  • Don't build href from user input without expecting the disabled fallback.
  • Don't pass a blob: URL to download; point at the server's export.

RTL and Arabic

  • Same as Button: the label's arrow is yours to flip.

Tokens

Same as Button: --control-h, --line, --card, --ink, --rasp, --rasp-d, --lime, --olive, --disabled-opacity, --focus-ring, …

Accessibility

  • A real <a href>: Enter follows it; screen readers announce "link".
  • external adds "(opens in a new tab)" / "(بيفتح في تاب جديدة)" as hidden text, unless you pass aria-label.
  • The unsafe fallback is role="link" + aria-disabled="true", not focusable, so keyboard users never land on a dead link.

Found in the source

  • Roles in the markup: link.
  • ARIA attributes set: aria-disabled.
  • Its tests cover: “has the same classes as Button for every variant and size”; “is a real link (role link) to the href, without target by default”; “Arabic + RTL: the new-tab words in Arabic; provider labels override them”; “passes other anchor props through and is reachable with Tab; Enter follows it”; “no rule dims every .kit-btn[aria-disabled]: a busy <Button aria-disabled> (TopUpAmountPicker) keeps its look”.

Read from the component's source and tests. See Accessibility for the patterns the library follows.

See also: Avatar · AvatarStack · CouponChip

Source

src/kit/primitives/Button.tsx (line 53) on GitHub.

On this page