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>
<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-controlsstringIdentifies 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-describedbystringIdentifies the element(s) that describe the link.
aria-descriptionstringAccessible description for the link.
aria-detailsstringIdentifies the element that provides a detailed description.
aria-expandedbooleanIndicates whether a controlled element is expanded or collapsed.
aria-haspopupboolean | 'menu' | 'listbox' | 'tree' | 'grid' | 'dialog'Indicates the link opens an interactive popup element.
aria-hiddenbooleanIndicates whether the element is exposed to the accessibility API.
aria-keyshortcutsstringKeyboard shortcuts that activate or focus the link.
aria-labelledbystringIdentifies the element(s) that label the link.
aria-ownsstringIdentifies element(s) owned by the link that are not DOM children.
aria-roledescriptionstringHuman-readable description of the role of the link.
asLinkComponentCustom 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*ReactNodeLink content.
classNamestringOptionally, rendering by setting the className.
color"primary" | "secondary" | "disabled" | "inherit" | "placeholder" | "active"Color variant controlling the link text color. Default is active.
data-testidstringTest id applied to the root element.
hasUnderlinebooleanShow a persistent underline on the link text.
hrefstringURL 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>.
isDisabledbooleanVisually and functionally disable the link. Prevents navigation and removes from tab order.
isExternalLinkbooleanMark as an external link. Adds an icon and rel="noopener noreferrer". Defaults target to "_blank" unless target is set explicitly.
labelstringAccessible 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.
relstringHTML rel attribute.
size"sm" | "md" | "lg" | "inherit" | "xs" | "xl" | "2xl" | "3xl" | "4xl" | "5xl" | "6xl"Font size variant. Default is md.
styleCSSPropertiesInline styles applied to the root element.
targetstringHTML target attribute.
tooltipstringTooltip text shown on hover.
weight"medium" | "inherit" | "normal" | "semibold" | "bold"Font weight variant. Default is inherited from parent styles.
PropTypeDefaultDescription
children*ReactNode
component*LinkComponent