Components
Popover
Popover appears above other elements in the interface and is linked to a specific element. It is used to display additional information, interactive elements, or brief explanations without navigating away from the page.
React
const PreviewEn = () => { return ( <Popover.TriggerContext> <Popover.Trigger>Open popover</Popover.Trigger> <Popover placement='top'> The popover provides a quick message. You can use it to show the user information that is relevant to the context. </Popover> </Popover.TriggerContext> ); }; render(<PreviewEn />)
Use Popover when
- you need to provide additional explanations that require more space than a short
Tooltip, such as definitions or detailed instructions - context-specific help is needed that users can open and close without leaving the page
- supplementary information should be shown that is not critical for completing the task, but may be useful for some users
Avoid Popover when
- you need to describe a symbol or keyboard shortcut; use
Tooltipinstead - the purpose is navigation or choosing between options; use
Dropdowninstead - the content is intended to appear on hover
Example
Interactive Popover
A Popover may contain buttons and other interactive elements.
React
const InteractiveEn = () => { return ( <Popover.TriggerContext> <Popover.Trigger data-color='danger' aria-label='Delete row'> <TrashIcon title='Delete row' /> </Popover.Trigger> <Popover data-color='danger'> <Paragraph> Are you sure you want to delete this row? This action cannot be undone. </Paragraph> <div style={{ display: 'flex', gap: 'var(--ds-size-2)', marginTop: 'var(--ds-size-2)', }} > <Button data-size='sm'>Yes, delete it</Button> <Button data-size='sm' variant='tertiary'> Cancel </Button> </div> </Popover> </Popover.TriggerContext> ); }; render(<InteractiveEn />)
Inline trigger
You can use a Popover inline within text, marked with a dotted underline, for example when explaining a term.
React
const DottedUnderlineEn = () => { return ( <Popover.TriggerContext> <Paragraph> We use <Popover.Trigger inline>design tokens</Popover.Trigger> to ensure a consistent design. </Paragraph> <Popover data-color='neutral'> <Paragraph> <strong style={{ display: 'block', }} > Design tokens </strong> Design tokens are a collection of variables that define the visual style within a design system. </Paragraph> </Popover> </Popover.TriggerContext> ); }; render(<DottedUnderlineEn />)
Guidelines
Popover is used to display more detailed or interactive supplementary information without taking the user out of context. It can be used as an extended solution when a Tooltip is not sufficient. Popover is opened through an intentional user click and may contain text, links and simple form elements. The content should be short, relevant, and not critical for completing the task.
Placement
Popover can be placed as needed, and will automatically stay within the visible browser area. This behaviour can be disabled using autoPlacement.
Text
Avoid long texts and complex explanations. In some cases, it may be better to link to another page with more detailed information on the topic.
Edit this page on github.com (opens in a new tab)