Skip to content
MarkasUI
Type to search

    Guide

    MarkasUI

    Form

    Feedback

    Overlay

    Navigation

    Data

    Sections

    Animations

    Backgrounds

    Buttons

    Templates

    Pages

    Drawer

    Full-height side panel built on the native dialog element, sliding in from the right or left.

    Filter products

    Choose a category and price range to filter the product list.

    Filter products

    Choose a category and price range to filter the product list.

    Filter products

    Choose a category and price range to filter the product list.

    Filter products

    Choose a category and price range to filter the product list.

    Filter products

    Choose a category and price range to filter the product list.
    <x-markas.drawer title="Filter products">
        <x-slot:trigger>
            <x-markas.button variant="secondary">Open filters</x-markas.button>
        </x-slot:trigger>
    
        Choose a category and price range to filter the product list.
    
        <x-slot:footer>
            <x-markas.button variant="secondary" type="submit" value="cancel">Cancel</x-markas.button>
            <x-markas.button type="submit" value="apply">Apply</x-markas.button>
        </x-slot:footer>
    </x-markas.drawer>
    import { Button } from "@/components/markas/Button";
    import { Drawer } from "@/components/markas/Drawer";
    
    export default function DrawerExample() {
      return (
        <Drawer
          title="Filter products"
          trigger={<Button variant="secondary">Open filters</Button>}
          footer={
            <>
              <Button variant="secondary" type="submit" value="cancel">
                Cancel
              </Button>
              <Button type="submit" value="apply">
                Apply
              </Button>
            </>
          }
        >
          Choose a category and price range to filter the product list.
        </Drawer>
      );
    }
    <script setup lang="ts">
    import Button from "@/components/markas/Button.vue";
    import Drawer from "@/components/markas/Drawer.vue";
    </script>
    
    <template>
      <Drawer title="Filter products">
        <template #trigger>
          <Button variant="secondary">Open filters</Button>
        </template>
    
        Choose a category and price range to filter the product list.
    
        <template #footer>
          <Button variant="secondary" type="submit" value="cancel">Cancel</Button>
          <Button type="submit" value="apply">Apply</Button>
        </template>
      </Drawer>
    </template>
    <script lang="ts">
      import Button from "$lib/components/markas/Button.svelte";
      import Drawer from "$lib/components/markas/Drawer.svelte";
    </script>
    
    <Drawer title="Filter products">
      {#snippet trigger()}
        <Button variant="secondary">Open filters</Button>
      {/snippet}
    
      Choose a category and price range to filter the product list.
    
      {#snippet footer()}
        <Button variant="secondary" type="submit" value="cancel">Cancel</Button>
        <Button type="submit" value="apply">Apply</Button>
      {/snippet}
    </Drawer>
    ---
    import Button from "@/components/markas/Button.astro";
    import Drawer from "@/components/markas/Drawer.astro";
    ---
    
    <Drawer title="Filter products">
      <Button slot="trigger" variant="secondary">Open filters</Button>
    
      Choose a category and price range to filter the product list.
    
      <Fragment slot="footer">
        <Button variant="secondary" type="submit" value="cancel">Cancel</Button>
        <Button type="submit" value="apply">Apply</Button>
      </Fragment>
    </Drawer>
    import { Component } from "@angular/core";
    import { Button } from "./markas/button.component";
    import { Drawer } from "./markas/drawer.component";
    
    @Component({
      selector: "markas-example",
      imports: [Button, Drawer],
      template: `
        <markas-drawer title="Filter products">
          <button markas-button trigger variant="secondary">Open filters</button>
    
          Choose a category and price range to filter the product list.
    
          <ng-container footer>
            <button markas-button variant="secondary" type="submit" value="cancel">
              Cancel
            </button>
            <button markas-button type="submit" value="apply">Apply</button>
          </ng-container>
        </markas-drawer>
      `,
    })
    export default class DrawerExample {}

    Examples

    Left side navigation

    Detail panel

    Order #1042

    Customer
    Rina Hartono
    Placed on
    12 Oct 2026
    Items
    3
    Total
    $128.00

    Order #1042

    Customer
    Rina Hartono
    Placed on
    12 Oct 2026
    Items
    3
    Total
    $128.00

    Order #1042

    Customer
    Rina Hartono
    Placed on
    12 Oct 2026
    Items
    3
    Total
    $128.00

    Order #1042

    Customer
    Rina Hartono
    Placed on
    12 Oct 2026
    Items
    3
    Total
    $128.00

    Order #1042

    Customer
    Rina Hartono
    Placed on
    12 Oct 2026
    Items
    3
    Total
    $128.00

    Filters

    Filter products

    Category

    Filter products

    Category

    Filter products

    Category

    Filter products

    Category

    Filter products

    Category

    With form

    Edit profile

    Edit profile

    Edit profile

    Edit profile

    Edit profile

    Installation

    npx markasui@latest add drawer

    Usage

    <x-markas.drawer title="Filter products">
        <x-slot:trigger>
            <x-markas.button variant="secondary">Open filters</x-markas.button>
        </x-slot:trigger>
    
        Choose a category and price range to filter the product list.
    
        <x-slot:footer>
            <x-markas.button variant="secondary" type="submit" value="cancel">Cancel</x-markas.button>
            <x-markas.button type="submit" value="apply">Apply</x-markas.button>
        </x-slot:footer>
    </x-markas.drawer>

    Needs Alpine.js. Livewire 3 and 4 already ship it.

    Livewire

    <x-markas.drawer title="Filters" wire:model="showFilters">
        ...
    </x-markas.drawer>

    wire:model binds the open state, like the modal. Closing the drawer sets the property back to false.

    import { Button } from "@/components/markas/Button";
    import { Drawer } from "@/components/markas/Drawer";
    
    <Drawer
      title="Filter products"
      trigger={<Button variant="secondary">Open filters</Button>}
      footer={
        <>
          <Button variant="secondary" type="submit" value="cancel">
            Cancel
          </Button>
          <Button type="submit" value="apply">
            Apply
          </Button>
        </>
      }
      onClose={(e) => console.log(e.currentTarget.returnValue)}
    >
      Choose a category and price range to filter the product list.
    </Drawer>;
    <template>
      <Drawer title="Filter products">
        <template #trigger>
          <Button variant="secondary">Open filters</Button>
        </template>
    
        Choose a category and price range to filter the product list.
    
        <template #footer>
          <Button variant="secondary" type="submit" value="cancel">Cancel</Button>
          <Button type="submit" value="apply">Apply</Button>
        </template>
      </Drawer>
    </template>
    <script lang="ts">
      import Button from "$lib/components/markas/Button.svelte";
      import Drawer from "$lib/components/markas/Drawer.svelte";
    </script>
    
    <Drawer title="Filter products">
      {#snippet trigger()}
        <Button variant="secondary">Open filters</Button>
      {/snippet}
    
      Choose a category and price range to filter the product list.
    
      {#snippet footer()}
        <Button variant="secondary" type="submit" value="cancel">Cancel</Button>
        <Button type="submit" value="apply">Apply</Button>
      {/snippet}
    </Drawer>
    ---
    import Button from "@/components/markas/Button.astro";
    import Drawer from "@/components/markas/Drawer.astro";
    ---
    
    <Drawer title="Filter products">
      <Button slot="trigger" variant="secondary">Open filters</Button>
    
      Choose a category and price range to filter the product list.
    
      <Fragment slot="footer">
        <Button variant="secondary" type="submit" value="cancel">Cancel</Button>
        <Button type="submit" value="apply">Apply</Button>
      </Fragment>
    </Drawer>

    A small bundled script opens every drawer on the page. It also works after view transitions.

    import { Component } from "@angular/core";
    import { Button } from "./markas/button.component";
    import { Drawer } from "./markas/drawer.component";
    
    @Component({
      selector: "app-filters",
      imports: [Button, Drawer],
      template: `
        <markas-drawer title="Filter products" (closed)="onClosed()">
          <button markas-button trigger variant="secondary">Open filters</button>
    
          Choose a category and price range to filter the product list.
    
          <ng-container footer>
            <button markas-button variant="secondary" type="submit" value="cancel">
              Cancel
            </button>
            <button markas-button type="submit" value="apply">Apply</button>
          </ng-container>
        </markas-drawer>
      `,
    })
    export class Filters {
      onClosed() {}
    }
    • Use side="left" for a drawer from the left side.
    • The value of the button that closed the drawer is available as dialog.returnValue in the close event.
    • The close button is labelled “Close”. Translate it with closeLabel (Blade: close-label).

    Props

    NameTypeDefaultDescription
    titlestring-Drawer title, also used for aria-labelledby.
    sideright | leftrightSide of the screen the drawer appears from.
    triggerslot / ReactNode / snippet-Element that opens the drawer when clicked. Angular: an element with the trigger attribute.
    footerslot / ReactNode / snippet-Action area. Wrapped in form method=dialog, so a type=submit button closes the drawer. Angular: an element with the footer attribute.
    idstringautoDialog id. Use it to open the drawer from elsewhere with showModal().
    closeLabelstringCloseAccessible label of the close button.
    closedoutput<void>-Angular only. Emits when the drawer closes.

    Accessibility

    • Uses dialog with showModal(), so focus stays inside and the page behind is inert.
    • Escape closes the drawer and returns focus to the trigger.
    • Clicking outside the panel (the backdrop) closes the drawer.
    • The close button is labelled by closeLabel.

    Related components

    More overlay components with the same classes in every framework.