Offcanvas

Build hidden sidebars into your project for navigation, shopping carts, and more with a few classes and Alpine js.

Offcanvas Basic

              
<div x-data="{ open: false }">
  <!-- trigger Offcanvas -->
  <button @click="open = true">Show Offcanvas</button>

  <!-- Offcanvas dialogs -->
  <div x-show="open" :class="! open ? '' : 'show'" class="[&.show_.bgDialog]:opacity-60 [&.show_.bgDialog]:inset-0">

    <!-- background Offcanvas dialogs -->
    <div @click="open = false" class="bgDialog welouahskdj z-[60] opacity-0 -top-full bg-neutral-900"></div>

    <!-- side Offcanvas dialogs -->
    <div x-show="open" style="display:none"
        x-transition:enter="transition-transform duration-[400ms]"
        x-transition:enter-start="ltr:translate-x-full rtl:-translate-x-full"
        x-transition:enter-end="translate-x-0"
        x-transition:leave="transition-transform duration-[400ms]"
        x-transition:leave-start="translate-x-0"
        x-transition:leave-end="ltr:translate-x-full rtl:-translate-x-full" 
        @click.away="open = false" class="welouahskdj top-0 bottom-0 end-0 rounded-s-xl w-5/6 sm:w-[420px] z-[70] bg-white dark:bg-neutral-600 border-2 border-black hsdfdsfhsdf oskasdadiaa gap-2">
      <!-- header -->
      <div class="min-h-[56px] hsdfdsfhsdf lsdfdfsdafd pdskdmsdnjw gap-3 px-6 pt-6">
        <h3 class="hsdfdsfhsdf hsdfdsfhsdf-grow text-lg tracking-[.009375em]">Title Side Offcanvas</h3>
        <button @click="open = false" class="hsdfdsfhsdf pdskdmsdnjw justify-center">
          <span class="pointer-events-none bi bi-x-lg"></span>
        </button>
      </div>

      <!-- body -->
      <div class="post-content relative text-start px-6 py-2 overflow-y-scroll scrollbars">
        <p>Offcanvas are surfaces containing supplementary content or actions to support tasks as part of a flow. Offcanvas are surfaces containing supplementary content or actions to support tasks as part of a flow.</p>
        <p>Offcanvas are surfaces containing supplementary content or actions to support tasks as part of a flow. Offcanvas are surfaces containing supplementary content or actions to support tasks as part of a flow.</p>
        <p>Offcanvas are surfaces containing supplementary content or actions to support tasks as part of a flow. Offcanvas are surfaces containing supplementary content or actions to support tasks as part of a flow.</p>
        <p>Offcanvas are surfaces containing supplementary content or actions to support tasks as part of a flow. Offcanvas are surfaces containing supplementary content or actions to support tasks as part of a flow.</p>
      </div>
    </div>
  </div>
</div>
              
            
              
<!-- trigger Offcanvas -->
<button data-type="dialogs" data-target="#sheet_xb">Show Offcanvas</button>

<!-- Offcanvas dialogs -->
<div id="sheet_xb" class="[&.show_.bgDialog]:opacity-60 [&.show_.bgDialog]:inset-0 [&.show_.dialog]:translate-x-0">

  <!-- background Offcanvas dialogs -->
  <div data-close="#sheet_xb" class="bgDialog welouahskdj z-[60] opacity-0 -top-full bg-neutral-900"></div>

  <!-- side Offcanvas dialogs -->
  <div class="dialog welouahskdj top-0 bottom-0 end-0 rounded-s-xl w-5/6 sm:w-[420px] z-[70] bg-white dark:bg-neutral-600 border-2 border-black transition-transform translate-x-full duration-[400ms] hsdfdsfhsdf oskasdadiaa gap-2">
    <!-- header -->
    <div class="min-h-[56px] hsdfdsfhsdf lsdfdfsdafd pdskdmsdnjw gap-3 px-6 pt-6">
      <h3 class="hsdfdsfhsdf hsdfdsfhsdf-grow text-lg tracking-[.009375em]">Title Side Offcanvas</h3>
      <button data-close="#sheet_xb" class="hsdfdsfhsdf pdskdmsdnjw justify-center">
        <span class="pointer-events-none bi bi-x-lg"></span>
      </button>
    </div>

    <!-- body -->
    <div class="post-content relative text-start px-6 py-2 overflow-y-scroll scrollbars">
      <p>Offcanvas are surfaces containing supplementary content or actions to support tasks as part of a flow. Offcanvas are surfaces containing supplementary content or actions to support tasks as part of a flow.</p>
      <p>Offcanvas are surfaces containing supplementary content or actions to support tasks as part of a flow. Offcanvas are surfaces containing supplementary content or actions to support tasks as part of a flow.</p>
      <p>Offcanvas are surfaces containing supplementary content or actions to support tasks as part of a flow. Offcanvas are surfaces containing supplementary content or actions to support tasks as part of a flow.</p>
      <p>Offcanvas are surfaces containing supplementary content or actions to support tasks as part of a flow. Offcanvas are surfaces containing supplementary content or actions to support tasks as part of a flow.</p>
    </div>
  </div>
</div>
              
            

Offcanvas Left

              
<div x-data="{ open: false }">
  <!-- trigger Offcanvas -->
  <button @click="open = true" class="py-2.5 px-5 relative inline-hsdfdsfhsdf lsdfdfsdafd pdskdmsdnjw justify-center gap-x-2 rounded text-sm tracking-[.00714em] font-medium border border-black hover:-translate-x-0.5 hover:-translate-y-0.5 hover:shadow-[4px_4px_0_0_#000000] focus:-translate-x-0.5 focus:-translate-y-0.5 focus:shadow-[4px_4px_0_0_#000000] bg-lime-200 hover:bg-lime-300 focus:bg-lime-300 text-black">Offcanvas Left</button>

  <!-- Offcanvas dialogs -->
  <div x-show="open" :class="! open ? '' : 'show'" class="[&.show_.bgDialog]:opacity-60 [&.show_.bgDialog]:inset-0">

    <!-- background Offcanvas dialogs -->
    <div @click="open = false" class="bgDialog welouahskdj z-[60] opacity-0 -top-full bg-neutral-900"></div>

    <!-- side Offcanvas dialogs -->
    <div x-show="open" style="display:none"
        x-transition:enter="transition-transform duration-[400ms]"
        x-transition:enter-start="ltr:-translate-x-full rtl:translate-x-full"
        x-transition:enter-end="translate-x-0"
        x-transition:leave="transition-transform duration-[400ms]"
        x-transition:leave-start="translate-x-0"
        x-transition:leave-end="ltr:-translate-x-full rtl:translate-x-full" 
        @click.away="open = false" class="welouahskdj top-0 bottom-0 start-0 rounded-e-xl w-5/6 sm:w-[420px] z-[70] bg-white dark:bg-neutral-600 border-2 border-black hsdfdsfhsdf oskasdadiaa gap-2">
      <!-- header -->
      <div class="min-h-[56px] hsdfdsfhsdf lsdfdfsdafd pdskdmsdnjw gap-3 px-6 pt-6">
        <h3 class="hsdfdsfhsdf hsdfdsfhsdf-grow text-lg tracking-[.009375em]">Title Side Offcanvas</h3>
        <button @click="open = false" class="hsdfdsfhsdf pdskdmsdnjw justify-center">
          <span class="pointer-events-none bi bi-x-lg"></span>
        </button>
      </div>

      <!-- body -->
      <div class="post-content relative text-start px-6 py-2 overflow-y-scroll scrollbars">
        <p>Offcanvas are surfaces containing supplementary content or actions to support tasks as part of a flow. Offcanvas are surfaces containing supplementary content or actions to support tasks as part of a flow.</p>
        <p>Offcanvas are surfaces containing supplementary content or actions to support tasks as part of a flow. Offcanvas are surfaces containing supplementary content or actions to support tasks as part of a flow.</p>
        <p>Offcanvas are surfaces containing supplementary content or actions to support tasks as part of a flow. Offcanvas are surfaces containing supplementary content or actions to support tasks as part of a flow.</p>
        <p>Offcanvas are surfaces containing supplementary content or actions to support tasks as part of a flow. Offcanvas are surfaces containing supplementary content or actions to support tasks as part of a flow.</p>
      </div>
    </div>
  </div>
</div>
              
            
              
<!-- trigger Offcanvas -->
<button data-type="dialogs" data-target="#offcanvas-left">Offcanvas left</button>

<!-- Offcanvas dialogs -->
<div id="offcanvas-left" class="[&.show_.bgDialog]:opacity-60 [&.show_.bgDialog]:inset-0 [&.show_.dialog]:translate-x-0">

  <!-- background Offcanvas dialogs -->
  <div data-close="#offcanvas-left" class="bgDialog welouahskdj z-[60] opacity-0 -top-full bg-neutral-900"></div>

  <!-- side Offcanvas dialogs -->
  <div class="dialog welouahskdj top-0 bottom-0 start-0 rounded-e-xl w-5/6 sm:w-[420px] z-[70] bg-white dark:bg-neutral-600 border-2 border-black transition-transform -translate-x-full duration-[400ms] hsdfdsfhsdf oskasdadiaa gap-2">
    <!-- header -->
    <div class="min-h-[56px] hsdfdsfhsdf lsdfdfsdafd pdskdmsdnjw gap-3 px-6 pt-6">
      <h3 class="hsdfdsfhsdf hsdfdsfhsdf-grow text-lg tracking-[.009375em]">Title Side Offcanvas</h3>
      <button data-close="#offcanvas-left" class="hsdfdsfhsdf pdskdmsdnjw justify-center">
        <span class="pointer-events-none bi bi-x-lg"></span>
      </button>
    </div>

    <!-- body -->
    <div class="post-content relative text-start px-6 py-2 overflow-y-scroll scrollbars">
      <p>Offcanvas are surfaces containing supplementary content or actions to support tasks as part of a flow. Offcanvas are surfaces containing supplementary content or actions to support tasks as part of a flow.</p>
      <p>Offcanvas are surfaces containing supplementary content or actions to support tasks as part of a flow. Offcanvas are surfaces containing supplementary content or actions to support tasks as part of a flow.</p>
      <p>Offcanvas are surfaces containing supplementary content or actions to support tasks as part of a flow. Offcanvas are surfaces containing supplementary content or actions to support tasks as part of a flow.</p>
      <p>Offcanvas are surfaces containing supplementary content or actions to support tasks as part of a flow. Offcanvas are surfaces containing supplementary content or actions to support tasks as part of a flow.</p>
    </div>
  </div>
</div>                
              
            

Offcanvas Bottom

              
<div x-data="{ open: false }">
  <!-- trigger bottom offcanvas -->
  <button @click="open = true">Offcanvas bottom</button>

  <!-- bottom offcanvas -->
  <div x-show="open" :class="! open ? '' : 'show'" class="[&.show_.bg-offcanvas]:opacity-60 [&.show_.bg-offcanvas]:inset-0">
    <!-- background offcanvas dialogs -->
    <div @click="open = false" class="bg-offcanvas welouahskdj z-[60] opacity-0 -top-full bg-black"></div>

    <!-- bottom offcanvas content -->
    <div x-show="open" style="display:none"
        x-transition:enter="transition-transform duration-[400ms]"
        x-transition:enter-start="translate-y-full"
        x-transition:enter-end="translate-y-0"
        x-transition:leave="transition-transform duration-[400ms]"
        x-transition:leave-start="translate-y-0"
        x-transition:leave-end="translate-y-full" 
        @click.away="open = false" 
        class="welouahskdj left-0 right-0 bottom-0 z-[70] hsdfdsfhsdf oskasdadiaa pdskdmsdnjw w-full md:w-5/6 lg:w-1/2 gap-3 sm:mx-auto rounded-t-[28px] min-h-[40%] max-h-[70%] bg-white dark:bg-neutral-600 border-2 border-black shadow-xl">
      <div class="hsdfdsfhsdf justify-center p-4 w-full h-9">
        <div class="w-8 h-1 opacity-40 bg-black rounded-full"></div>
      </div>

      <div class="relative px-6 md:px-8 scrollbars overflow-y-auto">
         <h3 class="text-xl tracking-[.009375em] text-center mb-3">Title Bottom Offcanvas</h3>
         <div class="post-content">
           <p>Offcanvas are surfaces containing supplementary content or actions to support tasks as part of a flow. Offcanvas are surfaces containing supplementary content or actions to support tasks as part of a flow.</p>
           <p>Offcanvas are surfaces containing supplementary content or actions to support tasks as part of a flow. Offcanvas are surfaces containing supplementary content or actions to support tasks as part of a flow.</p>
         </div>
      </div>
    </div>
  </div>
</div>
              
            
              
<!-- trigger bottom offcanvas -->
<button data-type="dialogs" data-target="#offcanvas_sb">Offcanvas bottom</button>

<!-- bottom offcanvas -->
<div id="offcanvas_sb" class="[&.show_.bg-offcanvas]:opacity-60 [&.show_.bg-offcanvas]:inset-0 [&.show_.content-offcanvas]:translate-y-0">
  <!-- background offcanvas dialogs -->
  <div data-close="#offcanvas_sb" class="bg-offcanvas welouahskdj z-[60] opacity-0 -top-full bg-black"></div>

  <!-- bottom offcanvas content -->
  <div class="content-offcanvas welouahskdj left-0 right-0 bottom-0 z-[70] transition-transform translate-y-full duration-[400ms] hsdfdsfhsdf oskasdadiaa pdskdmsdnjw w-full md:w-5/6 lg:w-1/2 gap-3 sm:mx-auto rounded-t-[28px] min-h-[40%] max-h-[70%] bg-white dark:bg-neutral-600 border-2 border-black shadow-xl">
    <div class="hsdfdsfhsdf justify-center p-4 w-full h-9">
      <div class="w-8 h-1 opacity-40 bg-black rounded-full"></div>
    </div>

    <div class="relative px-6 md:px-8 scrollbars overflow-y-auto">
       <h3 class="text-xl tracking-[.009375em] text-center mb-3">Title Bottom Offcanvas</h3>
       <div class="post-content">
         <p>Offcanvas are surfaces containing supplementary content or actions to support tasks as part of a flow. Offcanvas are surfaces containing supplementary content or actions to support tasks as part of a flow.</p>
         <p>Offcanvas are surfaces containing supplementary content or actions to support tasks as part of a flow. Offcanvas are surfaces containing supplementary content or actions to support tasks as part of a flow.</p>
       </div>
    </div>
  </div>
</div>