Understand how to customize a component as per your requirements
Cashfree.js
component is initialized with a configuration object that allows you to customize both its behavior and appearance. The configuration object helps you seamlessly integrate the component with your application’s design system.
object
You can use classes
which is an object that will have names of classes. The classes you specify will be applied to DOM container where the component is mounted. You have to make sure that these are present in your application css .
string
you provide as a value of base will be applied to the container. This is the base class. If you do not provide a value of base, default value of cf-base-private
will be applied.
5px
will be added to your container once a component is mounted
cf-complete-private
.base
and complete
you can figure out that when the component is complete it will have two classes so css of both of the classes wil be applied which are
cf-empty-private
Examplebox-shadow
will appear in your container
cf-focus-private
Example5px
cf-invalid-private
Examplered
border
cf-disabled-private
Examplearray
Using fonts you can make sure that the text inside component has the same font as your web application.
https://fonts.googleapis.com/css?family=Open+Sans
src
and fontFamily
You can specify multiple fonts and choose which to use in the component
object
The style
object is used to apply css properties to the contents of the component. It is different from classes
in the fact that classes
are used to apply css to the container that contains the component. There are 4 variants base
, complete
, empty
and invalid
.
You are free to add any css property by converting the propery type to camelCase and having the proerty value as string. Example being fontSize: '16px'
for font-size: 16px
:hover
:focus
:dsiabled
::placeholder
object
The values property is used to initialize a component with a particular starting state. The keys of the values object changes according to the component type.
cardHolder
upiCollect
bool
You can use this to specify if the component should be loaded in a disabled state. Please note that the classes.disabled
and style.base[":disabled"]
or style.empty[":disabled"]
will be applied to the container and compoent respectively
bool
Display skeleton loader UI while waiting for Elements to be fully loaded, after they are mounted. Not all components might support loader