Skip to main content

AccountModal

Description

AccountModal is a modal that displays connected wallet account information with actions to copy address and disconnect.

Examples

Here is an example for you to use with your own account button.

import { useWallet, AccountModal } from '@suiet/wallet-kit';

function App() {
const {connected} = useWallet()
const [showModal, setShowModal] = useState(false)

return (
// wrap your own button as the trigger of the modal
<AccountModal
open={showModal}
onOpenChange={(open) => setShowModal(open)}
onDisconnectSuccess={(walletName) => {
console.log(`Disconnected from ${walletName}`)
}}
onDisconnectError={(error) => {
console.error('Disconnect failed:', error)
}}
>
<YourOwnAccountButton />
</AccountModal>
)
}

API

Props

PropertiesDescriptionTypeDefault
childrentrigger element for the modalReactNodenull
openIndicator for opening the modalbooleanfalse
onOpenChangevisibility change event(open: boolean) => void--
onDisconnectSuccessCallback for successful disconnection(walletName: string) => void
onDisconnectErrorCallback for failed disconnection(error: BaseError) => void