v-ons-popover

A component that displays a popover next to an component. The popover can be used to display extra information about a component or a tooltip. To use the component it can either be attached directly to the <body> component or dynamically created from a template using the $ons.createPopover(template) utility function and the <v-ons-template> tag. Another common way to use the popover is to display a menu when a button on the screen is tapped. For Material Design, popover looks exactly as a dropdown menu.

Tutorial

See also

Props

Name Type Default Value Description
cancelable Boolean If this attribute is set the popover can be closed by tapping the background or by pressing the back button. Optional.
cover-target Boolean If set the popover will cover the target on the screen. Optional.
direction String

A space separated list of directions. If more than one direction is specified, it will be chosen automatically. Valid directions are "up", "down", "left" and "right".

Optional.
mask-color Color Color of the background mask. Default is "rgba(0, 0, 0, 0.2)". Optional.
modifier String The appearance of the popover. Optional.
options.animation String The animation used when showing an hiding the popover. Can be either "none", "default", "fade-ios" or "fade-md". Optional.
options.animationOptions Expression Specify the animation’s duration, timing and delay with an object literal. E.g. {duration: 0.2, delay: 1, timing: 'ease-in'}. Optional.
target Ref|String|Event|HTMLElement Target component. Can be either a Vue component reference, a CSS selector, an event object or a DOM component. It can also be provided as options.target. Optional.
visible Boolean Specify the visibility of the component. Optional.

Events Summary

Name Description
preshow Fired just before the popover is displayed.
postshow Fired just after the popover is displayed.
prehide Fired just before the popover is hidden.
posthide Fired just after the popover is hidden.
update:visible Fired right after user interaction. Useful to update visible prop.
deviceBackButton Fired on device back button. Default behavior is hiding the component if it is cancelable. Otherwise, calls parent handler.

Events

preshow

Fired just before the popover is displayed.

Parameters
Name Type Description
event Object Event object.
event.popover Object Component object.
event.cancel Function Call this function to stop the popover from being shown.

postshow

Fired just after the popover is displayed.

Parameters
Name Type Description
event Object Event object.
event.popover Object Component object.

prehide

Fired just before the popover is hidden.

Parameters
Name Type Description
event Object Event object.
event.popover Object Component object.
event.cancel Function Call this function to stop the popover from being hidden.

posthide

Fired just after the popover is hidden.

Parameters
Name Type Description
event Object Event object.
event.popover Object Component object.

update:visible

Fired right after user interaction. Useful to update visible prop.

Parameters
Name Type Description
event Number New value for visible prop.

deviceBackButton

Fired on device back button. Default behavior is hiding the component if it is cancelable. Otherwise, calls parent handler.

Parameters
Name Type Description
event Object Event object.
event.preventDefault Function Avoids the default behavior.
event.callParentHandler Function Runs the handler for the immediate parent that supports device back button.

Discussion

Need Help?

If you have any questions, use our Community Forum or talk to us via Gitter chat. The Onsen UI team and your peers in the community will work together to help solve your issues.

For bug reports and feature requests use our GitHub Issues page.