npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@contentful/f36-popover

v4.65.5

Published

Forma 36: Popover component

Downloads

87,571

Readme


title: 'Popover' slug: /components/popover/ github: 'https://github.com/contentful/forma-36/tree/main/packages/components/popover' storybook: 'https://f36-storybook.contentful.com/?path=/story/components-popover--basic' typescript: ./src/Popover.tsx

Popover is used to display some content on top of another, and should be paired with a clickable trigger element. It is a base for other more specific component, like Menu, Autocomplete and Multiselect. Please, consider using these specific componenets to cover your needs.

How to use Popover

  • Only if Menu, Autocomplete and Multiselect components are not covering your use cases, you should use Popover.
  • Before using this component, double-check your design requirements. We are providing Menu, Autocomplete, and Multiselect for more specific use-cases and they can address your needs.
  • Keep in mind that you will have to implement everything related to accessibility for the popover content.
  • Component is controllable, so don't forget to pass onClose callback prop. Otherwise closeOnEsc and closeOnBlur will not work properly.

Import

import { Popover } from '@contentful/f36-components';
// or
import { Popover } from '@contentful/f36-popover';

Examples

Basic

  • Pass trigger component as a child for Popover.Trigger. NOTE: 🚨 Ensure that the component that you pass accepts ref. Consider using forwardRef for functional components.
  • Pass popover content as a child for Popover.Content

Trapping focus within Popover

If the popover contains interactive elements that user can navigate through with Tab, consider using react-focus-lock to trap the focus within Popover

Props (API reference)

Content guidelines

  • Use an interactive element such as button for Popover.Trigger

Accessibility

  • If the popover contains interactive elements that user can navigate through with Tab, consider using react-focus-lock to trap the focus within Popover
  • When the popover is opened, focus is moved to the Popover.Content. If you set autoFocusto false, it will not move the focus.
  • When the popover is open and focus is within the Popover.Content, click on Esc key will close the popover. If you set closeOnEsc to false, it will not close.
  • When the popover is open and focus is within the Popover.Content, click outside popover or blurring out will close the it. If you set closeOnBlur to false, it will not close.
  • All the necessary a11y attributes for Popover.Content and Popover.Trigger are provided.