Link
A navigational element for routing between pages or external resources with support for icons, external indicators, and various visual styles.
Import
Usage
Examples
Color
Variant
Size
Underline behavior
External link
With icons
Disabled
Combined example
With custom link component
Props
| Prop | Type | Default | Description |
|---|---|---|---|
href | string | None | Target URL |
variant | "default" | "muted" | "subtle" | "default"* | Visual style of the link |
color | "none" | "default" | "primary" | "secondary" | "danger" | "warning" | "success" | "primary"* | Semantic color |
size | "sm" | "md" | "lg" | "md" | Size scale |
underline | "always" | "hover" | "never" | "hover"* | Underline behavior |
isExternal | boolean | false* | Shows external link icon and sets target/rel |
disabled | boolean | false | Disables interaction |
startIcon | ReactNode | None | Icon displayed before text |
endIcon | ReactNode | None | Icon displayed after text |
children | ReactNode | None | Link content |
target | string | None | Link target attribute |
rel | string | None | Link rel attribute |
linkComponent | React.ElementType | None | Custom link component (e.g., Next.js Link, TanStack Router Link). Replaces the native <a> tag. |
linkProps | Record<string, unknown> | None | Additional props passed to the custom link component (e.g., { prefetch: true }). Merged with and takes precedence over native anchor props. |
className | string | None | Extra classes, merged with internal styles |
* Falls back through Global Configuration if not set. See below.
Global Configuration
Link reads defaults from four places, in this order of precedence:
- Instance prop: set directly on
<Link /> - Component config:
components.linkin yourashee.config - Theme default:
defaultColorin yourashee.config - Built-in fallback: component's internal default values
Component config
Built-in fallbacks
Accessibility
- Renders a native
<a>element (or custom link component) with proper semantics - External links automatically include
rel="noopener noreferrer"for security - Uses
aria-disabledfor disabled state - Disabled links remove
hrefattribute to prevent navigation - Implements
focus-visiblerings for keyboard navigation
Notes
- External Links: When
isExternalistrue, the link automatically opens in a new tab with proper security attributes (target="_blank"andrel="noopener noreferrer"). - External Indicator: An external link icon is automatically added when
isExternalistrue(unless overridden byendIcon). - Disabled State: Disabled links have reduced opacity, no hover effects, and cannot be clicked.
- Underline Behavior:
underline="hover"shows underline only on hover,underline="always"always shows underline, andunderline="never"never shows underline. - Variant Muted: The
mutedvariant uses a muted foreground color that brightens on hover, useful for less prominent links. - Variant Subtle: The
subtlevariant uses reduced opacity that increases on hover. - Custom Link Component: You can replace the default
<a>tag with any routing‑library link component (e.g., Next.jsLink, TanStack RouterLink) using thelinkComponentprop. Additional props can be passed vialinkProps. All styles, interactions, and accessibility features are preserved.