Rost

← All components

component

Link

A link inside text. Green and underlined, or quiet in the text's own colour.

In code Contract: review Guidance: proposed Contract on GitHub Figma 705:81 As markdown
npx github:Runceanu/rost add link

It lands in src/rost/link/, with what it needs and its contract. Install has the rest.

When to use

  • In a sentence

    Pointing somewhere from inside a sentence, a note or a table cell.

  • A row of sources

    quiet for a footer or a line of links under a section, where every word is a link.

When not to use

Behaviour

The underline is always there on accent, so a link never relies on colour alone. quiet takes the text's colour and shows the underline on hover. An external link opens a new tab and gets a hidden "(opens in a new tab)". I didn't add an arrow icon: in running text it was more noise than help.

Accessibility

  • Element

    an <a href>. Without an href it isn't a link, so don't render one.

  • Name

    the words inside. "here" or "more" tell a screen reader nothing out of context.

  • Colour

    accent is non-interactive/foreground/positive/base: 6:1 on the light page and 5.3:1 on the light card, 9:1 or more in dark.

Content

Say where it goes, in a few words. Sentence case.

Props

PropTypeValuesDefault
href string
tone enum accent · quiet accent
external boolean false
children slot

States: Default, Hover, Pressed, Focus.

Values

Straight from the contract. Each value sits next to its token, because six tokens here all come out as #3a3a3a and the colour alone can't tell you which one is right.

Never changes

root

  • color #00d669 non-interactive/foreground/positive/base
  • text-decoration-line underline no token yet
  • text-decoration-thickness 1px spacing/outline/small
  • text-underline-offset 0.2em on purpose: Follows the text's size, so it's in em, not a space token.
  • border-radius 4px spacing/radius/xsmall
  • transition-duration 150ms motion/duration/fast
  • transition-timing-function ease motion/easing/standard

text-decoration-colorcurrentColor · transition-propertycolor, text-decoration-color

label

positionabsolute · width1px · height1px · overflowhidden · clip-pathinset(50%) · white-spacenowrap

Changes by variant

6 variants. Each table is what one thing changes with: a column per state, a row per property. Where every row starts with the same token path, it's written once, under the property.

Follows state

Quiet

PropertyDefaultHoverPressed
root.text-decoration-color transparent currentColor currentColor

Follows tone and state

Quiet

PropertyDefaultHoverPressed
root.colornon-interactive/foreground/… inherit primary #ededed primary #ededed

Accent

PropertyDefaultHoverPressed
root.colornon-interactive/foreground/positive/… · dark #b6ffda dark #b6ffda

Only in some variants

These don't change: they're just set in some variants and not others.

Focus

  • root.outline-color #b6ffda actions/primary/focus/focus-ring
  • root.outline-offset 2px no token yet
  • root.outline-style solid no token yet
  • root.outline-width 2px spacing/outline/medium