A grocery delivery app home screen built with Tailwind CSS: a delivery address header, a delivery time badge, a swipeable deals carousel, a category grid with icons, a frequently bought list with add buttons and a live cart. It is an HTML mobile template for mobile websites and PWAs and can be packaged as a native app with Capacitor. Use it as the home screen UI of an online supermarket, quick commerce or farm shop app.
How it works
The root .gdh-app is a phone-width column. The header button opens #gdh-address-sheet, a native <dialog> styled as a bottom sheet with radio cards; Deliver here writes the choice into [data-gdh-address]. The green badge shows the arrival time, which script.js calculates from the current time plus ETA_MINUTES, and the deals heading shows the weekday the offers end.
The deals row [data-gdh-track] uses CSS scroll snap. A scroll listener works out which .gdh-deal card is in view and marks the matching .gdh-dot with aria-current; tapping a dot scrolls to that deal. Each deal has a round add button (data-gdh-add) that turns into a check once the item is in the cart.
The category grid uses .gdh-cat toggle buttons with inline SVG icons. Tapping one filters the frequently bought list by data-gdh-cat-of, and the search field filters it by product name; applyFilter() combines both, renames the list heading and shows Show all and an empty message when needed.
Every product row ends in a [data-gdh-ctrl] element with name, price and starting quantity in data attributes. renderCtrl() draws an add button at zero and a minus / count / plus stepper above zero. The cart badge, the sticky .gdh-cartbar and #gdh-cart-sheet (lines, subtotal, delivery fee and free delivery hint) all update from the same cart object. Checkout runs a short simulated order and shows a confirmation with the arrival time. The tab bar switches between the home panel and a simple panel for the other tabs.
Customization
--gdh-accent,--gdh-accent-darkand--gdh-softon.gdh-appinstyle.css: the green of buttons, badges, the cart bar and active tab.--gdh-radiusinstyle.css: corner radius of cards, icon tiles, inputs and buttons (16px).FREE_DELIVERY_FROMandDELIVERY_FEEinscript.js: the free delivery threshold and the fee shown in the cart sheet.ETA_MINUTESandDEAL_DAYS_LEFTinscript.js: arrival time and the weekday in the deals heading.data-gdh-priceanddata-gdh-qtyon each[data-gdh-ctrl]: product price and the quantity already in the cart.flex: 0 0 85%in.gdh-deal: how much of the next deal card peeks in.- Replace the
setTimeoutin the checkout handler withfetch()to your order API.
Use cases
- Grocery and supermarket delivery apps: the main home screen with offers and quick reorders.
- Quick commerce PWAs: 15-minute delivery with a visible arrival time.
- Farm shops and organic box schemes: weekly boxes as deals and regular buys below.
- Pharmacy or convenience store apps: the same layout with other categories.
Accessibility
Buttons have clear labels such as "Add Bananas to cart", steppers are grouped with an aria-label, and category buttons use aria-pressed. The carousel is a labelled, keyboard-scrollable region with slide labels, and the active tab uses aria-current="page". Cart changes, filters, address changes and the order result are announced in a polite live region. Both bottom sheets close with Escape or the backdrop and return focus to the button that opened them. All touch targets are at least 44 px. The product photos come from Unsplash; replace them with your own images.