Examples

Links

Preview
Example.tsx
import { Link, Stack, Text } from '@reactloom/ui';

export default function Example() {
  return (
    <Stack gap="2">
      <Text>
        Read the <Link href="#migration">migration guide</Link> before upgrading.
      </Text>
      <Text>
        <Link href="#neutral" tone="neutral" underline="always">Neutral, always underlined</Link>
      </Text>
      <Text>
        Check the <Link href="https://example.com" external>status page</Link>.
      </Text>
    </Stack>
  );
}

API reference

Link props
PropTypeDefault
tone
'accent' | 'neutral''accent'
underline
'hover' | 'always' | 'none''hover'
external
New tab, safe rel, icon and announced hint.
booleanfalse
externalLabel
string'(opens in a new tab)'
asChild
Style your router’s link.
booleanfalse

Customization

Extracted from the component’s source on every build, so it matches the code. How the layers fit together is explained in Customization.

State attributes

Target these in your CSS to style states without depending on class names.

AttributeValues
[data-tone]accent · neutral
[data-underline]always · hover · none

Theme tokens it reads

--pl-color-fg-default --pl-color-fg-link --pl-focus-ring-color --pl-focus-ring-width --pl-radius-xs

Accessibility

  • External links announce that they open a new tab.
  • Use underline="always" for neutral links inside paragraphs (WCAG 1.4.1).
Keyboard interactions
KeyAction
EnterFollow the link

Usage guidelines

Do

  • Write link text that makes sense out of context.

Don’t

  • Don’t use “click here”.