Put the input in a Field with a label and an error; details.expired tells you when to show the error.
The sample also uses Field. One command adds them with this item:
card-expiry.tsx
CardExpiryInput
<div>| Prop | Type | Default | Description |
|---|---|---|---|
| class | string | — | |
| rounded | "default""full" | "default" | |
| size | "default""lg""sm""xs" | "default" | |
| variant | "dashed""default" | — | |
| disabled | boolean | false | Turns the control off; the frame fades to 50% with it (the Base UI name). |
| read | boolean | false | The date shows and can be copied, but not changed (the Base UI name). |
| value | string | — | The shown expiry (controlled). "0829" shows "08/29". |
| default | string | "" | The first shown expiry (uncontrolled). |
| on | — | Runs on every change with the text, { month, year }, the checks, and expired. | |
| now | DisplayNow | — | "Now" for the expired check (tests, stories). Default: the display now, else the mount time. |
| ...props | <div> attributes | — | Every other attribute goes to the <div>, with a ref. |
CardExpiryInputControl
<div>| Prop | Type | Default | Description |
|---|---|---|---|
| class | string | — | |
| guide | boolean | — | The ghost guide of the slots still to fill, while the input has focus. Default true. |
| raw | string | — | Also submit the raw value under this name (a hidden input), next to the shown one. |
| reject | boolean | — | Nudge the field 2px when the mask rejects a key. Default true. |
| on | — | Runs when the mask rejects a key (a letter in a number, a 13th month). | |
| ref | Ref<HTMLInputElement> | — | |
| rounded | "default""full" | — | |
| size | "default""lg""sm""xs" | — | |
| ...props | <div> attributes | — | Every other attribute goes to the <div>. |
Built with
Installs with Card Expiry Input
- Components
- Input Group,Masked Input













