Link
Links that take people to another page, section or site, inside text or on their own. For actions that change data, use a Button.
Ritla scan of this preview: 41 of 41 checks3 breakpointsScanned
Preview
Mirrored is the same English content laid out right to left: it separates a mirroring bug from a translation one.
Installation
Add the component
npx ritla add linkAlso works with shadcn:
npx shadcn@latest add @ritla/linkDependencies it brings
@phosphor-icons/reactOr copy by hand
Installing by hand copies the component's source into your project. The source comes with a Ritla UI license, so the CLI is the short way to the same files.
Usage
import { TextLink } from "@/components/ui/link";<p> By continuing you agree to our <TextLink href="/terms" size="inline">Terms of service</TextLink>.</p><TextLink href="/transactions" size="md">View all transactions</TextLink>Examples
Styles
brand for most links, neutral where links are quiet (footers, secondary navigation), danger for a link into a destructive flow, never for plain navigation.
Sizes
For standalone links: sm 20px, md 24px and lg 28px tall, with 16, 20 and 24px icons.
States
Hover and focus come from the pointer and keyboard. disabled drops the href, so the link leaves the Tab order but stays visible. Remove the underline only where the context already reads as links.
Inline
size="inline" wraps with the sentence and takes its size and weight, at any text style. Keep the underline in running text: color alone doesn't mark a link.
External
external opens a new tab with rel="noopener noreferrer", adds the external arrow and tells screen readers it opens in a new tab, in the page language.
With your router
Pass Next's <Link> (or your router's) as render: it keeps client-side navigation and prefetching, and TextLink adds the look.
With an arrow
arrow adds a trailing arrow that points to the destination (left in Arabic) and nudges toward it on hover and focus. For standalone links such as “Read the guide”, not inside running text.
API reference
TextLink
Also takes every <a> prop. Named TextLink so it doesn't clash with your router's Link.
| Prop | Type | Default | Description |
|---|---|---|---|
children | ReactNode | None | Figma's Label. |
href | string | None | Where the link goes. |
tone | "brand" | "neutral" | "danger" | "brand" | Figma's Tone. |
size | "sm" | "md" | "lg" | "inline" | "lg" | Figma's Size, or inline inside running text. |
underline | boolean | true | Figma's Show underline. |
iconLeading | IconComponent | None | Figma's Icon leading and its swap. Directional icons mirror in RTL. |
iconTrailing | IconComponent | None | Figma's Icon trailing and its swap. |
arrow | boolean | false | Figma's Arrow: a trailing arrow that points to the destination and nudges toward it on hover and focus. |
external | boolean | false | A new tab, the external arrow and a screen reader note. |
disabled | boolean | false | Figma's State = Disabled: no href, out of the Tab order. |
render | ReactElement | None | A router link (<Link href>) rendered with the TextLink look. |
Accessibility
Keyboard
Keys are written for left-to-right. In right-to-left the arrow keys swap: the one pointing toward the reading direction moves forward.
| Key | Action |
|---|---|
| Tab | Moves focus to the link, with the focus ring around it (the error ring on danger). |
| Enter | Follows the link. |
ARIA
- A real
<a href>, so it's announced as a link and opening in a new tab or copying works. - An external link adds “(opens in a new tab)” for screen readers, in Arabic on Arabic pages.
- A disabled link has
aria-disabled="true"and nohref, so Tab skips it. - Icons are decorative and hidden from screen readers; the text names the link.
Arabic and RTL notes
Mirrors
- Directional icons mirror: the “View all transactions” arrow points left, and the external arrow up and to the left.
- The leading icon sits at the inline start (the right), the trailing one at the end.
Does not mirror
- Non-directional icons (home, help) stay as they are, as does the underline.
- Numerals
- Numbers in a link's text follow
numeralslike any other text. - Arabic typography
- Standalone links use the
labelstyles in Medium, with taller Arabic line heights; heights are minimums, so text never clips. The underline sits 4px below the baseline, clear of most Arabic dots. - Mixed-direction text
- Inside a sentence the link follows the paragraph direction. Wrap a Latin brand name inside an Arabic link in
<bdi>.
Checks it passes
The Ritla checks this component satisfies by construction. Used as documented, it does not bring these defects onto your page.
- Arabic text falling back past the declared font family (measured, declared, or a webfont that failed to load)
- letter-spacing applied to Arabic text (breaks the connected script)
- Clipped text: content wider than its box with overflow hidden and no ellipsis
- Fixed-pixel-width container whose Arabic text exceeds the space