Calm motion: animations on this site only fade, with no movement
Coachmark
A "new" dot on one control, seen once
A small pulsing mark on a feature that people have not met yet: a new button, a moved menu entry. It says what is new in a short bubble and goes away for good after a person sees it. For a walk through several things in order, use Tour. For a message that must be read, use Alert.
On a button
- Wrap the element in
<BlessCoachmark text="…">. The dot is a button named "New: …". It opens a bubble with the text and a Got it button, Esc closes the bubble. - It disappears when dismissed. By default it also disappears when a person uses the wrapped element (any click inside it), because using it is seeing it. To keep it until Got it, use
:dismiss-on-use="false". id="export"remembers the dismissal inlocalStorage, so it shows once per browser. Without anid,v-model:dismissedis the only memory and it is yours to keep. The dot appears after mount, so a server-rendered page never flashes it.- The pulse stops under
prefers-reduced-motion(a still ring remains).placementpicks the corner. The dot has a touch target larger than it looks.
Usage
ts
import { BlessCoachmark } from "blessing-ui";API
Props
| Name | Type | Default | Description |
|---|---|---|---|
text* | string | — | what is new, said in the bubble and to screen readers |
id | string | — | remembers a dismissal under this key (localStorage), so it shows once; omit to show until `dismissed` is set |
placement | "top-end" | "top-start" | "bottom-end" | "bottom-start" | "top-end" | which corner of the wrapped element the dot sits on |
dismissOnUse | boolean | true | using the wrapped element (a click inside it) counts as seen |
labels | Partial<{ dot: (text: string) => string; ok: string; }> | — | |
dismissed | boolean | false |
Events
| Name | Payload | Description |
|---|---|---|
dismiss | [] | |
update:dismissed | [value: boolean] |
Slots
| Name | Scope | Description |
|---|---|---|
default | — |