Popover #
A va-popover
can be used to display some text on top of the component.
Examples #
Basic usage #
Wrap your component in a va-popover
tag and provide a message
property with text.
Color #
You can set different background colors to the component.
Placement #
A component can be set in a different position. Use a position property to set it: top
, left
, right
and bottom
are available. More about placements
Icon #
You can set an icon to the component.
Title #
You can set a title to the popover.
Trigger #
Events triggering the popover separated with spaces: hover
, click
or focus
.
Slots usage #
You can use icon
, title
and body
slots to provide your own extra content into the popover component.
API #
Props #
Name | Description | Types | Default |
---|---|---|---|
anchor |
| - | |
anchorSelector | Anchor CSS selector instead of passing slot |
|
|
ariaLabel | the aria-label of anchor slot of dropdown of the component |
|
|
autoHide | Adds the ability to hide popover when clicked outside |
|
|
autoPlacement | If dropdown doesn't fit viewport, it will be placed automatically to fit viewport |
|
|
closeOnAnchorClick | Popover will be closed when anchor is clicked |
|
|
closeOnContentClick | Popover will be closed when clicked inside popover content |
|
|
closeOnFocusOutside |
|
| |
color | Color of the component (theme string or |
|
|
contentClass |
|
| |
cursor | Dropdown will be rendered relative to cursor position |
|
|
disabled | Applies |
| - |
hoverOutTimeout | Delay before closing |
|
|
hoverOverTimeout | Delay before opening |
|
|
icon | Sets an icon. |
|
|
innerAnchorSelector | Anchor CSS selector inside passed slot |
|
|
isContentHoverable | If true, dropdown content will be hoverable |
|
|
keepAnchorWidth | If true, popover content will have exact same width as anchor |
|
|
keyboardNavigation | Enables keyboard navigation for the component. |
|
|
message | Message which showed in a popover |
|
|
modelValue | The value of the |
|
|
offset | Dropdown content will be moved by main and cross axis according to current |
|
|
placement | Sets a popover position. More about placements |
|
|
preset | Named preset combination of component props. |
| - |
readonly | Doesn't look disabled, but acts like one. Mostly useful for wrapper components. |
| - |
role | Sets the |
|
|
stateful | Add possibility to work with component without setting |
|
|
stickToEdges | Dropdown will not be rendered outside of viewport. It will be moved in opposite direction. |
|
|
target | Navigation target, More info here. |
| - |
teleport | Element where content will be rendered |
| - |
textColor | Text color (theme string or HEX string). |
| - |
title | Sets the title of the popover |
|
|
trigger | Event on which popover is triggered |
|
|
verticalScrollOnOverflow |
|
|
Slots #
Name | Description |
---|---|
body | Custom body slot |
icon | By default replaces with a |
title | Custom title slot |
Css Variables #
Name | Default Value |
---|---|
--va-popover-display | inline-block |
--va-popover-content-opacity | 1 |
--va-popover-content-display | flex |
--va-popover-content-align-items | center |
--va-popover-content-padding | 0.65rem 1rem |
--va-popover-content-border-radius | 0.5rem |
--va-popover-content-font-size | 1rem |
--va-popover-content-box-shadow | 0 2px 3px 0 |
--va-popover-content-background-color | var(--va-background-primary) |
--va-popover-title-font-weight | 700 |
--va-popover-title-margin-bottom | 0.125rem |
--va-popover-body-line-height | 1.5 |