Anchor
Display link with theme styles
Source
LLM docs
Docs
PackageIcon
Usage
Underline
Use the underline prop to configure the text-decoration property. It accepts the following values:
always- link is always underlinedhover- link is underlined on hovernever- link is never underlinednot-hover- link is underlined when not hovered
You can also configure the underline prop for all Anchor components with default props:
Text props
The Anchor component supports all Text component props.
For example, you can use the gradient variant:
Polymorphic component
Anchor is a polymorphic component – its default root element is a, but it can be changed to any other element or component with the component prop:
You can also use components in the component prop, for example, Next.js Link:
Polymorphic components with TypeScript
Note that polymorphic component prop types are different from regular components – they do not extend HTML element props of the default element. For example,
AnchorPropsdoes not extendReact.ComponentProps'<'div'>'althoughais the default element.If you want to create a wrapper for a polymorphic component that is not polymorphic (does not support the
componentprop), then your component props interface should extend HTML element props, for example:If you want your component to remain polymorphic after wrapping, use the
polymorphicfunction described in this guide.