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
nid-input.tsx
"use client";
import { FormField, NidInput } from "@waveinno/ui";
export default function NidDemo() {
return (
<div className="grid gap-6 md:grid-cols-2">
<FormField label="NID, smart card">
<NidInput defaultValue="1234567890" />
</FormField>
<FormField label="NID, old 17 digits">
<NidInput defaultValue="19901234567890123" />
</FormField>
</div>
);
}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
nid-input-smart.tsx
"use client";
import { FormField, NidInput } from "@waveinno/ui";
export default function NidInputSmartExample() {
return (
<div className="w-full max-w-sm"><FormField label="NID"><NidInput defaultValue="1234567890" /></FormField></div>
);
}Old 17 digits
The older cards: it names the kind as you type.
Old NID, with birth year
nid-input-old.tsx
"use client";
import { FormField, NidInput } from "@waveinno/ui";
export default function NidInputOldExample() {
return (
<div className="w-full max-w-sm"><FormField label="NID"><NidInput defaultValue="19901234567890123" /></FormField></div>
);
}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| Prop | Type | Default | Description |
|---|---|---|---|
value | string | — | |
defaultValue | string | "" | |
onValueChange | (digits: string, info: { valid: boolean; kind: NidKind | null }) => void | — | |
state | InputState | "default" | |
labels | Partial<Record<NidKind, string>> | — |
Also takes Omit<React.InputHTMLAttributes<HTMLInputElement>, "value" | "defaultValue" | "onChange" | "type">.
<FormField>
src/components/ui/form-field.tsx| Prop | Type | Default | Description |
|---|---|---|---|
label | React.ReactNode | — | |
htmlFor | string | — | The control's id, so clicking the label focuses it. |
required | boolean | — | |
hint | React.ReactNode | — | |
error | React.ReactNode | — | |
warning | React.ReactNode | — | |
success | React.ReactNode | — | |
count | { value: number; max: number } | — | Character counter, e.g. { value: note.length, max: 240 }. |
className | string | — | |
childrenrequired | React.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