CreditCardInput

core package3.2.2

Note: All components shown on this site are supported by the Constellation design system. To learn how to configure Theme Cosmos, visit Pega Community.

CreditCardInputs auto-format a credit card number based on the card type. This component only accepts numeric input.

Usage

The formatting for the value entered within the CreditCardInput (e.g., spaces) will be applied as a user types. The component also allows for standard Form Field structures such as being set required, disabled, or readOnly, as well as including a label, status, or info.

If there is a label and the Field is not disabled, passing an object to the additionalInfo prop that includes a heading and content will provide the user with more useful information on the Field when they click on the associated information Icon.

Related components

Properties

NameDescriptionDefaultType
onChange*(value: string) => void
additionalInfoPass a heading and content to show additional information on the field.
{
  content: string | Element;
  heading: string;
}
classNameAdditional CSS classes.string
disabledDisable the control. The browser defaults to false.boolean
idSets DOM id for the control and associates label element via 'for' attribute. If an id is not pass, a random id will be generated for any render.string
infoIt is recommended to pass a simple string to offer guidance. Text will be styled based on status prop.ReactNode
labelPass a string or a fragment with an Icon and string.ReactNode
labelHiddenVisually hides the label region.falseboolean
nameSets html name attribute for the underlying control. Useful for mapping to a data field.string
onBlur(value: string) => void
onFocus(value: string) => void
placeholderPlaceholder text. The browser defaults to an empty string.string
readOnlyMakes the component non editable and non clickable. The browser defaults to false.boolean
refRef for the wrapping element.Ref<HTMLInputElement>
requiredIndicate if the field is required. The browser defaults to false.boolean
statusSet visual state based on a validation state.
'error' |'pending' |'success' |'warning' 
valueCurrencyInput input value. Requires an onChange handler to update value.''string