Rost
← All components
component

Carousel

A card for a carousel: a number, a title and a short description.

In codeContract: reviewGuidance: agreedContract on GitHubFigma 157:302

When to use

  • Used for a row of featured items you scroll through, each card leading to more.

When not to use

  • A card with a picture. That's Thumbs.
  • Long titles. The title wraps, but two lines of 24px eat the card.

Behaviour

A number, a title and a line of description, on nothing: the card has no fill until you press it. On hover the number and title go green and the description lightens. Pressed lays a frosted glass under it (effect/thumb). Disabled fades the whole card to opacity/mild.

Accessibility

  • Element: an <a>. Disabled drops the href and sets aria-disabled="true".
  • Name: the title, read with the number and the description. Pass aria-label if that reads badly.
  • Keyboard: Tab to it, Enter opens it. The carousel around it handles the arrows.
  • Focus: a 2px ring, 4px outside the card, on :focus-visible only.

Content

A title of one to three words. The description is one short sentence.

Props

PropTypeValuesDefault
numberslot
titleslot
descriptionslot
showNumberbooleantrue
showTitlebooleantrue
showDescriptionbooleantrue

States: Default, Hover, Pressed, Focus, Disabled.

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

PartPropertyValueToken
rootdisplayflexlayout
rootflex-directioncolumnlayout
rootalign-itemsflex-startlayout
rootpositionrelativelayout
rootgap0pxspacing/gap/none
rootpadding24pxspacing/gap/large
rootborder-radius24pxspacing/radius/xlarge
roottext-decorationnoneFigma frame size
rootcolorinheritFigma frame size
rootoutlinenoneFigma frame size
rootwidth312pxFigma frame size
backgrounddisplaynonelayout
backgroundpositionabsolutelayout
backgroundinset0layout
backgroundbackgroundcolor-mix(in srgb, var(--non-interactive-background-tertiary) calc(var(--opacity-medium) * 100%), transparent)on purpose: Composed from tokens: non-interactive/background/tertiary at opacity/medium.
backgroundbackdrop-filterblur(12px)effect/thumb
backgroundopacity0.64opacity/strong
backgroundborder-radius24pxspacing/radius/xlarge
backgroundpointer-eventsnoneFigma frame size
titlealign-itemscenterlayout
titledisplayflexlayout
titlepositionrelativelayout
titlewidth100%layout
titlegap16pxspacing/gap/medium
numberdisplayflexlayout
numberjustify-contentcenterlayout
numberalign-itemscenterlayout
numberflex-shrink0layout
numberwidth16pxspacing/size/2xsmall
numberfont-family'General Sans Variable'font-family/base
numberfont-weight400typography/label/font-weight/regular
numberline-height14pxtypography/label/line-height
numberfont-size12pxtypography/label/font-size
numberletter-spacing0pxtypography/label/letter-spacing
textflex1 0 0layout
textmin-width1pxFigma frame size
textfont-family'General Sans Variable'font-family/base
textfont-weight500typography/title/font-weight/medium
textline-height32pxtypography/title/line-height
textfont-size24pxtypography/title/font-size
textletter-spacing0pxtypography/title/letter-spacing
bottomalign-itemscenterlayout
bottomdisplayflexlayout
bottompositionrelativelayout
bottomwidth100%layout
bottomjustify-contentflex-endlayout
bottomgap16pxspacing/gap/medium
bottompadding-left32pxspacing/gap/xlarge
descriptionflex1 0 0layout
descriptionmin-width1pxFigma frame size
descriptionfont-family'General Sans Variable'font-family/base
descriptionfont-weight400typography/paragraph/font-weight/regular
descriptionline-height20pxtypography/paragraph/line-height
descriptionfont-size14pxtypography/paragraph/font-size
descriptionletter-spacing0pxtypography/paragraph/letter-spacing
focus-ringdisplaynonelayout
focus-ringpositionabsolutelayout
focus-ringinsetcalc(-1 * var(--spacing-gap-2xsmall))layout
focus-ringborder-stylesolidno token yet
focus-ringborder-width2pxspacing/outline/medium
focus-ringborder-color#999project/focus/focus-ring
focus-ringborder-radiuscalc(var(--spacing-radius-xlarge) + var(--spacing-gap-2xsmall))on purpose: Composed from tokens: the element's spacing/radius/xlarge plus the ring's spacing/gap/2xsmall.
focus-ringpointer-eventsnoneFigma frame size

Changes by variant

background.display1
state=Pressedblocklayout
description.color5
state=Default#999project/default/sub-label
state=Hover#edededproject/hover/sub-label
state=Pressed#c2c7c3project/pressed/sub-label
state=Focus#999project/focus/sub-label
state=Disabled#999project/disabled/sub-label
focus-ring.display1
state=Focusblocklayout
number.color5
state=Default#999project/default/sub-label
state=Hover#00d669project/hover/label
state=Pressed#00d669project/pressed/label
state=Focus#999project/focus/sub-label
state=Disabled#999project/disabled/sub-label
root.cursor1
state=DisableddefaultFigma frame size
root.opacity1
state=Disabled0.32opacity/mild
text.color5
state=Default#d3d9d5project/default/label
state=Hover#00d669project/hover/label
state=Pressed#00d669project/pressed/label
state=Focus#d3d9d5project/focus/label
state=Disabled#d3d9d5project/disabled/label