docs/developer_docs/extensions/components/alert.mdx
import { StoryWithControls } from '../../../src/components/StorybookWrapper'; import { Alert } from '@apache-superset/core/components';
Alert component for displaying important messages to users. Wraps Ant Design Alert with sensible defaults and improved accessibility.
<StoryWithControls component={Alert} props={{ closable: true, type: 'info', message: 'This is a sample alert message.', description: 'Sample description for additional context.', showIcon: true }} controls={[ { name: 'type', label: 'Type', type: 'select', options: [ 'info', 'error', 'warning', 'success' ] }, { name: 'closable', label: 'Closable', type: 'boolean' }, { name: 'showIcon', label: 'Show Icon', type: 'boolean' }, { name: 'message', label: 'Message', type: 'text' }, { name: 'description', label: 'Description', type: 'text' } ]} />
Edit the code below to experiment with the component:
function Demo() {
return (
<Alert
closable
type="info"
message="This is a sample alert message."
description="Sample description for additional context."
showIcon
/>
);
}
| Prop | Type | Default | Description |
|---|---|---|---|
closable | boolean | true | Whether the Alert can be closed with a close button. |
type | string | "info" | Type of the alert (e.g., info, error, warning, success). |
message | string | "This is a sample alert message." | Message |
description | string | "Sample description for additional context." | Description |
showIcon | boolean | true | Whether to display an icon in the Alert. |
This component is available in the @apache-superset/core/components package, which is automatically available to Superset extensions.
import { Alert } from '@apache-superset/core/components';
function MyExtension() {
return (
<Alert
closable
type="info"
message="This is a sample alert message."
/>
);
}
This page was auto-generated from the component's Storybook story.