Link
An always-underlined navigation link with default or subtle emphasis. Render an anchor directly, or use asChild to style a router adapter while preserving its link behavior.
React
Preview
Usage
When to use
- Navigate to a page, resource or section from text.
- Place an underlined destination within a sentence.
When not to use
- An action that changes the current page without navigating. Use Button.
- A path through parent pages. Use Breadcrumb.
Platform support
What each platform has, from the spec. A selected platform is highlighted.
| Name | Web | iOS | Android | Note |
|---|---|---|---|---|
| variant | Yes | Yes | Yes | |
| external | Yes | Deferred | Deferred | Not generated for iOS and Android. |
| asChild | Yes | Deferred | Deferred | Not generated for iOS and Android. |
| href | Yes | Deferred | Deferred | Not generated for iOS and Android. |
| target | Yes | Deferred | Deferred | Not generated for iOS and Android. |
| rel | Yes | Deferred | Deferred | Not generated for iOS and Android. |
| onPress | No | Yes | Yes | Only on iOS, Android. |
| icon | No | Yes | Yes | Only on iOS, Android. |
Variants
variant
default uses accent text; subtle uses secondary text.
Examples
Inline navigation
External destination
Composed link
A single child provides the destination. Use the same composition with an application router adapter.
Do and don't
Do
- Use meaningful destination text.
- Use asChild for router adapters with their own destination props.
- Make opening a new tab an explicit choice with target="_blank".
Don't
- Do not use Link for actions that do not navigate; use Button.
- Do not use external as a substitute for target.
- Do not nest anchors.
Props
| Name | Type | Values | Default | Description |
|---|---|---|---|---|
| variant | enum | default | subtle | default | default uses accent text; subtle uses secondary text. |
| external | boolean | - | false | Adds a decorative external-link icon. Does not change the target. Not generated for iOS and Android. |
| asChild | boolean | - | false | Styles a single child link or router adapter without a nested anchor. Not generated for iOS and Android. |
| href | string | - | - | Destination for the native anchor. A child router adapter may supply its own destination. Not generated for iOS and Android. |
| target | string | - | - | Native navigation target. _blank merges noopener and noreferrer into rel. Not generated for iOS and Android. |
| rel | string | - | - | Relationship values. Existing values are retained when safe values are added for _blank. Not generated for iOS and Android. |
| onPress | function | - | - | Native only: called when the link is pressed. The app decides how to open the destination. Only on iOS, Android. |
| icon | node | - | - | Native only: an optional trailing icon, in the link icon color. Only on iOS, Android. |
Slots
| Name | Required | Description |
|---|---|---|
| children | yes | Visible destination name, or the single child link when asChild is true. |
Anatomy
| Part | Description |
|---|---|
| root | Anchor or caller-supplied link with an underline and visible keyboard focus. |
| icon | Decorative external-link icon, present only when external is true. |
Accessibility
Role: link
| Keys | Action |
|---|---|
| Tab | Focus the link. |
| Enter | Follow the focused link. |
- Both variants keep an underline so the link is distinguishable without color alone.
- The external icon is decorative and does not change the accessible name.
- external does not force a new tab. An explicit target="_blank" adds noopener noreferrer without dropping existing rel values.
- asChild preserves the child destination, native attributes, event handlers and ref.
Install
npx werewolf-ui add linkRun npx werewolf-ui init once in your app before adding components. Init sets up tokens, their CSS import and agent rules. Add installs this component and its dependencies while preserving your theme. See Installation for requirements and the alternative registry setup.