Primitives
Bottom sheet
Sheet side="bottom": a handle you can drag down to close; a centred card on wider screens.
bottom-sheet.tsx
"use client";
import {
Button,
PaymentMethodPicker,
Sheet,
SheetContent,
SheetDescription,
SheetTitle,
SheetTrigger,
toast,
} from "@waveinno/ui";
import { Sparkles } from "lucide-react";
import * as React from "react";
export default function BottomSheetDemo() {
const [open, setOpen] = React.useState(false);
return (
<div className="flex flex-wrap gap-3">
<Sheet open={open} onOpenChange={setOpen}>
<SheetTrigger asChild>
<Button variant="primary">
<Sparkles /> Pay ৳120
</Button>
</SheetTrigger>
<SheetContent side="bottom" className="px-5 pb-6">
<SheetTitle className="text-[17px] font-semibold text-text">Pay for DHA-GA 12-3456</SheetTitle>
<SheetDescription className="mt-0.5 text-[13px] text-muted">2 h 10 min at Gulshan, level B. Drag the handle down to close.</SheetDescription>
<PaymentMethodPicker className="mt-5" methods={["bkash", "nagad", "card", "cash"]} />
<Button
variant="gradient"
size="lg"
className="mt-5 w-full"
onClick={() => {
setOpen(false);
toast.success("Paid ৳120");
}}
>
Pay ৳120
</Button>
</SheetContent>
</Sheet>
</div>
);
}Import#
Everything comes from the package root. The example above uses:
your-component.tsx
import {
Button,
PaymentMethodPicker,
Sheet,
SheetContent,
SheetDescription,
SheetTitle,
SheetTrigger,
toast,
} from "@waveinno/ui";Props#
Read from the source of this version, so they match the code exactly.
<SheetContent>
src/components/ui/sheet.tsx| Prop | Type | Default | Description |
|---|---|---|---|
side | "right" | "left" | "bottom" | "right" | |
width | string | — | Width classes for a side sheet. Default "w-full sm:w-drawer". |
scrim | boolean | true | |
hideClose | boolean | — |
Also takes ComponentPropsWithoutRef<typeof DialogPrimitive.Content>.
<Button>
src/components/ui/button.tsx| Prop | Type | Default | Description |
|---|---|---|---|
asChild | boolean | false | |
loading | boolean | — |
Also takes ButtonHTMLAttributes<HTMLButtonElement> & VariantProps<typeof buttonVariants>.
<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