Skip to main content

Wallet Display Modal

Overview

The WalletModal component is a modal window that displays a user's wallet details, including their address, balance, and an avatar. It provides functionalities such as copying the wallet address and disconnecting the wallet. The component also features smooth animations for opening and closing.

Props

Prop NameTypeDescriptionDefault
isOpenbooleanDetermines if the modal is open.false
onClose() => voidFunction to close the modal.-
addressstringThe wallet address of the user.-
balancestringThe balance of the user's wallet.-
currencystringThe currency unit of the balance (e.g., ETH, BTC).-
onCopy() => voidCallback function triggered when the address is copied.-
onDisconnect() => voidCallback function triggered when the user disconnects the wallet.-
classNamestringAdditional class names for custom styling.""
avatarUrlstringURL of the user's wallet avatar.""

Features

  • Displays Wallet Details: Shows the wallet address, balance, and currency.
  • Copy Wallet Address: Users can copy their wallet address with a single click.
  • Disconnect Wallet: Allows users to disconnect their wallet from the application.
  • Smooth Animations: Modal appears and disappears with transition effects.

Installation

    npm install @brightcodeui/beta-ui

Basic Example

Methods & Event Handlers

  • onClose() : Closes the modal.
  • onCopy() : Copies the wallet address to the clipboard.
  • onDisconnect() : Handles wallet disconnection.

Notes

  • The component uses Tailwind CSS for styling.
  • Ensure that the parent component manages the isOpen state properly.
  • Wallet address formatting is handled internally to improve readability.