Raft Design System

Components · Actions

TextLink

Text that underlines on hover, for the quietest control on a screen, an action or a way somewhere; the bottom step of the button ladder.

StableAlso called Link button, Text button
import { TextLink } from "@botiverse/raft-ui";

TextLink is text that does something or goes somewhere, with no underline until the pointer is over it. It is the bottom step of the emphasis ladder, below a frameless button (Button): use it where even a frameless button would be too much weight, such as Forgot password on a sign-in page, Sign out under a server list, or a See all beside a section title.

text-link/compositions/preview

When to use

SituationUse
The quietest control on a screen, alone or inside a sentenceTextLink
Cancel or a minor action inside a dialog, sheet, menu, popover or cardButton variant="ghost"
Cancel or a minor action on a pageButton variant="default"
A link inside rendered message or document contentThe Markdown link, in the link blue (Markdown)

Variants

The variant follows where the link sits, not how important the action is.

VariantUse for
variant="muted" (default)A link that stands on its own: Forgot password, Sign out, See all. foreground-muted, 500; on hover, ink and underlined.
variant="strong"A link inside a sentence: "Don't have an account? Create one", a banner's "Manage machines". Ink, 600; on hover, underlined in ink.

Why the position decides. On its own, a TextLink is the quietest control on the screen, so it is muted: it must not compete with the screen's text or its buttons. Inside a sentence, the same muted grey would sit lighter than the words around it and read as disabled, so there it takes the ink of body text and stands out by weight instead. Neither variant is pink, at rest or on hover: pink belongs to the one primary button.

Why the underline comes on hover. The underline is the hover signal for every piece of clickable text in raft-ui, so people learn it once (Clickable text). At rest, the weight and color above and where the link sits say it can be clicked; an underline on every quiet control would add a line under each of them on a screen that is read for hours.

States

  • Hover: the text underlines in its own color, 1.5px thick, 3px below the baseline; a muted link also turns ink.
  • Disabled: the text turns foreground-disabled and nothing changes on hover, so it no longer reads as something to press.
text-link/compositions/disabled
  • Focus: the shared focus ring (States), on a 2px radius.

Behavior

  • TextLink has no size of its own: it takes the size and line height of the text around it, so it sits on the baseline inside a sentence and cannot make the line taller. Standing alone, give its container the text size.
  • It has no box, padding or minimum height. Don't put it where it is the only thing a finger must hit on a phone; that needs a Button. On a touch screen it also has no hover underline, so alone it reads as plain text. A link at the start of a dialog's footer is one of these places in a phone sheet: there it becomes a full-width outline Button by itself (Dialog).

In a sentence

A button is one box in the line, so it can't break: when it doesn't fit at the end of a line, the whole link moves to the next line and leaves the words before it short, or a lone "Or" at the end of a line. Whether a link wraps can't be known when writing it, since another language or a narrower phone wraps a line that fit. So the form follows the link's place, as its variant does (Variants):

  • In a sentence, with words before it, the variant="strong" place, a sentence's last words included ("Don't have an account? Create one"): always nativeButton={false}. It renders as inline text (a span) that wraps with the words around it, each line with its own focus ring and rounded corners, and the hover underline on every line.
  • On its own line (Sign out, See all): the default button.
text-link/compositions/in-a-sentence

A way somewhere is a real link, render={<a href="…" />}, which is inline text already and wraps in a sentence as it is.

Content

  • Start with a verb, or name the place: Forgot password, Sign out, See all.
  • Use sentence case, like every button label (Writing).

Leaving Raft

A TextLink that goes to another site ends in TextLinkExternalIcon: Lucide's ArrowUpRight at 0.857em of the text (12px at 14px, like the icons in a reference chip), 2px after the text, in the text's color, centered on the letters' cap height at every size (A mark that leads text). It sits in an inline-flex box, so the underline on hover stops at the text and never runs under the arrow. Pass label for a screen reader, "(opens in a new tab)"; it is product copy, so raft-ui doesn't write it. The rule for every control that leaves Raft is in Navigation.

text-link/compositions/leaving-raft

Downloads

A TextLink that downloads a file ends in TextLinkDownloadIcon: Lucide's Download, in the same box as the ↗ (0.857em of the text, 2px after it, centered on the cap height, the underline stopping at the text). A download doesn't leave the page, so the link stays in the same tab and takes no ↗ (Navigation). Render a real link with download, and pass label for a screen reader, "(downloads a file)"; like the ↗'s, it is product copy.

text-link/compositions/downloads

Accessibility

TextLink renders a native button type="button", or, in a sentence, a span with the button's role (In a sentence). For a way somewhere, render a real link so it opens in a new tab and announces as a link: render={<a href="…" />}.

  • The in-sentence form is a span that acts as the button: role="button", in the tab order, pressed with Enter or Space. When disabled it takes aria-disabled, leaves the tab order and takes the disabled look, like the button.
  • disabled is the native attribute on the button form: the button leaves the tab order and takes the disabled look. A link has no disabled. When a way somewhere is unavailable, don't render the link; when the reader can do something about it, say that one step in the text (Writing).

Rules

  • Don't use TextLink to fit one more action into a crowded row. It is the quietest control on a screen, not a smaller button.
  • Don't color it, and don't underline it at rest. Emphasis comes from weight and ink, so pink stays with the one primary button, and the underline stays the hover signal.

API

PropTypeDefault
nativeButtonWhether TextLink renders a native `<button>`. Set `false` for a link in a sentence (it renders a `<span />` unless `render` says otherwise): a span is inline text, so the link wraps across lines with the words around it, where a button is one box that can't. The span then gets the button's behavior: `role="button"`, the tab order, Enter and Space, and `aria-disabled` when disabled.booleantrue
variant"strong" | "muted""muted"
renderAllows you to replace the component's HTML element with a different tag, or compose it with another component.ReactElement | ((props, state) => ReactElement)

Also takes the attributes of its element.

TextLinkDownloadIcon

The download mark after a link that downloads a file (design/patterns/navigation.md): the sibling of TextLinkExternalIcon, in the same box (0.857em, 2px after the text, centred on the cap height, inline-flex so the underline stops at the text). A download doesn't leave the page, so the link stays in the same tab and takes no ↗.
PropTypeDefault
labelRead by a screen reader after the link text, such as "(downloads a file)". Product copy, so the caller passes it.string

TextLinkExternalIcon

The ↗ after a link that leaves Raft (design/patterns/navigation.md#links-that-leave-raft): 0.857em (12px at 14px text, as the icons in a reference chip), 2px after the text, centred on the letters' cap height at every text size (0.7em/2 above the baseline; design/foundations/alignment.md#a-mark-that-leads-text). It sits in an inline-flex box, so the link's underline stops at the text and never runs under the arrow.
PropTypeDefault
labelRead by a screen reader after the link text, such as "(opens in a new tab)". Product copy, so the caller passes it.string

Changes

  • 0.107.0 · ChangedA footer link in a phone sheet is a full-width outline button ([Dialog › The sheet](https://raft-design.botiverse.build/components/dialog/#the-sheet)): a TextLink written first in DialogFooter moves to the end of the sheet's body as Button variant="default" size="md", full width (32px tall, 44px hit area), instead of muted footnote text.
  • 0.103.0 · Breaking ChangesExplanation slots take only a HelperText: FieldDescription, FormSection's description, a ChoiceList item's description, SelectItemDescription, DialogDescription, AlertDialogDescription, DrawerDescription, PopoverDescription, EmptyStateDescription, CardDescription, CardFooter, BannerDescription, DialogFooterNote (work in progress), MessageActionCardHint, MessageActionCardHeaderDescription, MessageActionCardScopeDescription and MessageActionCardActionsNote. A HelperText is made only by helperText(content, { why, about }): content is any ReactNode (a string, a formatted message, a TextLink inside a sentence), why is "consequence", "audience" or "recovery", and about names the thing the line is about. Each slot renders the content with data-why and data-about, and in development warns once when it is given anything else, which it still renders. ToastDescription, NotificationCenterItemBody, EmptyStateTitle, ListRowDescription and the status and data parts are unchanged.
  • 0.95.2 · AddedTextLinkDownloadIcon: the download mark after a TextLink that downloads a file ([TextLink › Downloads](https://raft-design.botiverse.build/components/text-link/#downloads)) ([#1226](https://github.com/botiverse/raft-design/pull/1226)). The sibling of TextLinkExternalIcon, in the same box: Lucide's Download at 0.857em of the text, 2px after it, centered on the letters' cap height, in an inline-flex box so the hover underline stops at the text. label is read by a screen reader after the text ("(downloads a file)"); the caller supplies the copy. Its part is data-slot="text-link-download-icon".
  • 0.26.0 · Design SystemLinks that leave Raft end in ↗: a control that takes someone to another site (docs, pricing, terms and privacy, an app's homepage, TestFlight, Stripe, GitHub) ends in Lucide's ArrowUpRight, the only mark for it, never the box with an arrow. A TextLink takes TextLinkExternalIcon; a button puts it in its trailing icon's place; a menu item where the shortcut goes; a sidebar row in its trailing slot, in foreground-hint. It opens in a new tab with rel="noopener noreferrer" and a screen reader hears "(opens in a new tab)"; Stripe checkout and the billing portal stay in the same tab and still end in ↗. Sign-in round trips, downloads, links people write in messages and anything inside Raft get no mark.
  • 0.22.0 · ChangedDialogFooter and AlertDialogFooter: the buttons stay in one row at the end, Cancel then the commit button, at every width, and stack full width, the commit button on top, only when they don't fit on one line. In DialogFooter, a TextLink written first sits at the start in footnote text, and the buttons after it form one group (data-slot="dialog-footer-actions") that stays beside the link when both fit and wraps under it, still at the end, when they don't. Props are unchanged.
  • 0.9.4 · ChangedClickable text no longer sits underlined at rest: it underlines on hover in its own colour and never turns pink. This covers TextLink (both emphases; strong no longer turns its underline pink on hover), MessageItemSenderButton, @ mentions, the forwarded-bundle and translation text actions, empty-state description links (now semibold so they stand apart from the hint text), the video-preview failure action and toast actions. Disabled ones do not underline. Rendered Markdown links are the one exception: they keep a faint underline at rest (link blue at 40%), because colour alone is below 3:1 against body text, and on hover the underline goes full strength and the text darkens.
  • 0.8.0 · Breaking ChangesButton no longer has variant="link" or size="inline". Underlined text is now TextLink. A link inside a sentence (a banner's "View Billing") becomes <TextLink variant="strong">; a link on its own (Forgot Password, See All) becomes <TextLink>, which is muted. TextLink has no height, border or padding, so drop the classes that took them off.
  • 0.8.0 · Breaking ChangesThe activity inbox sidebar no longer styles [data-activity-inbox-show-all] as a link (it keeps only whitespace-nowrap). Render Show All as a TextLink.