1
0
mirror of https://github.com/tabler/tabler.git synced 2025-12-22 01:44:25 +04:00
Files
tabler/docs/content/ui/components/offcanvas.md
2025-04-15 23:18:49 +02:00

2.4 KiB

title
title
Offcanvas

Offcanvas is a sidebar component that can be toggled via JavaScript to appear from the left, right, top, or bottom edge of the viewport. Buttons or anchors are used as triggers that are attached to specific elements you toggle, and data attributes are used to invoke our JavaScript.

Basic usage

To create an offcanvas, add the .offcanvas class to a container element. You can also add the .offcanvas-start, .offcanvas-end, .offcanvas-top, or .offcanvas-bottom class to specify the position of the offcanvas. The .show class is used to display the offcanvas.

<div class="offcanvas offcanvas-start" tabindex="-1" id="offcanvas">
  <div class="offcanvas-body">
    Content for the offcanvas goes here. You can place just about any Tabler component or custom
    elements here.
  </div>
</div>

Look at the example below to see how the offcanvas works.

{% capture html -%}

Content for the offcanvas goes here. You can place just about any Tabler component or custom elements here.
{%- endcapture %} {% include "docs/example.html" html=html raw %}

Cookies banner

The offcanvas component is used to display a cookies banner. It is a great way to inform users about the use of cookies on your website and to get their consent.

{% capture html -%}

Do you like cookies? 🍪 We use cookies to ensure you get the best experience on our website. Learn more
Essential Cookies Only
Allow All Cookies
{%- endcapture %} {% include "docs/example.html" html=html raw %}