Put the brand badge and the control in the input, inside a Field with a label and an error.
The sample also uses Field. One command adds them with this item:
card-number.tsx
CardNumberInput
<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 card number shows and can be copied, but not changed (the Base UI name). |
| value | string | — | The shown number (controlled). Raw digits show formatted: "4242424242424242". |
| default | string | "" | The first shown number (uncontrolled). |
| on | — | Runs on every change with the shown number, the digits, the checks, and the brand. | |
| ...props | <div> attributes | — | Every other attribute goes to the <div>, with a ref. |
CardNumberInputBrand
<div>CardNumberInputControl
<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 Number Input
- Components
- Card Brand,Input Group,Masked Input













