Bangladesh
Payment method picker
bKash, Nagad, Rocket, Upay, card, cash, bank, cash on delivery. Cards, list or chips; fees beside each.
Cards, with fees
List, every method
Chips
payment-method-picker.tsx
"use client";
import { PaymentMethodPicker } from "@waveinno/ui";
import * as React from "react";
export default function PaymentDemo() {
const [method, setMethod] = React.useState("bkash");
return (
<div className="grid gap-8 lg:grid-cols-2">
<div>
<p className="mb-2 text-[13px] font-medium text-text">Cards, with fees</p>
<PaymentMethodPicker value={method} onValueChange={setMethod} fees={{ bkash: "1.85%", nagad: "1.5%", card: "2.5%", cash: "Free" }} />
</div>
<div className="space-y-6">
<div>
<p className="mb-2 text-[13px] font-medium text-text">List, every method</p>
<PaymentMethodPicker variant="list" methods={["bkash", "nagad", "rocket", "upay", "card", "bank", "cod"]} defaultValue="cod" />
</div>
<div>
<p className="mb-2 text-[13px] font-medium text-text">Chips</p>
<PaymentMethodPicker variant="chips" methods={["bkash", "nagad", "card", "cash"]} />
</div>
</div>
</div>
);
}Import#
Everything comes from the package root. The example above uses:
your-component.tsx
import { PaymentMethodPicker } from "@waveinno/ui";Props#
Read from the source of this version, so they match the code exactly.
<PaymentMethodPicker>
src/components/ui/payment-method-picker.tsx| Prop | Type | Default | Description |
|---|---|---|---|
value | string | — | |
defaultValue | string | — | |
onValueChange | (id: string) => void | — | |
methods | (PaymentMethodId | PaymentMethod)[] | ["bkash", "nagad", "card", "cash"] | |
fees | Partial<Record<string, React.ReactNode>> | — | Beside each method: "No fee", "1.85%", "−৳50". |
variant | "cards" | "list" | "chips" | "cards" | |
disabled | boolean | — | |
aria-label | string | "Payment method" | |
className | string | — |
Install#
If the project does not have the package yet, add it, then follow the setup for Next.js or Vite once.
$ npm install @waveinno/ui