Bangladesh

NID input

10, 13 or 17 digits, grouped as printed; names the kind and never accepts a wrong length.

2 examples Code and Figma for each
Smart card
Old NID, with birth year

Examples#

Each one on its own: copy its code into your app, or copy it to Figma and paste it on the canvas as layers.

Smart card

10 digits, grouped as printed on the card.

Smart card

Old 17 digits

The older cards: it names the kind as you type.

Old NID, with birth year

Import#

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

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

Props#

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

<NidInput>

src/components/ui/nid-input.tsx
PropTypeDefaultDescription
valuestring—
defaultValuestring""
onValueChange(digits: string, info: { valid: boolean; kind: NidKind | null }) => void—
stateInputState"default"
labelsPartial<Record<NidKind, 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