健保卡驗證
全民健保卡號碼輸入,12 碼格式驗證,自動分組顯示。
Taiwan National Health Insurance card number input with 12-digit format validation.
CLI
npx taiwan-ui add nhi-card-inputnpm package
npm install @taiwan-ui/react| Prop | Type | Default |
|---|---|---|
value* | string | — |
onChange* | (value: string) => void | — |
onValidate | (result: NHIResult) => void | — |
placeholder | string | "000000000000" |
disabled | boolean | false |
目前輸入值(純數字)
佔位文字
停用輸入
import NHICardInput from "@/components/taiwan/NHICardInput";
export default function Example() {
return (
<NHICardInput
placeholder={0}
/>
);
}
import { useState } from "react";
import NHICardInput from "@/components/taiwan/NHICardInput";
export default function MyForm() {
const [card, setCard] = useState("");
return <NHICardInput value={card} onChange={setCard} />;
}