身分證字號驗證
即時 checksum 驗證,自動辨識國民身分證與居留證,顯示 26 地區碼。
Real-time Taiwan national ID and ARC (Alien Resident Certificate) validation with checksum verification and region detection.
CLI
npx taiwan-ui add twid-inputnpm package
npm install @taiwan-ui/react| Prop | Type | Default |
|---|---|---|
value* | string | — |
onChange* | (value: string) => void | — |
onValidate | (result: TWIDResult) => void | — |
placeholder | string | "A123456789" |
disabled | boolean | false |
showRegion | boolean | true |
目前輸入值
佔位文字
停用輸入
顯示地區標籤
import TWIDInput from "@/components/taiwan/TWIDInput";
export default function Example() {
return (
<TWIDInput
placeholder="A123456789"
showRegion={true}
/>
);
}
import { useState } from "react";
import TWIDInput from "@/components/taiwan/TWIDInput";
export default function MyForm() {
const [id, setId] = useState("");
return <TWIDInput value={id} onChange={setId} />;
}