Commit 12668392 by Alex Khomenko Committed by GitHub

Grafana-UI: Expand ConfirmModal docs (#27541)

parent 1983de96
...@@ -7,4 +7,18 @@ import { ConfirmModal } from './ConfirmModal'; ...@@ -7,4 +7,18 @@ import { ConfirmModal } from './ConfirmModal';
Used to request user for action confirmation, e.g. deleting items. Triggers provided 'onConfirm' callback. Used to request user for action confirmation, e.g. deleting items. Triggers provided 'onConfirm' callback.
# Usage
```jsx
<ConfirmModal
isOpen={false}
title='Delete user'
body='Are you sure you want to delete this user?'
confirmText='Confirm'
icon='exclamation-triangle'
onConfirm={() => console.log('Confirm action')}
onDismiss={() => console.log('Dismiss action')}
/>
```
<Props of={ConfirmModal} /> <Props of={ConfirmModal} />
...@@ -8,13 +8,21 @@ import { GrafanaTheme } from '@grafana/data'; ...@@ -8,13 +8,21 @@ import { GrafanaTheme } from '@grafana/data';
import { HorizontalGroup } from '..'; import { HorizontalGroup } from '..';
export interface Props { export interface Props {
/** Toggle modal's open/closed state */
isOpen: boolean; isOpen: boolean;
/** Title for the modal header */
title: string; title: string;
/** Modal content */
body: React.ReactNode; body: React.ReactNode;
/** Text for confirm button */
confirmText: string; confirmText: string;
/** Text for dismiss button */
dismissText?: string; dismissText?: string;
/** Icon for the modal header */
icon?: IconName; icon?: IconName;
/** Confirm action callback */
onConfirm(): void; onConfirm(): void;
/** Dismiss action callback */
onDismiss(): void; onDismiss(): void;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment