A wishlist screen for shopping apps, built with pure CSS and vanilla JavaScript: saved items show price drop badges, each product has its own price alert switch, and shoppers can move items to the bag or remove them with an undo toast. It is an HTML mobile template for mobile sites and PWAs, and it can be packaged as a native app with Capacitor. Use it as the saved items page, favorites screen or wishlist tab of a home, lifestyle or electronics store.
How it works
The root .wl-app is a phone-width column (max 430px, centred on wider screens) with a sticky top bar and a sticky .wl-tabs bottom tab bar. Each saved product is an li.wl-item with data-wl-price; items with a lower price also carry data-wl-was (the old price) and data-wl-days (when the price fell). From these values update() fills the .wl-hero summary (price drops and total saving) and all counters.
The .wl-chip buttons use aria-pressed and hide rows that do not match. Each row has an input.wl-switch for the price alert, a .wl-remove and a .wl-move button. Removing or moving a row shows the .wl-toast with Undo, which restores the item in place; Move to bag also raises the Bag tab counter. The toast hides after six seconds or on Escape, and [data-wl-empty] covers empty filters.
Dates are computed from today ("Price dropped today", "Saved Nov 14") without a year, so the screen never goes stale.
Customization
--wl-accent,--wl-accent-textand--wl-accent-softon.wl-app: the coral of the switches, discount badges, active tab and hero icon.--wl-inkon.wl-app: the near-black of the hero card, active chip, Move to bag button and toast.--wl-radiuson.wl-app: the 14px corner radius of photos, cards and the toast.data-wl-wasanddata-wl-dayson anli.wl-item: add them to mark a price drop, remove them for a regular saved item (thendata-wl-savedsets the saved date).data-wl-bagon.wl-app: the starting number on the Bag tab badge.TOAST_MSinscript.js: how long the undo toast stays visible.
Use cases
- Home and furniture stores: shoppers wait for a sofa or chair to go on sale.
- Electronics shops: price alerts on gadgets with frequent discounts.
- Fashion and lifestyle PWAs: a Saved tab next to Home, Search and Bag.
- Marketplace apps built with Capacitor: one place to compare saved products before checkout.
Accessibility
The chips sit in a labelled group with aria-pressed. Alert switches are real checkboxes with role="switch" and a visible label. Remove buttons name the product, and after a removal focus moves to the next row or to Undo. A polite live region announces filters, alert changes and removals. Controls are at least 44px with visible focus, and the switch animation respects prefers-reduced-motion.
Usage notes
Product photos come from Unsplash; replace them with your own images. Prices are sample data. Call your cart and alert APIs with fetch() in the click and change handlers.