Gift Card Balance Checker
A gift card balance lookup form: enter a card number and security code and get back either the card's balance and recent transaction history, or a not-found error, checked against a fixed local lookup table. A reload mini-form sits below the result for topping up the balance.
Docs
Installation
A real shadcn registry command, not a copy-paste stand-in: it fetches this block plus its button dependencies and any missing npm packages, and installs them straight into your project.
npx shadcn add https://staaarter.com/r/gift-card-balance-checker.jsonPrefer not to use the CLI? Copy the source from the Code toggle above into src/components/blocks/ecommerce/ecommerce20.tsx instead.
Usage
The file also exports ecommerce20Demo, the exact props behind the preview above. Spread it to get a working section in one line, then replace it with your own data.
import { Ecommerce20, ecommerce20Demo } from "@/components/blocks/ecommerce/ecommerce20"; export default function Page() { return <Ecommerce20 {...ecommerce20Demo} />; }
Props
| Prop | Type | Default | Description |
|---|---|---|---|
| heading | string | "Check your gift card balance" | Heading above the form. |
| description | string | "Enter your card number and security code..." | Subheading under the heading. |
| cards | GiftCardRecord[] | none | The fixed lookup table checked against on submit. |
| className | string | none | Extra classes for the outer section element. |
Types
type Transaction = { date: string; description: string; amount: string; // pre-formatted, e.g. "-$25.00" or "+$50.00" }; type GiftCardRecord = { cardNumber: string; pin: string; balance: string; transactions: Transaction[]; };
Behavior notes
- The balance check is genuinely validated client-side: on submit, the typed card number and security code are trimmed and matched exactly against the cards array, and the found record's balance and transaction history render, or a "Card not found" error renders if nothing matches. No network call happens; cards is a fixed prop, not a live database.
- The reload mini-form (amount input + Reload button) below a found result is decorative only, submitting it does nothing. A real balance reload needs a backend to actually apply the charge and credit, which this block doesn't have.
- The reload form and transaction history only appear after a successful lookup; a not-found result shows just the error message.
More Ecommerce Blocks
View all →wishlist-manager
Wishlist Manager
Saved-items list with stock-status badges, move-to-cart and remove actions, and a real empty state.
product-information-tabs
Product Information Tabs
Tabbed product details with Description, Features, Specifications, Reviews, and Shipping panels.
collection-showcase-grid
Collection Showcase Grid
A large featured-collection hero card alongside a grid of smaller supporting collection tiles.
shop-by-brand-grid
Shop by Brand Grid
A grid of bordered brand tiles with a wordmark-style name, product count, and a hover affordance.
sale-countdown-timer
Sale Countdown Timer
A live days/hours/minutes/seconds countdown in default, compact, or full-width banner layouts.
gift-card-redemption-form
Gift Card Redemption Form
A code-entry form that validates against a fixed list of demo gift cards and shows a real success or error state.