Stablev0.1.0identity

NHICardInput

健保卡驗證

全民健保卡號碼輸入,12 碼格式驗證,自動分組顯示。

Taiwan National Health Insurance card number input with 12-digit format validation.

Installation

CLI

npx taiwan-ui add nhi-card-input

npm package

npm install @taiwan-ui/react

Live Demo

Props API

PropTypeDefault
value*string
onChange*(value: string) => void
onValidate(result: NHIResult) => void
placeholderstring"000000000000"
disabledbooleanfalse

Playground

Props

目前輸入值(純數字)

佔位文字

停用輸入

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

export default function Example() {
  return (
    <NHICardInput
  placeholder={0}
/>
  );
}

Code Examples

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

export default function MyForm() {
  const [card, setCard] = useState("");

  return <NHICardInput value={card} onChange={setCard} />;
}
健保卡NHI12 碼

Related Components