Skip to main content

Popover

A popover displays content on top of the page in a separate container and requires user action.

Submit feedback
github
import { Popover } from '@uhg-abyss/mobile';

useState

Pass the value from the useState hook to the isVisible prop to set the open state of the popover.

Heading

Use the heading prop to set the heading of the popover. For accessibility purposes, a heading is required. Please provide a heading that accurately describes the content of the popover so a screen reader can provide the description to the user.

Use the headingSize prop to set the size of the heading. The headingSize prop accepts small and large as values. The default size is large.

Paragraph

Use the paragraph prop to add a description below the heading. The paragraph should be concise and clear and must not expand on more than 4 lines.

Content

Use the content prop to add custom content below the paragraph.

Media

Use the media prop to add custom content above the heading.

Use the footer prop to place content at the bottom of the popover. The popover must always have at least one button, so users can close it.

onClose

Use the onClose function to handle the action when close button is triggered or when the background is pressed.

Popover Props

Prop NameTypeDefaultDescription
contentstring-Content of the popover
footernode-Component to show at the bottom of the popover
headingstring-Heading of the popover
headingSize'large' | 'small'largeSize of the heading
isVisiblebooleanfalseFlag to check if the popover is visible
medianode-Component to show at the top of the popover
onClosefunction-Callback fired when the popover is triggered to close
paragraphstring-Paragraph copy goes below the heading

Popover Classes

Class NameDescription
abyss-popover-dialogPopover dialog element
abyss-popover-footerPopover footer element
abyss-popover-headingThe heading text element of the popover
abyss-popover-overlayPopover overlay element
abyss-popover-paragraphThe paragraph text element of the popover
abyss-popover-rootPopover root element
abyss-popover-text-containerPopover container for text elements

Dynamic Type

To accommodate for larger text sizes, the popover will scroll when it has grown to have a 16px margin on the top and bottom. Depending on the screen size, the height of the popover when scrollable will vary. The footer does not scroll with the rest of the content. Please follow design guidelines when deciding the amount of content to place within popover.

Focus Guidance

Abyss does not control the focus of components on the screen when the Popover is toggled off. To meet accessibility guidelines, the focus must be set to the previous node when closed. The useSetFocus hook can be used for this.

For example, if a button is pressed to open a popover, focus must return to that button once the popover is closed, so that a screen reader or keyboard user may continue using the app where they left off.

Popover Classes

V2V1Status
-popover-containerRemoved
-popover-content-containerRemoved
popover-dialog-Added
popover-footer-Added
-popover-footer-containerRemoved
-popover-header-containerRemoved
popover-headingpopover-titleRenamed
popover-overlaypopover-overlayUnchanged
popover-paragraphpopover-copyRenamed
popover-rootpopover-rootUnchanged
popover-text-container-Added

Popover Props

V2V1Status
contentchildrenRenamed
footerfooterUnchanged
headingtitleRenamed
headingSize-Added
isVisibleisVisibleUnchanged
mediaheaderRenamed
onCloseonCloseUnchanged
paragraph-Added
-variantRemoved
Table of Contents