popovercomponent, implemented in Ruby. Use it like any other matestack component in your apps, pages and components. It offers customizable options to simply achieve what is possible in bootstrap with this component. See below for more information about the possible options.
Returns a bootstrap component containing text or content specified by a block which can trigger a popover element. Also the popover is customizable with the following options.
:text- expects a string as text inside the element in which popover will be applied to
:variant- Specify a variant for the popover. Variant represent bootstraps contextual classes and can have one of the following values:
:primary, :secondary, :success, :info, :warning, :info, :light, :darkor your custom contextual class. The default is
:tag- element that popover should be applied to: div, span, links, button, ...
:content- expects a string as the body text for popover
:title- expects a string as the title text for popover
:animation- Apply a CSS fade transition to the popover
:placement- How to position the popover -
right. when auto is specified, it will dynamically reorient the popover.
:tabindex- For proper cross-browser and cross-platform behavior, you must use the
atag, not the
buttontag for dismiss-on-next-click, and you also must include a tabindex attribute.
:trigger- How popover is triggered -
manual. You may pass multiple triggers; separate them with a space.
manualcannot be combined with any other trigger.
:boundary- Overflow constraint boundary of the popover
:offset- Offset of the popover relative to its target.
:container- Appends the popover to a specific element.
:delay- Delay showing and hiding the popover (ms) - does not apply to manual trigger type. If a number is supplied, delay is applied to both hide/show
:selector- If a selector is provided, popover objects will be delegated to the specified targets
:html- Insert HTML into the popover. If false, innerText property will be used to insert content into the DOM.
:template- Base HTML to use when creating the popover.
:fallback_placement- Allow to specify which position Popper will use on fallback.
- Html attributes - all w3c confirm html attributes for div's can be set via options and will be added to the surrounding popover div.
bs_popover "Click to toggle popover",
content: "And here's some amazing content. It's very engaging. Right?",
title: "Popover title",
<button type="button" class="btn btn-danger" data-bs-toggle="popover" title="Popover title" data-bs-content="And here's some amazing content. It's very engaging. Right?">
Click to toggle popover
bs_popover "Popover", html: 'true', content: "<p>this paragraph in popover</p>"
<button data-bs-content="<p>this paragraph in popover</p>" data-bs-html="true" data-bs-toggle="popover" role="button" tabindex="" title="" type="button" class="btn btn-primary" data-bs-original-title="">
bs_popover "Dismissible Popover", tag: :link, placement: :top, tabindex: "0", variant: :danger, trigger: "focus", title: "Dismissible popover", content: "And here's some amazing content. It's very engaging. Right?"
<a data-bs-content="And here's some amazing content. It's very engaging. Right?" data-bs-placement="top" data-bs-tabindex="0" data-bs-title="Dismissible popover" data-bs-toggle="popover" data-bs-trigger="focus" role="button" tabindex="0" title="" class="btn btn-danger" data-bs-original-title="Dismissible popover">