The Link component
The Link component simplifies the management of links, both standalone and within RichText fields.
When you enable Links in a RichText without customizing the render function, a Link
component is automatically used to render links.
Link Component vs. Standard Anchor
- The Link component utilizes the framework’s Link (e.g., Next.js Link) for local paths, while rendering a standard
<a>
tag for absolute URLs - In the Editor interface, the Link component doesn’t trigger a link when clicked, allowing easy text editing within a link using a
<Text>
component.
Standalone Usage Example
Usage inside a RichText
When editors opt to open a link in a new tab through the link popup interface, the attributes target="_blank"
and rel="noopener"
are automatically applied.
Properties
Properties Definition
Property | Definition |
---|---|
href | The URL for an external link or the local path for a local link. |
target | The target for the external link (for example “_blank”). |
rel | The “rel” for the external link (for example “noopener”). |
className | CSS class to be applied to the link tag. |
The Link component also spreads {...rest}
properties on the link tag or framework’s Link component.
Usage with Server Components
When working with Server Components, you need to import from 'react-bricks/rsc'
: