Skip to main content

successfulTransactionModal

Overview

The SuccessfulTransactionModal component provides a visually appealing modal for displaying successful transaction messages. It supports both light and dark themes and includes an animated appearance using Framer Motion.

Installation

  npm i @brightcodeui/beta-ui

Props

Prop NameTypeDescriptionDefault Value
isOpenbooleanControls whether the modal is visible.false
onClose() => voidFunction to close the modal.-
transactionHashstringThe hash of the successful transaction.-
theme`'light''dark'`Determines the modal's appearance.

Usage

Theming

The theme prop allows you to switch between light and dark themes:

  • Light Theme (Default)

        <SuccessfulTransactionModal 
    isOpen={true}
    transactionHash="0x1234567890abcdef"
    theme="light" onClose={() => {}}
    />
  • Dark Theme

      <SuccessfulTransactionModal 
    isOpen={true}
    transactionHash="0x1234567890abcdef"
    theme="dark" onClose={() => {}}
    />

Example with Storybook

This component is also available in Storybook with different configurations:

export const Default: Story = {
args: {
isOpen: true,
transactionHash: "0x1234567890abcdef",
theme: "light",
},
};

export const DarkMode: Story = {
args: {
...Default.args,
theme: "dark",
},
};

Conclusion

The SuccessfulTransactionModal component is an elegant and reusable solution for displaying transaction confirmations. It integrates smoothly into any React project and supports customizable themes.