CoreAlert
Inline alert banner with type-based icon, optional description, dismissible close button, and trailing action slot.
Inline alert banner with type-based icon, optional description, dismissible close button, and trailing action slot.
import { CoreAlert } from "@tetherto/mdk-react-devkit";| Prop | Status | Type | Default | Description |
|---|---|---|---|---|
type | Optional | AlertType | undefined | — | Alert type |
title | Optional | React.ReactNode | — | Main message |
description | Optional | React.ReactNode | — | Additional description |
showIcon | Optional | boolean | undefined | — | Show the type icon |
icon | Optional | React.ReactNode | — | Custom icon (used when showIcon is true) |
closable | Optional | boolean | undefined | — | Makes the alert closable |
onClose | Optional | React.MouseEventHandler<HTMLButtonElement> | undefined | — | Called when close button is clicked |
banner | Optional | boolean | undefined | — | Display as full-width banner (no border radius, no margin) |
action | Optional | React.ReactNode | — | Action element rendered to the right |
className | Optional | string | undefined | — | Custom className |
style | Optional | React.CSSProperties | undefined | — | Custom styles |
Usage
Contextual feedback banner for success, info, warning, and error messages. Supports icons, close button, an action slot, and an optional full-width banner mode.
Notes
- Once closed via the ✕ button, the component returns
nulland cannot be reopened without unmounting/remounting. - Setting
descriptionautomatically adds themdk-alert--with-descriptionmodifier for extra spacing.
Example
/** * Runnable example for Alert. */import { CoreAlert } from '@tetherto/mdk-react-devkit'export const AlertExample = () => ( <div className="mdk-example-col"> <CoreAlert type="info" title="Informational" description="Your miner firmware update is ready to install." showIcon /> <CoreAlert type="success" title="Success" description="Pool credentials updated successfully." showIcon closable /> <CoreAlert type="warning" title="Warning" description="Hash rate dropped below threshold — check your connections." showIcon /> <CoreAlert type="error" title="Error" description="Failed to connect to the pool. Verify your credentials." showIcon closable /> </div>)