--- layout: docs title: Popover edit_url: "https://github.com/nylas/N1/blob/master/src/components/popover.cjsx" ---
The Popover component makes it easy to display a sheet or popup menu when the
user clicks the React element provided as buttonComponent
. In N1, the Popover
component is used to create rich dropdown menus, detail popups, etc. with consistent
look and feel and behavior.
The Popover component handles:
buttonComponent
, and dismissing it's
children when you click outside the popover or press the Escape key.If your Popover contains an input, like a search bar, give it a tabIndex and Popover will automatically focus it when the popover is opened.
If you don't want to use the Popover in conjunction with a triggering button,
you can manually call open()
and close()
to display it. A typical scenario
looks like this:
render: =>
<Popover ref="myPopover"> Popover Contents </Popover>
showMyPopover: =>
@refs.myPopover.open()