Popover

Popover lets you create accessible popovers 😉.


Popovers that are really easy to use

No need for endless configuration. Just specify an id for the PopoverContent and target it with PopoverTrigger to get started.

<PopoverTrigger target="popover"> ... </PopoverTrigger>
<PopoverContent id="popover"> ... </PopoverContent>

Easy Debugging

Set show to true on PopoverTrigger to show your PopoverContent when it loads. This makes it easy to debug and style PopoverContent!

<PopoverTrigger show target="popover">Pop Top</PopoverTrigger>

Flexible positioning

You can place popovers on the top, bottom, left and right. You can even shift them towards the start or end of that position for further fine-tuning!

<PopoverContent
id="popover"
options={{placement: 'top'}}
>
...
</PopoverContent>

Specify offsets in em and rem

Have you noticed that most popover libraries force you to specify an offset in px values, even when you style the rest of your content in rem and em?

Well, we don’t. Go ahead and use rem and em.

<PopoverContent
id="popover"
options={{offset: '0.5rem'}}
>
...
</PopoverContent>

Built-in arrows — no need to make them yourself

Set the arrow option to true and PopoverContent will create a built-in arrow for you. They work in all 12 positions too.

<PopoverContent id="popover" options={{ arrow: true }}>
Pop Top
</PopoverContent>
You can even prevent subpixel rendering errors with the arrow delta option!

Actually accessible (not just claiming to be)

Popover built to be accessible — for both keyboards users and screen readers.

We have taken the pains to understand the ARIA specifications and built the component to meet that specification, to the best of our abilities.

First — the most basic of all features — is you can open and close the popover with your keyboard.

Press enter or space to open the popover and escape to close it.

Impeccable focus management

Popover handles focus elegantly in every scenario.

  • When opening: Focus is placed on PopoverContentso keyboard users and screen readers can start interacting with it immediately.
  • When closing: Focus is placed on PopoverTrigger so keyboard and screen reader users navigate to the next item without using a mouse.
  • When tabbing out: PopoverContent is closed and focus is moved to the next item after PopoverTrigger. This allows users to continue tabbing forward. See the accessibility tab for more details.
Try this: Open the 1st popover. Then Tab through its contents to the 2nd popover.

Labelling and Role support

PopoverContent needs an accessible name for it to be accessible. We have added an accessibility tab to show you how to do this.

We’ve also included notes on how you can change the role of the PopoverContent if you need to.

An accessibility warning
Warning about missing accessible name for a popover.

As you can see, we are pretty serious about accessibility!