Return to Sky UI homepage
import { Modal } from '@sky-uk/ui-core';

Modal offers a more focused view on something that the user may need to action. It can also offer further information that may be important, or relevant, to something in-page.

The component consists of Modal.Content and optional Modal.CloseButton.

Props

$fullScreen

$fullScreen can be used to render a full-page modal. This can be used if you have a need for more copy or want to display media-driven content.

stopEventPropagation

The stopEventPropagation prop can be used to prevent the events from the Modal progating to the parent element.

Sub Components

Close button

Default appearance of the Close button floating over the content.

$inline property would push the content section under the Close button section.

Accessibility

The Modal component will force focus to its close button when first opened.

This ensures keyboard-only and screenreader users can access it. If used without the close button, focus will be forced onto the first interactive element within it.

There are some use-cases where this may not be appropriate. Please refer to the W3C Dialog Modal Design Pattern for more details.

Returning Focus

Returning focus to a Button used to open the Modal is left to the concern of the consumer. Below is an example of how to achieve this desired outcome.

System Modifiers

The Modal component supports the props applied using the following system functions:

Modal.Content supports

Translatable Fields

The Modal support translation on the following fields:

  • Modal.closeLabel - controls the close button text on the Modal component

For more on translatable fields, view the useTranslation docs here: useTranslation