Skip to content

LinkProps

LinkProps<E> = Prettify<LinkOwnProps & object & Omit<React.ComponentPropsWithoutRef<E>, keyof LinkOwnProps | "as">>

Defined in: src/components/primitives/Link/Link.types.ts:123

Polymorphic Link props.

The generic E is the element type passed via as. By default Link renders an <a>, so all <a>-specific props (target, rel, …) are accepted. Pass as={RouterLink} and you also get the router’s props (to, replace, …) typed automatically.

Keys defined by LinkOwnProps are removed from the underlying element’s props so the Link’s own meanings always win.

Type Parameters

E

E extends React.ElementType = "a"

Example

// <a href="...">
<Link href="/docs">Docs</Link>
// react-router — `to` is typed because LinkProps<RouterLink> includes it
<Link as={RouterLink} to="/profile">Profile</Link>