Stablev0.1.0identity

TWIDInput

身分證字號驗證

即時 checksum 驗證,自動辨識國民身分證與居留證,顯示 26 地區碼。

Real-time Taiwan national ID and ARC (Alien Resident Certificate) validation with checksum verification and region detection.

Installation

CLI

npx taiwan-ui add twid-input

npm package

npm install @taiwan-ui/react

Live Demo

Props API

PropTypeDefault
value*string
onChange*(value: string) => void
onValidate(result: TWIDResult) => void
placeholderstring"A123456789"
disabledbooleanfalse
showRegionbooleantrue

Playground

Props

目前輸入值

佔位文字

停用輸入

顯示地區標籤

Generated code
import TWIDInput from "@/components/taiwan/TWIDInput";

export default function Example() {
  return (
    <TWIDInput
  placeholder="A123456789"
  showRegion={true}
/>
  );
}

Code Examples

import { useState } from "react";
import TWIDInput from "@/components/taiwan/TWIDInput";

export default function MyForm() {
  const [id, setId] = useState("");

  return <TWIDInput value={id} onChange={setId} />;
}
校驗碼26 地區碼ARC 支援checksum

Related Components