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`.
Examples
Section titled “Examples”Active
Section titled “Active”<Link href="/docs" color="active">Documentation</Link>Primary
Section titled “Primary”<Link href="/docs" color="primary">Documentation</Link>Secondary
Section titled “Secondary”<Link href="/docs" color="secondary">Documentation</Link>Disabled
Section titled “Disabled”<Link href="/docs" color="disabled">Documentation</Link>Placeholder
Section titled “Placeholder”<Link href="/docs" color="placeholder">Documentation</Link>Inherit
Section titled “Inherit”<Link href="/docs" color="inherit">Documentation</Link>Weight Normal
Section titled “Weight Normal”<Link href="/docs" weight="normal">Documentation</Link>Weight Medium
Section titled “Weight Medium”<Link href="/docs" weight="medium">Documentation</Link>Weight Semibold
Section titled “Weight Semibold”<Link href="/docs" weight="semibold">Documentation</Link>Weight Bold
Section titled “Weight Bold”<Link href="/docs" weight="bold">Documentation</Link>Size Small
Section titled “Size Small”<Link href="/docs" size="sm">Documentation</Link>Size Large
Section titled “Size Large”<Link href="/docs" size="lg">Documentation</Link>Size XL
Section titled “Size XL”<Link href="/docs" size="xl">Documentation</Link>Size Inherit
Section titled “Size Inherit”<Link href="/docs" size="inherit">Documentation</Link>Underlined
Section titled “Underlined”<Link href="/docs" hasUnderline>Documentation</Link>External
Section titled “External”<Link href="https://example.com" isExternalLink>External docs</Link>External Same Tab
Section titled “External Same Tab”<Link href="https://example.com" isExternalLink target="_self"> External docs in same tab</Link>External With Label
Section titled “External With Label”<Link href="https://example.com/settings" isExternalLink label="Open settings"> ↗</Link>External Underlined
Section titled “External Underlined”<Link href="https://example.com/docs" hasUnderline isExternalLink> External underlined docs</Link>Provider Override
Section titled “Provider Override”<LinkProvider component={StoryLink}> <Link href="/provider">Provider link</Link></LinkProvider>As Override
Section titled “As Override”<Link as={StoryLink} href="/as-override"> Direct custom link</Link>Inline With Text
Section titled “Inline With Text”Read the documentation before changing these settings.
<Text as="p"> Read the <Link href="/docs">documentation</Link> before changing these settings.</Text>With On Click
Section titled “With On Click”<Link href={undefined} onClick={fn()}>Log click</Link>Without Href
Section titled “Without Href”<Link href={undefined}>Action-style link</Link>Target Blank
Section titled “Target Blank”<Link href="https://example.com/report" target="_blank">Open report</Link>Custom Rel
Section titled “Custom Rel”<Link href="https://example.com/partner" rel="sponsored" target="_blank"> Sponsored partner</Link>Is Disabled
Section titled “Is Disabled”This link is unavailable for your current role.
<Link href="/docs" isDisabled tooltip="This link is unavailable for your current role."> Disabled link</Link>With Tooltip
Section titled “With Tooltip”Go to documentation
<Link href="/docs" tooltip="Go to documentation">Hover me</Link>Icon Only
Section titled “Icon Only”<Link href="/docs" label="Settings">⚙</Link>Disabled External
Section titled “Disabled External”<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`.
| Prop | Type | Default | Description |
|---|---|---|---|
aria-controls | string | — | 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-describedby | string | — | Identifies the element(s) that describe the link. |
aria-description | string | — | Accessible description for the link. |
aria-details | string | — | Identifies the element that provides a detailed description. |
aria-expanded | boolean | — | Indicates whether a controlled element is expanded or collapsed. |
aria-haspopup | boolean | 'menu' | 'listbox' | 'tree' | 'grid' | 'dialog' | — | Indicates the link opens an interactive popup element. |
aria-hidden | boolean | — | Indicates whether the element is exposed to the accessibility API. |
aria-keyshortcuts | string | — | Keyboard shortcuts that activate or focus the link. |
aria-labelledby | string | — | Identifies the element(s) that label the link. |
aria-owns | string | — | Identifies element(s) owned by the link that are not DOM children. |
aria-roledescription | string | — | Human-readable description of the role of the link. |
as | LinkComponent | — | 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. |
className | string | — | Optionally, rendering by setting the className. |
color | "primary" | "secondary" | "disabled" | "inherit" | "placeholder" | "active" | — | Color variant controlling the link text color. Default is active. |
data-testid | string | — | Test id applied to the root element. |
hasUnderline | boolean | — | Show a persistent underline on the link text. |
href | string | — | 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>. |
isDisabled | boolean | — | Visually and functionally disable the link. Prevents navigation and removes from tab order. |
isExternalLink | boolean | — | Mark as an external link. Adds an icon and rel="noopener noreferrer". Defaults target to "_blank" unless target is set explicitly. |
label | string | — | Accessible label (aria-label). It is recommended to set this if your link does not contain sufficient text to make its purpose clear. |
onClick | MouseEventHandler<HTMLElement> | — | Click handler. Not called when the link is disabled. |
ref | Ref<HTMLElement> | — | Ref forwarded to the underlying anchor or button element. |
rel | string | — | HTML rel attribute. |
size | "sm" | "md" | "lg" | "inherit" | "xs" | "xl" | "2xl" | "3xl" | "4xl" | "5xl" | "6xl" | — | Font size variant. Default is md. |
style | CSSProperties | — | Inline styles applied to the root element. |
target | string | — | HTML target attribute. |
tooltip | string | — | Tooltip text shown on hover. |
weight | "medium" | "inherit" | "normal" | "semibold" | "bold" | — | Font weight variant. Default is inherited from parent styles. |
LinkProvider
Section titled “LinkProvider”| Prop | Type | Default | Description |
|---|---|---|---|
children* | ReactNode | — | |
component* | LinkComponent | — |