--- layout: layouts/component.njk title: Popover description: Displays rich content in a portal, triggered by a button. toc: - label: Usage id: usage children: - label: Default id: usage-default - label: Jinja or Nunjucks id: usage-jinja --- {% from "macros/code_preview.njk" import code_preview %} {% from "macros/code_block.njk" import code_block %} {% from "components/popover.njk" import popover %} {% set code %} {% call popover( id="demo-popover", trigger="Open popover", trigger_attrs={"class": "btn-outline"}, content_attrs={"class": "w-80 p-4"} ) %}

Dimensions

Set the dimensions for the layer.

{% endcall %} {% endset %} {{ code_preview("popover", code | prettyHtml ) }}

Usage

Default

If you need to do more than what <select> allows (e.g. HTML options), you can use the code below which uses the Popover component. Make sure to include the hidden input with the name you want to use for that field.

{{ code_block(code | prettyHtml) }}

Jinja or Nunjucks

If you use Jinja (or Nunjucks), you can use the popover() macro directly.

{% set raw_code %}{% raw %}{% call popover( id="demo-popover", trigger="Open popover", trigger_attrs={"class": "btn-outline"}, content_attrs={"class": "w-80 p-4"} ) %}

Dimensions

Set the dimensions for the layer.

{% endcall %}{% endraw %}{% endset %} {{ code_block(raw_code, "jinja") }}