Chai
<bh-chai>
| BharatChai
The Chai component provides a delightful way to accept donations or tips through UPI payments. It displays a “Buy me a tea” / “Buy me a Chai” button that, when clicked, generates a QR code for UPI payment.
Basic Usage
<bh-chai upi="username@oksbi" name="Your Name"></bh-chai>
import React from 'react';import { BharatChai } from 'bharat-ui/react/components/chai';function App() {return ( <BharatChai upi="username@oksbi" name="Your Name"/>);}export default App;
Supported Banks
The component currently supports the following UPI bank codes:
okhdfcbank
- HDFC Bankoksbi
- State Bank of Indiaokicici
- ICICI Bankokaxis
- Axis Bankokyesbank
- Yes Bank
For more information, refer UPI docs here
Examples
With Image Variants
<bh-chai upi="user@okhdfcbank" name="Saumya" image-index="1"></bh-chai> <bh-chai upi="user@okhdfcbank" name="Saumya" image-index="2"></bh-chai> <bh-chai upi="user@okhdfcbank" name="Saumya" image-index="3"></bh-chai> <bh-chai upi="user@okhdfcbank" name="Saumya" image-index="4"></bh-chai>
import React from 'react';import { BharatChai } from 'bharat-ui/react/components/chai';function App() {return ( <> <BharatChai upi="user@okhdfcbank" name="Saumya" image-index="1"></BharatChai> <BharatChai upi="user@okhdfcbank" name="Saumya" image-index="2"></BharatChai> <BharatChai upi="user@okhdfcbank" name="Saumya" image-index="3"></BharatChai> <BharatChai upi="user@okhdfcbank" name="Saumya" image-index="4"></BharatChai> </>
);}export default App;
With Invalid UPI ID Validation
<bh-chai upi="user123@test" name="Test"></bh-chai>
import React from 'react';import { BharatChai } from 'bharat-ui/react/components/chai';function App() {return (
<BharatChai upi="user123@test" name="Test"></BharatChai>
);}export default App;
Properties
Property | Type | Description |
---|---|---|
name | string | Name of the recipient as registered in their bank account |
qrUrl | string | URL of the generated QR code |
showQR | boolean | Controls visibility of the QR code modal |
upi | string | UPI ID in the format username@bankcode |
image-index | number | Set button variant using image-index keys eg- image-index="1" . Supported keys till “4” |