Web Awesome (ViUR)

Font Awesome
Try SSR Server-side rendering (SSR) generates component HTML on the server before the page loads, improving SEO and initial load time. Use the switch to see Web Awesome components render with and without SSR.
Search this website ⌘KCtrl+K Light Dark System Docs Select Color Scheme Default Awesome Shoelace Active Brutalist Glossy Matter Mellow Playful Premium Tailspin Docs Select Theme View Project on GitHub Star Project on GitHub
Start Components Docs Help
Web Awesome Font Awesome Build Awesome
Search this site… /
Try SSR Server-side rendering (SSR) generates component HTML on the server before the page loads, improving SEO and initial load time. Use the switch to see Web Awesome components render with and without SSR.
Light Dark System Docs Select Color Scheme Default Awesome Shoelace Active Brutalist Glossy Matter Mellow Playful Premium Tailspin Docs Select Theme

Getting Started

  • Installation
  • Usage
  • Forms
  • Localization
  • Frameworks
  • Using with AI
  • Figma Design Kit ProThis requires access to Web Awesome Pro
  • Server Rendering

Resources

  • Accessibility
  • Browser Support
  • Contributing
  • Patterns ProPatterns require access to Web Awesome Pro
  • Migrating from Shoelace
  • Visual Tests
  • Changelog
  • Help & Support

Theming & Utilities

  • Overview
  • Built-in Themes
  • Color Palettes
  • Design Tokens
  • Customizing & Theming
  • CSS Utilities

ViUR Components

  • Alert
  • Combobox
  • Pagination
  • Table Wrapper

Actions

  • Button
  • Button Group
  • Copy Button
  • Dropdown
    • Dropdown Item

Forms

  • Checkbox
  • Checkbox Group
  • Color Picker
  • Input
  • Known Date
  • Number Input
  • Radio Group
    • Radio
  • Rating
  • Select
    • Option
  • Slider
  • Switch
  • Textarea
  • Time Input
  • Data Grid Planned A Web Awesome Kickstarter stretch goal!

Layout

  • Accordion
    • Accordion Item
  • Card
  • Details
  • Dialog
  • Divider
  • Drawer
  • Page
  • Scroller
  • Split Panel

Navigation

  • Breadcrumb
    • Breadcrumb Item
  • Tab Group
    • Tab
    • Tab Panel
  • Tree
    • Tree Item

Feedback

  • Badge
  • Callout
  • Progress Bar
  • Progress Ring
  • Skeleton
  • Spinner
  • Tag
  • Tooltip

Media

  • Animated Image
  • Avatar
  • Carousel
    • Carousel Item
  • Comparison
  • Icon
  • Markdown
  • QR Code
  • Zoomable Frame

Data Viz

  • Advanced Usage

Helpers

  • Animation
  • Format Bytes
  • Format Date
  • Format Number
  • Include
  • Intersection Observer
  • Mutation Observer
  • Popover
  • Popup
  • Random Content
  • Relative Time
  • Resize Observer

Popover

  • Examples
  • Assigning an Anchor
  • Opening & Closing
  • Placement
  • Distance
  • Arrow Size
  • Setting a Maximum Width
  • Setting Focus
  • Importing
  • Slots
  • Attributes & Properties
  • Methods
  • Events
  • CSS Custom Properties
  • Custom States
  • CSS Parts
  • Dependencies
On This Page...
  • Examples
  • Assigning an Anchor
  • Opening & Closing
  • Placement
  • Distance
  • Arrow Size
  • Setting a Maximum Width
  • Setting Focus
  • Importing
  • Slots
  • Attributes & Properties
  • Methods
  • Events
  • CSS Custom Properties
  • Custom States
  • CSS Parts
  • Dependencies

Popover

<wa-popover>
Stable Helpers Since 3.0

Popovers display contextual content and interactive elements in a floating panel anchored to a trigger. Use them for rich tooltips, menus, or any content that appears on demand without navigating away.

Popovers display interactive content when their anchor element is clicked. Unlike tooltips, popovers can contain links, buttons, and form controls. They appear without an overlay and will close when you click outside or press Escape. Only one popover can be open at a time.

This popover contains interactive content that users can engage with directly.

Take Action
Show popover
<wa-popover for="popover__overview">
  <div style="display: flex; flex-direction: column; gap: 1rem;">
    <p>This popover contains interactive content that users can engage with directly.</p>
    <wa-button appearance="filled" variant="primary" size="s">Take Action</wa-button>
  </div>
</wa-popover>

<wa-button appearance="filled" id="popover__overview">Show popover</wa-button>

Examples

Link to This Section

Assigning an Anchor

Link to This Section

Use <wa-button> or <button> elements as popover anchors. Connect the popover to its anchor by setting the for attribute to match the anchor's id.

Show Popover I'm anchored to a Web Awesome button.

I'm anchored to a native button.
<wa-button appearance="filled" id="popover__anchor-button">Show Popover</wa-button>

<wa-popover for="popover__anchor-button"> I'm anchored to a Web Awesome button. </wa-popover>

<br /><br />

<button class="wa-filled" id="popover__anchor-native-button">Show Popover</button>

<wa-popover for="popover__anchor-native-button"> I'm anchored to a native button. </wa-popover>

Make sure the anchor element exists in the DOM before the popover connects. If it doesn't exist, the popover won't attach and you'll see a console warning.

Opening & Closing

Link to This Section

Popovers show when you click their anchor element. You can also control them programmatically by setting the open property to true or false.

Use data-popover="close" on any button inside a popover to close it automatically.

The button below has data-popover="close" so clicking it will close the popover.

Dismiss
Show popover
<wa-popover for="popover__opening">
  <p>The button below has <code>data-popover="close"</code> so clicking it will close the popover.</p>
  <wa-button appearance="filled" data-popover="close" variant="primary">Dismiss</wa-button>
</wa-popover>

<wa-button appearance="filled" id="popover__opening">Show popover</wa-button>

Placement

Link to This Section

Use the placement attribute to set where the popover appears relative to its anchor. The popover will automatically reposition if there isn't enough space in the preferred location. The default placement is top.

Top I'm on the top Bottom I'm on the bottom Left I'm on the left Right I'm on the right
<div style="display: flex; gap: 1rem; flex-wrap: wrap; align-items: center;">
  <wa-button appearance="filled" id="popover__top">Top</wa-button>
  <wa-popover for="popover__top" placement="top">I'm on the top</wa-popover>

  <wa-button appearance="filled" id="popover__bottom">Bottom</wa-button>
  <wa-popover for="popover__bottom" placement="bottom">I'm on the bottom</wa-popover>

  <wa-button appearance="filled" id="popover__left">Left</wa-button>
  <wa-popover for="popover__left" placement="left">I'm on the left</wa-popover>

  <wa-button appearance="filled" id="popover__right">Right</wa-button>
  <wa-popover for="popover__right" placement="right">I'm on the right</wa-popover>
</div>

Distance

Link to This Section

Use the distance attribute to control how far the popover appears from its anchor.

Near I'm very close Far I'm farther away
<div style="display: flex; gap: 1rem; align-items: center;">
  <wa-button appearance="filled" id="popover__distance-near">Near</wa-button>
  <wa-popover for="popover__distance-near" distance="0">I'm very close</wa-popover>

  <wa-button appearance="filled" id="popover__distance-far">Far</wa-button>
  <wa-popover for="popover__distance-far" distance="30">I'm farther away</wa-popover>
</div>

Arrow Size

Link to This Section

Use the --arrow-size custom property to change the size of the popover's arrow. To remove it, use the without-arrow attribute.

Big arrow I have a big arrow No arrow I don't have an arrow
<div style="display: flex; gap: 1rem; align-items: center;">
  <wa-button appearance="filled" id="popover__big-arrow">Big arrow</wa-button>
  <wa-popover for="popover__big-arrow" style="--arrow-size: 8px;">I have a big arrow</wa-popover>

  <wa-button appearance="filled" id="popover__no-arrow">No arrow</wa-button>
  <wa-popover for="popover__no-arrow" without-arrow>I don't have an arrow</wa-popover>
</div>

Setting a Maximum Width

Link to This Section

Use the --max-width custom property to control the maximum width of the popover.

Toggle me Popovers will usually grow to be much wider, but this one has a custom max width that forces text to wrap.
<wa-button appearance="filled" id="popover__max-width">Toggle me</wa-button>
<wa-popover for="popover__max-width" style="--max-width: 160px;">
  Popovers will usually grow to be much wider, but this one has a custom max width that forces text to wrap.
</wa-popover>

Setting Focus

Link to This Section

Use the autofocus global attribute to move focus to a specific form control when the popover opens.

Submit
Feedback
<wa-popover for="popover__autofocus">
  <div style="display: flex; flex-direction: column; gap: 1rem;">
    <wa-textarea autofocus placeholder="What's on your mind?" size="s" resize="none" rows="2"></wa-textarea>
    <wa-button appearance="filled" variant="primary" size="s" data-popover="close"> Submit </wa-button>
  </div>
</wa-popover>

<wa-button appearance="filled" id="popover__autofocus">
  <wa-icon name="comment" slot="start"></wa-icon>
  Feedback
</wa-button>

Importing

Link to This Section

If you're using the autoloader or a hosted project, components load on demand — no manual import needed. To cherry-pick a component manually, use one of the following snippets.

CDN npm Self-Hosted React

Import this component directly from the CDN:

import 'https://ka-f.webawesome.com/webawesome@0.17.0/components/popover/popover.js';

After installing Web Awesome via npm, import this component:

import '@awesome.me/webawesome/dist/components/popover/popover.js';

If you're self-hosting Web Awesome, import this component from your server:

import './webawesome/dist/components/popover/popover.js';

To import this component for React 18 or below, use the following code:

import WaPopover from '@awesome.me/webawesome/dist/react/popover/index.js';

Slots

Link to This Section

Learn more about using slots.

Name Description
(default) The popover's content. Interactive elements such as buttons and links are supported.

Attributes & Properties

Link to This Section

Learn more about attributes and properties.

Name Description Reflects
distance
distance
The distance in pixels from which to offset the popover away from its target.
Type number
Default 8
for
for
The ID of the popover's anchor element. This must be an interactive/focusable element such as a button.
Type string | null
Default null
open
open
Shows or hides the popover.
Type boolean
Default false
placement
placement
The preferred placement of the popover. Note that the actual placement may vary as needed to keep the popover inside of the viewport.
Type  'top' | 'top-start' | 'top-end' | 'right' | 'right-start' | 'right-end' | 'bottom' | 'bottom-start' | 'bottom-end' | 'left' | 'left-start' | 'left-end'
Default 'top'
skidding
skidding
The distance in pixels from which to offset the popover along its target.
Type number
Default 0
withoutArrow
without-arrow
Removes the arrow from the popover.
Type boolean
Default false

Methods

Link to This Section

Learn more about methods.

Name Description Arguments
hide() Hides the popover.
show() Shows the popover.

Events

Link to This Section

Learn more about events.

Name Description
wa-after-hide Emitted after the popover has hidden and all animations are complete.
wa-after-show Emitted after the popover has shown and all animations are complete.
wa-hide Emitted when the popover begins to hide. Canceling this event will stop the popover from hiding.
wa-show Emitted when the popover begins to show. Canceling this event will stop the popover from showing.

CSS Custom Properties

Link to This Section

Learn more about CSS custom properties.

Name Description
--arrow-size
The size of the tiny arrow that points to the popover (set to zero to remove).
Default 0.375rem
--hide-duration
The speed of the hide animation.
Default var(--wa-transition-fast)
--max-width
The maximum width of the popover's body content.
Default 25rem
--show-duration
The speed of the show animation.
Default var(--wa-transition-fast)

Custom States

Link to This Section

Learn more about custom states.

Name Description CSS selector
open Applied when the popover is open. :state(open)

CSS Parts

Link to This Section

Learn more about CSS parts.

Name Description CSS selector
body The popover's body where its content is rendered. ::part(body)
dialog The native dialog element that contains the popover content. ::part(dialog)
popup The internal <wa-popup> element that positions the popover. ::part(popup)
popup__arrow The popup's exported arrow part. Use this to target the popover's arrow. ::part(popup__arrow)
popup__popup The popup's exported popup part. Use this to target the popover's popup container. ::part(popup__popup)

Dependencies

Link to This Section

This component automatically imports the following elements. Sub-dependencies, if any exist, will also be included in this list.

  • <wa-popup>
Need a hand? Report a bug Ask for help
Go Make Something Awesome
Version 0.17.0 © Fonticons, Inc.
  • Terms
  • Privacy
  • Refunds
  • Core License
  • Pro License

Quick Links

  • Components
  • CSS Utilities
  • Theming
  • Using with AI
  • Changelog
  • Help & Support

Recent Searches

    D'oh! No results for “”

    Suggest on GitHub Ask on Discord
    Navigate Select
    Close Esc