Link

Lets user navigate to a different place with a click.

Example

This is a text paragraph with some links like this. There are a couple different variants for these links that you see here. That is all.

import { Link } from "@styple/design-system";
<Text>
This is a text paragraph with some <Link variant="color" href="#">links like this</Link>.
There are a couple different variants for <Link href="#">these links</Link> that you see here. That is all.
</Text>

When using something like Next.js you might want to make a wrapper for this component, which can be done like so:

import NextLink from "next/link";
import { Link as DSLink } from "../packages/design-system";
import React from "react";
import { UrlObject } from "url";
type LinkProps = Omit<React.ComponentProps<typeof DSLink>, "href"> & {
href: string | UrlObject;
};
export const Link = React.forwardRef<
React.ElementRef<typeof DSLink>,
LinkProps
>(({ href, children, ...props }, forwardedRef) => {
return (
<NextLink href={href} passHref>
<DSLink ref={forwardedRef} {...props}>
{children}
</DSLink>
</NextLink>
);
});
Link.displayName = "Link";

API Reference

A styled component with props:

Prop Type Default Explanation
variantstring"underline"

Variant type of the link.