Skip to content

Link

A polymorphic link component with built-in accessibility, external link handling, and router integration via LinkProvider. Supports custom link components (e.g. React Router's Link) through the `as` prop or a parent `LinkProvider`.

Documentation
<Link href="/docs" color="active">Documentation</Link>
<Link href="/docs" color="primary">Documentation</Link>
<Link href="/docs" color="secondary">Documentation</Link>
<Link href="/docs" color="disabled">Documentation</Link>
<Link href="/docs" color="placeholder">Documentation</Link>
<Link href="/docs" color="inherit">Documentation</Link>
<Link href="/docs" weight="normal">Documentation</Link>
<Link href="/docs" weight="medium">Documentation</Link>
<Link href="/docs" weight="semibold">Documentation</Link>
<Link href="/docs" weight="bold">Documentation</Link>
<Link href="/docs" size="sm">Documentation</Link>
<Link href="/docs" size="lg">Documentation</Link>
<Link href="/docs" size="xl">Documentation</Link>
<Link href="/docs" size="inherit">Documentation</Link>
<Link href="/docs" hasUnderline>Documentation</Link>
<Link href="https://example.com" isExternalLink>External docs</Link>
<Link
href="https://example.com"
isExternalLink
target="_self"
>
External docs in same tab
</Link>
<Link
href="https://example.com/settings"
isExternalLink
label="Open settings"
>
↗
</Link>
<Link
href="https://example.com/docs"
hasUnderline
isExternalLink
>
External underlined docs
</Link>
<LinkProvider component={StoryLink}>
<Link href="/provider">Provider link</Link>
</LinkProvider>
<Link as={StoryLink} href="/as-override">
Direct custom link
</Link>

Read the documentation before changing these settings.

<Text as="p">
Read the <Link href="/docs">documentation</Link> before changing these
settings.
</Text>

I agree to the Terms of Service (opens in new tab) and Business Associate Agreement (opens in new tab). Inline links wrap with the sentence instead of moving to the next line whole.

<Text as="p" display="block" style={{maxWidth: 320}}>
I agree to the{' '}
<Link display="inline" href="https://example.com/terms" isExternalLink>
Terms of Service
</Link>{' '}
and{' '}
<Link display="inline" href="https://example.com/baa" isExternalLink>
Business Associate Agreement
</Link>
. Inline links wrap with the sentence instead of moving to the next line
whole.
</Text>

Large text with a matching link.

Body text with a matching link.

Supporting text with a matching link.

<>
<Text as="p" display="block" type="large">
Large text with a <Link href="/docs">matching link</Link>.
</Text>
<Text as="p" display="block">
Body text with a <Link href="/docs">matching link</Link>.
</Text>
<Text as="p" display="block" type="supporting">
Supporting text with a <Link href="/docs">matching link</Link>.
</Text>
</>
<Link href={undefined} onClick={fn()}>Log click</Link>
<Link href={undefined}>Action-style link</Link>
<Link href="https://example.com/report" target="_blank">Open report</Link>
<Link
href="https://example.com/partner"
rel="sponsored"
target="_blank"
>
Sponsored partner
</Link>
<Link
href="/docs"
isDisabled
tooltip="This link is unavailable for your current role."
>
Disabled link
</Link>
<Link href="/docs" tooltip="Go to documentation">Hover me</Link>
<Link href="/docs" label="Settings">⚙</Link>
<Link
href="https://example.com"
isExternalLink
isDisabled
>
Disabled external
</Link>

A polymorphic link component with built-in accessibility, external link handling, and router integration via LinkProvider. Supports custom link components (e.g. React Router's Link) through the `as` prop or a parent `LinkProvider`.

PropTypeDefaultDescription
aria-controlsstring—Identifies the element(s) whose contents are controlled by the link.
aria-current'page' | 'step' | 'location' | 'date' | 'time' | 'true'—Indicates the current item in a set (e.g. current page in navigation).
aria-describedbystring—Identifies the element(s) that describe the link.
aria-descriptionstring—Accessible description for the link.
aria-detailsstring—Identifies the element that provides a detailed description.
aria-expandedboolean—Indicates whether a controlled element is expanded or collapsed.
aria-haspopupboolean | 'menu' | 'listbox' | 'tree' | 'grid' | 'dialog'—Indicates the link opens an interactive popup element.
aria-hiddenboolean—Indicates whether the element is exposed to the accessibility API.
aria-keyshortcutsstring—Keyboard shortcuts that activate or focus the link.
aria-labelledbystring—Identifies the element(s) that label the link.
aria-ownsstring—Identifies element(s) owned by the link that are not DOM children.
aria-roledescriptionstring—Human-readable description of the role of the link.
asLinkComponent—Custom element type to render instead of <a>. Useful for integrating with routers. If you want to set this globally, use LinkProvider at the top level of your app.
children*ReactNode—Link content.
classNamestring—Optionally, rendering by setting the className.
color"primary" | "secondary" | "disabled" | "inherit" | "placeholder" | "active"—Color variant controlling the link text color. Default is active.
data-testidstring—Test id applied to the root element.
display"inline" | "inline-flex"—Layout of the link. Default is inline-flex, which never breaks the link across lines. Use inline for links inside sentences so they wrap with the surrounding text.
hasUnderlineboolean—Show a persistent underline on the link text.
hrefstring—URL destination. Custom link components receive this as both href and to so router links and anchor-like links can share the same Silver UI API. When omitted, Link renders as a native <button>.
isDisabledboolean—Visually and functionally disable the link. Prevents navigation and removes from tab order.
isExternalLinkboolean—Mark as an external link. Adds an icon and rel="noopener noreferrer". Defaults target to "_blank" unless target is set explicitly.
labelstring—Accessible label (aria-label). It is recommended to set this if your link does not contain sufficient text to make its purpose clear.
onClickMouseEventHandler<HTMLElement>—Click handler. Not called when the link is disabled.
refRef<HTMLElement>—Ref forwarded to the underlying anchor or button element.
relstring—HTML rel attribute.
size"sm" | "md" | "lg" | "inherit" | "xl" | "2xl" | "xs" | "3xl" | "4xl" | "5xl" | "6xl"—Font size variant. Default is inherit, so the link matches surrounding text.
styleCSSProperties—Inline styles applied to the root element.
targetstring—HTML target attribute.
tooltipstring—Tooltip text shown on hover.
weight"medium" | "inherit" | "normal" | "semibold" | "bold"—Font weight variant. Default is inherited from parent styles.
PropTypeDefaultDescription
children*ReactNode—
component*LinkComponent—