Balance Logo
Balance
Reckon Design System
Open playroom

Next Link

An alternative API for Next links that enforces the usage of an anchor
Install
pnpm add @balance-web/next-link
Import usage
import {
NextLink,
UniversalNextLink
} from '@balance-web/next-link';
  • Code
  • API

The NextLink component has been deprecated and will be removed in a future version. Use Link instead.

- <Button
- as={NextLink}
- href="/"
- label="A link that looks like a button"
- />
+ <Button
+ as={Link}
+ href="/"
+ label="A link that looks like a button"
+ />

Next's Link makes it easy to create "links" that don't actually use anchors so we provide a link component with a slightly different API that forces the usage of an anchor tag. You should always use the components in this package instead of Next's Link. This is enforced in reckon-frontend with a lint rule.

Instead of adding event handlers and sometimes an href to the child element, Reckon's NextLink renders an anchor itself.

import { NextLink } from '@balance-web/next-link';
function MyComponent() {
return <NextLink href="/">A Next link</NextLink>;
}

Button

You can pass the NextLink to the as prop on a Button to make a link that looks like a button.

import { NextLink } from '@balance-web/next-link';
import { Button } from '@balance-web/button';
function MyComponent() {
return (
<Button as={NextLink} href="/" label="A link that looks like a button" />
);
}

You can pass the NextLink to the as prop on a TextLink to make a link that looks correct in text.

import { NextLink } from '@balance-web/next-link';
import { TextLink } from '@balance-web/text';
function MyComponent() {
return (
<TextLink as={NextLink} href="/">
A link
</TextLink>
);
}
Copyright © 2024 Reckon. Designed and developed in partnership with Thinkmill.
Bitbucket logoJira software logoConfluence logo