A window overlaid on either the primary window or another dialog window, rendering the content underneath inert.
import React from 'react';
import { Icon } from '@minddrop/ui';
export const DialogDemo = () => (
<div style={{ display: 'flex', alignItems: 'center' }}>
<Icon name="settings" color="white" />
</div>
);
export default DialogDemo;
DialogTitle
and DialogDescription
components.Import the components from the @minddrop/ui
package.
import {
Dialog,
DialogTrigger,
DialogContent,
DialogTitle,
DialogDescription,
Button,
} from '@minddrop/ui';
export default () => {
return (
<Dialog>
<DrialogTrigger>
<Button>Edit profile</Button>
<DialogContent>
<DialogTitle>Edit profile</DialogTitle>
<DialogDescription>
Make changes to your profile here. Click save when you're
done.
</DialogDescription>
...
</DialogContent>
</DrialogTrigger>
</Dialog>
);
};
Contains all the parts of a dialog.
Prop | Type | Default |
---|---|---|
defaultOpen | boolean | |
open | boolean | |
onOpenChange | function | |
modal | boolean | true |
A wrapper component to be placed around the button which triggers the dialog.
Contains content to be rendered in the open dialog.
Prop | Type | Default |
---|---|---|
onOpenAutoFocus | function | |
onCloseAutoFocus | function | |
onEscapeKeyDown | function | |
onPointerDownOutside | function | |
onInteractOutside | function |
A wrapper component to be placed around a button which closes the dialog.
An accessible name to be announced when the dialog is opened. Alternatively, you can provide aria-label
or aria-labelledby
to DialogContent
and exclude this component.
An accessible description to be announced when the dialog is opened. Alternatively, you can provide aria-describedby
to DialogContent
and exclude this component.
Adheres to the Dialog WAI-ARIA design pattern.
Key | Description |
---|---|
Space | Opens/closes the dialog. |
Enter | Opens/closes the dialog. |
Tab | Moves focus to the next focusable element. |
Shift + Tab | Moves focus to the previous focusable element. |
Esc | Closes the dialog and moves focus to DialogTrigger . |