Rost

← All components

component

Card

A plate that holds one thing together, like a summary, a setting or a figure. Filled grey, or just an edge.

In code Contract: review Guidance: proposed Contract on GitHub Figma 733:152 As markdown

Tax set aside

On track

Filled

Tax set aside

On track

Outlined

Install

npx github:Runceanu/rost add card

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

When to use

  • Things that belong together

    A month's totals, one setting with its explanation, a client's details: one card each.

  • On grey

    Inside a panel that's grey already, outlined keeps the edge without stacking grey on grey.

When not to use

Behaviour

A plate with 24px inside it and 16px between what it holds. It doesn't do anything: no hover, no press. The edge on outlined is decoration, so it doesn't need 3:1 against the page; what's in the card has to carry itself.

Accessibility

  • Element

    A <div> by default. Make it a <section> with an aria-labelledby pointing at its heading when it's a part of the page someone would jump to.

  • Colour

    The filled plate is #171717 on the dark page. Text on it uses the same tokens as on the page and keeps AA.

Content

A heading, if it needs one, in sentence case. Keep it to one idea.

Props

PropTypeValuesDefault
tone enum filled · outlined filled
children slot

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

  • gap 16px spacing/gap/medium
  • padding 24px spacing/gap/large
  • border-radius 16px spacing/radius/large

displayflex · flex-directioncolumn

Changes by variant

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

Follows tone

PropertyFilledOutlined
root.background card/filled/background #171717 transparent

Only in some variants

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

Outlined

  • root.outline-color #3a3a3a card/outlined/edge
  • root.outline-offset calc(-1 * var(--spacing-outline-small)) on purpose: Composed from a token: the edge sits inside the card.
  • root.outline-style solid Figma frame size
  • root.outline-width 1px spacing/outline/small