Skip to content
Calm motion: animations on this site only fade, with no movement

Wishlist button ​

A heart that saves a product, with a count and a status message

Lets a buyer keep a product for later. Put it on a product card or a product page.

Basic
  • v-model is true when the product is saved.
  • name is the name of the product. The button is a toggle named "Save … to the wishlist", so screen readers hear its state as pressed or not pressed.
  • A saved heart is filled, and a heart that is not saved is an outline. The shape changes, not only the color.
  • After a click, a hidden status line says that the product is in or out of the wishlist. A page load says nothing.
  • count shows how many people saved the product. Give the new count after a click.
  • If the reader saves the product, the heart grows for a moment. Under reduced motion, it does not move.
  • Change the words with labels or a label pack: the functions save, added, and removed.

Usage ​

ts
import { BlessWishlistButton } from "blessing-ui";

API ​

Props

NameTypeDefaultDescription
name*string—the name of the product, for the name of the button
countnumber—how many people saved it
labelsPartial<{ save: (name: string) => string; added: (name: string) => string; removed: (name: string) => string; }>—
modelValuebooleanfalse

Events

NamePayloadDescription
update:modelValue[value: boolean]

Released under the MIT License. Character names and artwork belong to their owners.