Skip to main content

Credit Card Input

The CreditCardInput is a group of inputs (card number, expiration date, CVV code) presented inside a single container.

Examples

Basic Credit Card Input

import { CreditCardInput } from '@curology/ui-components-web/react';

<CreditCardInput
label="Card Information"
required
size="small|medium(default)"
/>

Controlled Credit Card Input w/ Luhn validation

import { CreditCardInput } from '@curology/ui-components-web/react';

<CreditCardInput
...
helperText={error?.message}
onChange={handleChange}
state={error ? 'critical' : undefined}
value={value}
/>

Props

NameTypeDefault ValueRequiredDescription
defaultValuesCreditCardValuesNoA set of default values to pre-populate.
fieldClassNamestringNoA className to apply to the field.
fieldPropsRecord<string, unknown>NoAny props to spread onto the field container.
helperTextReactNodeNoA string or component to display as helper text beneath the input
iconEndstring | number | boolean | ReactElement<any, string | JSXElementConstructor<any>> | ReactFragment | ReactPortal | nullNoAn icon to render at the end of the input.
labelReactNodeNoA string or component to display as a label above the input
onChange((evt: ChangeEvent<InputType>, values: CreditCardValues) => void)NoEmit a new set of values whenever one of them changes.
requiredbooleanfalseNoIs the field required?
size"small" | FormControlSize | "medium"FormControlSize.MediumNoThe size of the field
state"" | FormControlState | "critical" | "warning" | "success"FormControlState.DefaultNoThe state of the field
valuesCreditCardValuesNoA set of values to set on the individual fields.