Learn about the components which are available with Cashfree.js
Once you have initialized the cashfree.js sdk you can use the create method to create a component
A component can be mounted in DOM container
Example
The values of a component can be updated
Example
To unmount a component from DOM container. Use component.mount to mount again
To get the data and state of a component
Name | Description | Default |
---|---|---|
value | Contains the value of the component. | {} |
error | Contains error that has occurred in the component | undefined |
message | Contains any message that can be shown to the customer | {} |
invalid | Is true is the component is invalid | undefined |
empty | Is true if the component is empty | false |
complete | Is true if the component is complete | false |
ready | Is true if the component is ready for user input | false |
componentName | Contains the type of the component | componentName |
node | Contains the reference to the parent of the component | null |
mounted | Is true if the component has been mounted | false |
Trigger blur on component. Can only be applied if kind
of the component is input
Trigger focus on component. Can only be applied if kind
of the component is input
Trigger clear on component to empty it. Can only be applied if kind
of the component is input
Trigger click on component. Can only be applied if kind
of the component is button
Disabling component will apply the classes.disabled
and style.base[":disabled"]
or style.empty[":disabled"]
to the container and compoent respectively. Can be applied to input
and button
To enable a disabled component. Can be applied to input
and button
To destroy a component. Once a component is destroyed it cannot be mounted again
You can register a callback function to various events that occur with a component. The basic syntax is component.on(eventName, callBackFunction)
Triggers when a component is ready for user interaction
Triggers on component kind
input
when focussed
Triggers on component kind
input
when blurred
Triggers on component kind
input
when value entered by the user is invalid. Callback receives object that has the error. Read more about error here
Triggers on component kind
input
whenever change happens for the value
Triggers on component kind
input
when empty
Triggers on component kind
input
when value entered is complete and valid
Triggers on component kind
button
when clicked
Triggers on component payable components when payment has been successfully initiated
Triggers on component which could not be mounted. Callback receives object that has the error. Read more about error here