The props for the FundModal component.
Optionalchildren?: ReactNodeThe children to render inside the modal.
Optionalopen?: booleanWhether the modal is open. Note: if you set this, you must also set setIsOpen.
OptionalsetIsOpen?: (value: boolean) => voidA function to set the modal's open state. Note: if you set this, you must also set open.
OptionalclassName?: stringOptionalstyle?: CSSPropertiesOptionalonError?: (e: undefined | OnrampError) => voidOptionaltitle?: ReactNodeOptionalsubmitLabel?: ReactNodeOptionalonSuccess?: (result?: OnrampSuccessEventData) => voidOptionallocale?: stringOptionalcryptoDecimalPlaces?: numberOptionalfiatDecimalPlaces?: numberOptionalinputType?: InputTypeOptionalpresetAmountInputs?: FundPresetAmountInputsOptionalsubdivision?: stringOptionalopenIn?: "tab" | "popup"OptionalredirectUrl?: stringOptionalonStatus?: (lifecycleStatus: FundLifecycleStatus) => voidThe FundModal component.
// Render the FundModal component
function App() {
const fetchBuyQuote: FundProps["fetchBuyQuote"] = async (params) => {
// call the buy quote API
}
const fetchBuyOptions: FundProps["fetchBuyOptions"] = async params => {
// call the buy options API
}
return (
<CDPReactProvider config={config} theme={themeOverrides}>
<FundModal
country="US"
subdivision="NY"
cryptoCurrency="eth"
fiatCurrency="usd"
fetchBuyQuote={fetchBuyQuote}
fetchBuyOptions={fetchBuyOptions}
network="base"
presetAmountInputs={[10, 25, 50]}
/>
</CDPReactProvider>
);
}
// Render the FundModal component with a custom trigger button
function App() {
const fetchBuyQuote: FundProps["fetchBuyQuote"] = async (params) => {
// call the buy quote API
}
const fetchBuyOptions: FundProps["fetchBuyOptions"] = async params => {
// call the buy options API
}
return (
<CDPReactProvider config={config} theme={themeOverrides}>
<FundModal
country="US"
subdivision="NY"
cryptoCurrency="eth"
fiatCurrency="usd"
fetchBuyQuote={fetchBuyQuote}
fetchBuyOptions={fetchBuyOptions}
network="base"
presetAmountInputs={[10, 25, 50]}
>
<button className="fund-button">
Get ETH
</button>
</FundModal>
</CDPReactProvider>
);
}
A fund modal component that wraps the Fund component.