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.
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.
npx shadcn@latest add @wobko/ribbon第一次使用?先把 registry 加进 components.json。 如何安装
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.
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.
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.
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.
| 属性 | 类型 | 默认值 | 说明 |
|---|---|---|---|
| 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. |
| asChild | boolean | false | Draw 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. |
| seed | string | number | - | Pins the hand: the same seed draws the same ribbon. |
| children | ReactNode | - | 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. |
CLI 会复制进你项目的文件。
正在加载源码