Calm motion: animations on this site only fade, with no movement
Cart drawer
The cart in a side panel, with quantities, the subtotal, and checkout
Opens the cart from the side of the screen, so the buyer stays on the page. It uses the sheet. For the totals on the checkout page, use the order summary.
Basic
v-modelis the list of lines. Each line has anid, aname, thepriceof one, and aquantity. It can also have animageand avariant, such as "Black, M".v-model:openopens and closes the panel. The title counts the items, such as "Cart (4)".- Each line has − and + buttons and a number field for the quantity. The quantity stays between 1 and
max(default 99). The ✕ button removes the line. - Each button has a name with the product, such as "One more USB microphone", so a screen reader user knows which line it changes.
- The footer shows the subtotal and a note that shipping and taxes come later. The checkout button emits
checkout. If the cart is empty, the button is off. currencyis an ISO 4217 code (defaultUSD), andlocalesets the format.- Change the words with
labelsor a label pack:empty,subtotal,note,checkout, and the functionstitle,remove,less,more, andquantity.
Usage
ts
import { BlessCartDrawer } from "blessing-ui";API
Props
| Name | Type | Default | Description |
|---|---|---|---|
currency | string | "USD" | |
locale | string | "en" | |
max | number | 99 | the most of one line a buyer can take |
labels | Partial<{ title: (count: number) => string; empty: string; subtotal: string; note: string; checkout: string; remove: (name: string) => string; less: (name: string) => string; more: (name: string) => string; quantity: (name: string) => string; }> | — | |
open | boolean | false | |
modelValue | BlessCartLine[] | [] |
Events
| Name | Payload | Description |
|---|---|---|
update:open | [value: boolean] | |
update:modelValue | [value: BlessCartLine[]] | |
checkout | [] |