Components

Ribbon

A ribbon label: a band of colored paper with words on it, folded ends and all. For a section heading, a New flag on a card, a price label or a call to action.

Install

terminal
npx shadcn@latest add @wobko/ribbon

First time here? Add the registry to components.json first. How to install

Examples

A banner

A band of colored paper with folded, swallow-tailed ends. The words are real text; the paper is drawn behind them and grows with them.

Variants and colors

Banner (folded tails), swallow (a V notch at both ends) and flag (square at the start). The colors are the ones ink stays readable on; `paper` is a plain white ribbon.

On cards and as links

A flag pinned to a card edge, a banner as a section heading, and a ribbon that is a link: `asChild` puts the drawing on your element, which lifts on hover and takes the drawn focus ring.

API reference

Ribbon

A span (or your own link or button, with asChild) with the ribbon drawn behind its words. The band is a marker fill that misses its felt-tip outline; a banner's tails are one shade darker and tucked under the band with a small fold. The host is as wide as its words need.

PropTypeDefaultDescription
variant"banner" | "swallow" | "flag""banner"Folded swallow-tailed ends; a V notch at both ends; square at the start and notched at the end.
tone"marker" | "hi" | "tangerine" | "lemon" | "grass" | "teal" | "sky" | "bubblegum" | "paper""marker"The paper. Tomato and grape are left out: ink on them is 3.95:1, large text only.
size"sm" | "default" | "lg""default"Band height 26 / 34 / 46 px with 14 / 16 / 20 px type.
asChildbooleanfalseDraw the ribbon on the child element (an a or a button). A ribbon with asChild, onClick or href lifts 1 px on hover and shows a drop-line.
seedstring | number-Pins the hand: the same seed draws the same ribbon.
childrenReactNode-A few words on one line: the ribbon grows with them and never wraps, so keep it short on a narrow screen. A ribbon with onClick but no asChild is only a span: give a clickable one a link or a button.

Accessibility

  • The words are real DOM text on a plain span; the drawing is aria-hidden, ignores the pointer and never affects layout.
  • With asChild the ribbon is whatever you gave it: a link or a button, with its own role, keyboard behavior and name. Focus-visible draws a blue ring round the whole ribbon, tails included.
  • Ink text on each offered tone is at least 4.5:1 (marker 4.6 on its drawn fill, lemon and highlighter 12+). Windows high contrast hides the drawing and gives the element a real outline.
  • Hover lifts a link ribbon 1 px, draws a drop-line under it and underlines its words, so it is visible without hue. Reduced motion makes the lift instant. Calm density draws a hairline outline and a single-pass fill.

Source

The files the CLI copies into your project.

Loading the source