Bangladesh
Address picker
8 divisions, 64 districts, in English or Bangla; stores ids so the language can change.
{"division":"dhaka","district":"dhaka","area":"House 12, Road 7, Gulshan 1","postcode":"1212"}bd-address.tsx
"use client";
import { BdAddressPicker, type BdAddress, Segmented } from "@waveinno/ui";
import * as React from "react";
export default function AddressDemo() {
const [lang, setLang] = React.useState<"en" | "bn">("en");
const [address, setAddress] = React.useState<BdAddress>({ division: "dhaka", district: "dhaka", area: "House 12, Road 7, Gulshan 1", postcode: "1212" });
return (
<div className="space-y-4">
<Segmented
ariaLabel="Language"
value={lang}
onChange={setLang}
options={[
{ value: "en", label: "English" },
{ value: "bn", label: "বাংলা" },
]}
/>
<BdAddressPicker value={address} onValueChange={setAddress} lang={lang} />
<pre className="overflow-x-auto rounded-[10px] bg-surface p-3 text-[12px] text-muted">{JSON.stringify(address)}</pre>
</div>
);
}Import#
Everything comes from the package root. The example above uses:
your-component.tsx
import { BdAddressPicker, type BdAddress, Segmented } from "@waveinno/ui";Props#
Read from the source of this version, so they match the code exactly.
<BdAddressPicker>
src/components/ui/bd-address.tsx| Prop | Type | Default | Description |
|---|---|---|---|
value | BdAddress | — | |
defaultValue | BdAddress | {} | |
onValueChange | (address: BdAddress) => void | — | |
lang | "en" | "bn" | "en" | |
fields | ("area" | "postcode")[] | ["area", "postcode"] | Which text fields follow the two lists. Default both. |
disabled | boolean | — | |
required | boolean | — | |
labels | Partial<Record<"division" | "district" | "area" | "postcode" | "chooseDivision" | "chooseDistrict" | "divisionFirst", string>> | — | |
className | string | — |
<Segmented>
src/components/ui/segmented.tsx| Prop | Type | Default | Description |
|---|---|---|---|
valuerequired | T | — | |
onChangerequired | (v: T) => void | — | |
optionsrequired | SegmentedOption<T>[] | — | |
className | string | — | |
ariaLabel | string | — | |
variant | keyof typeof TRACK | "pill" | |
size | keyof typeof SIZES | "sm" | |
fullWidth | boolean | false | Stretch to the container, options sharing the width equally. |
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