Link button

A text-only button for low-emphasis actions and for going somewhere.

import { LinkButton } from '@halo-ds/react';

When to use it

Use a link button for secondary actions and navigation that should not compete with buttons: "Forgot password?", "View all", "Learn more". It is just text, with an optional icon on either side, and it underlines when you point at it or reach it with the keyboard.

Link buttons come in two types and two sizes, with four states.

Do

  • Write labels that say where it goes: "View all projects", not "Click here".
  • Use a trailing arrow for links that take you somewhere.
  • Keep link buttons for secondary actions; use a Button for the main one.
  • Use Destructive only for actions that remove something.

Don't

  • Use a link button for the main action on a screen.
  • Put several link buttons side by side as a menu; use navigation instead.
  • Remove the underline on hover or focus.
  • Use vague labels like "Here" or "More".

Link button or Button?

Choose by how much attention the action needs.

  • View all: Link button Navigation: going to another page or section. Low-emphasis actions next to content: "View all", "Edit". Places where a button would be too heavy.
  • Save changes: Button The main action on a screen: "Save", "Continue". Actions inside forms and dialogs. Anything that needs to stand out.

Props

LinkButton props

PropTypeWhat it does
variant`LinkButtonVariant \undefined`Brand purple or red. Figma: Type.
size`LinkButtonSize \undefined`md is 14px with 20px icons (default); sm is 12px with 16px icons. Figma: Size.
iconLeftReactNodeIcon before the label. Figma: Show L icon / Change L icon.
iconRightReactNodeIcon after the label. Figma: Show R icon / Change R icon.
children (required)ReactNodeThe link text. Figma: Label.
disabled`boolean \undefined`
classNames`Partial<Record<LinkButtonPart, string>> \undefined`Extra class names for the parts inside the component, by part name, like { header: 'my-header' }.
styles`Partial<Record<LinkButtonPart, CSSProperties>> \undefined`Inline styles for the parts inside the component, by part name, like { footer: { gap: 4 } }.
hrefundefined

It also takes the usual HTML attributes for its element.

Examples

Overview

import { LinkButton } from '@halo-ds/react';
import { ArrowRight, Trash } from '@phosphor-icons/react';

export default function Example() {
  return (
    <div style={{ display: 'flex', gap: 24 }}>
      <LinkButton href="#" iconRight={<ArrowRight />}>View all invoices</LinkButton>
      <LinkButton variant="destructive" iconLeft={<Trash />}>Remove</LinkButton>
    </div>
  );
}

Types and sizes

Primary and Destructive, in medium (14px) and small (12px).

import { LinkButton } from '@halo-ds/react';
import { ArrowRight } from '@phosphor-icons/react';

export default function Demo() {
  return (
    <div className="demo-row">
      <LinkButton href="#" iconRight={<ArrowRight />}>View all</LinkButton>
      <LinkButton href="#" size="sm" iconRight={<ArrowRight />}>View all</LinkButton>
      <LinkButton variant="destructive">Remove</LinkButton>
      <LinkButton variant="destructive" size="sm">Remove</LinkButton>
    </div>
  );
}

With icons

An arrow suggests going somewhere. An "open" icon marks links that leave the site.

import { LinkButton } from '@halo-ds/react';
import { ArrowLeft, ArrowSquareOut, DownloadSimple } from '@phosphor-icons/react';

export default function Demo() {
  return (
    <div className="demo-row">
      <LinkButton href="#" iconLeft={<ArrowLeft />}>Back to projects</LinkButton>
      <LinkButton iconLeft={<DownloadSimple />}>Download report</LinkButton>
      <LinkButton href="https://example.com" target="_blank" rel="noreferrer" iconRight={<ArrowSquareOut />}>Help centre</LinkButton>
    </div>
  );
}

Disabled

Disabled links turn grey and can not be followed.

import { LinkButton } from '@halo-ds/react';

export default function Demo() {
  return (
    <div className="demo-row">
      <LinkButton href="#" disabled>View invoice</LinkButton>
      <LinkButton variant="destructive" disabled>Remove</LinkButton>
    </div>
  );
}

Under a sign-in form

A small link button for the quieter action, next to the main button.

import { Button, InputField, LinkButton } from '@halo-ds/react';

export default function Demo() {
  return (
    <div className="demo-panel" style={{ display: 'grid', gap: 16, width: 320 }}>
      <InputField label="Email" placeholder="johndoe@example.com" defaultValue="ada@example.com" />
      <InputField label="Password" type="password" placeholder="••••••••" defaultValue="password" />
      <div style={{ display: 'flex', justifyContent: 'flex-end' }}>
        <LinkButton href="#" size="sm">Forgot password?</LinkButton>
      </div>
      <Button>Sign in</Button>
    </div>
  );
}

More: https://halodesignsystem.dev/components/link-button