v2.0.5

Modal Dialog

Installation

Install yarn add @spark-web/modal-dialog
Source GitHub.com
Bundle unpkg.com

Content Dialog

Content dialog is a window overlaid on either the primary window or another dialog window, rendering the content inside.

Examples

Controlled example

Uncontrolled example

Overflow

The content dialog will fill the available vertical space. When this happens the "body" section will become scrollable.

Props

PropTypeDescription

children

ReactNode: string | number | false | true | {} | ReactElement<any, string | JSXElementConstructor<any>> | Iterable<ReactNode> | ReactPortal

Children elements to be rendered as content inside the modal.

title

string

Sets the title of the modal.

data?

DataAttributeMap

Sets data attributes on the component.

description?

string

Sets a description for the modal.

isOpen?

boolean

Sets whether the modal should be open or not. Used only for controlled modal dialogs.

onToggle?

() => void

Callback function called upon modal dialog being toggled. Used only for controlled modal dialogs.

size?

"xsmall" | "small" | "medium" | "large" | "xlarge"

Sets the width of the modal.

Default: "small"

trigger?

ReactNode: string | number | false | true | {} | ReactElement<any, string | JSXElementConstructor<any>> | Iterable<ReactNode> | ReactPortal

Component that toggles the modal. Used by uncontrolled modal dialogs.

DialogCloseButton

Alternate method of closing the ContentDialog. Useful when you need to dismiss the modal instead of continuing completing the primary action.

Props

The DialogCloseButton accepts native HTML button props and are not listed here.

© 2023 Brighte Capital Pty Ltd