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.
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.
When to use
Variants
The variant follows where the link sits, not how important the action is.
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-disabledand nothing changes on hover, so it no longer reads as something to press.
- 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"): alwaysnativeButton={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.
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.
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.
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 takesaria-disabled, leaves the tab order and takes the disabled look, like the button. disabledis the native attribute on the button form: the button leaves the tab order and takes the disabled look. A link has nodisabled. 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
TextLink
Also takes the attributes of its element.
TextLinkDownloadIcon
TextLinkExternalIcon
Related
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
TextLinkwritten first inDialogFootermoves to the end of the sheet's body asButton 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'sdescription, aChoiceListitem'sdescription,SelectItemDescription,DialogDescription,AlertDialogDescription,DrawerDescription,PopoverDescription,EmptyStateDescription,CardDescription,CardFooter,BannerDescription,DialogFooterNote(work in progress),MessageActionCardHint,MessageActionCardHeaderDescription,MessageActionCardScopeDescriptionandMessageActionCardActionsNote. AHelperTextis made only byhelperText(content, { why, about }):contentis anyReactNode(a string, a formatted message, aTextLinkinside a sentence),whyis"consequence","audience"or"recovery", andaboutnames the thing the line is about. Each slot renders the content withdata-whyanddata-about, and in development warns once when it is given anything else, which it still renders.ToastDescription,NotificationCenterItemBody,EmptyStateTitle,ListRowDescriptionand the status and data parts are unchanged. - 0.95.2 · Added
TextLinkDownloadIcon: 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 ofTextLinkExternalIcon, in the same box: Lucide'sDownloadat 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.labelis read by a screen reader after the text ("(downloads a file)"); the caller supplies the copy. Its part isdata-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 takesTextLinkExternalIcon; a button puts it in its trailing icon's place; a menu item where the shortcut goes; a sidebar row in its trailing slot, inforeground-hint. It opens in a new tab withrel="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, aTextLinkwritten 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;strongno 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 Changes
Buttonno longer hasvariant="link"orsize="inline". Underlined text is nowTextLink. 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.TextLinkhas 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 onlywhitespace-nowrap). Render Show All as aTextLink.