Bangladesh

Phone input

+880 mobile numbers typed any way, Bangla digits too; names the operator and gives back +8801XXXXXXXXX.

+880Grameenphone

Type it any way: 017…, +880 17…, or in Bangla digits.

+880

Try 012: no operator uses it.

Import#

Everything comes from the package root. The example above uses:

your-component.tsx
import { type BdPhone, FormField, PhoneInput } from "@waveinno/ui";

Props#

Read from the source of this version, so they match the code exactly.

<PhoneInput>

src/components/ui/phone-input.tsx
PropTypeDefaultDescription
valuestring—Any form of the number; "+8801712345678" is what you get back.
defaultValuestring""
onValueChange(e164: string, phone: BdPhone) => void—
showOperatorbooleantrueShow the operator on the right as you type. Default true.
stateInputState"default"
labels{ invalidPrefix?: string }—

Also takes Omit<React.InputHTMLAttributes<HTMLInputElement>, "value" | "defaultValue" | "onChange" | "type">.

<FormField>

src/components/ui/form-field.tsx
PropTypeDefaultDescription
labelReact.ReactNode—
htmlForstring—The control's id, so clicking the label focuses it.
requiredboolean—
hintReact.ReactNode—
errorReact.ReactNode—
warningReact.ReactNode—
successReact.ReactNode—
count{ value: number; max: number }—Character counter, e.g. { value: note.length, max: 240 }.
classNamestring—
childrenrequiredReact.ReactNode—

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