Skip to content
MarkasUI
Type to search

    Guide

    MarkasUI

    Form

    Feedback

    Overlay

    Navigation

    Data

    Sections

    Animations

    Backgrounds

    Buttons

    Templates

    Pages

    Dock

    macOS style dock. Icons grow smoothly toward the pointer or focus, show a label above, mark open items with a dot, and bounce on launch.

    Inbox

    3 new messages from the design team

    Inbox

    3 new messages from the design team

    Inbox

    3 new messages from the design team

    Inbox

    3 new messages from the design team

    Inbox

    3 new messages from the design team

    @php
        $items = [
            ['label' => 'Files', 'icon' => 'M3 7a2 2 0 0 1 2-2h4l2 2h8a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z', 'active' => true],
            ['label' => 'Mail', 'icon' => 'M3 7a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2zM3 7l9 6 9-6', 'active' => true],
            ['label' => 'Calendar', 'icon' => 'M5 5h14a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V7a2 2 0 0 1 2-2zM3 10h18M8 3v4M16 3v4'],
            ['label' => 'Music', 'icon' => 'M9 18V5l12-2v13M9 18a3 3 0 1 1-6 0 3 3 0 0 1 6 0zM21 16a3 3 0 1 1-6 0 3 3 0 0 1 6 0z', 'active' => true],
            ['label' => 'Photos', 'icon' => 'M5 4h14a1 1 0 0 1 1 1v14a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1zM4 16l5-5 4 4 3-3 4 4M15 8h.01'],
            ['label' => 'Settings', 'icon' => 'M4 6h9M17 6h3M4 12h3M11 12h9M4 18h11M19 18h1M15 4v4M9 10v4M17 16v4'],
            ['separator' => true],
            ['label' => 'Trash', 'icon' => 'M4 7h16M10 11v6M14 11v6M5 7l1 12a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2l1-12M9 7V4h6v3'],
        ];
    @endphp
    
    <div class="relative grid h-[280px] place-items-end justify-center overflow-hidden rounded-xl border border-line bg-subtle px-4 pb-4">
        <div class="absolute inset-x-10 top-8 h-36 rounded-lg border border-line bg-surface shadow-overlay">
            <div class="flex gap-1.5 border-b border-line px-3 py-2.5">
                <span class="size-2.5 rounded-full bg-line"></span>
                <span class="size-2.5 rounded-full bg-line"></span>
                <span class="size-2.5 rounded-full bg-line"></span>
            </div>
            <p class="px-4 pt-4 text-sm font-medium text-ink">Inbox</p>
            <p class="px-4 pt-1 text-sm text-muted">3 new messages from the design team</p>
        </div>
        <x-markas.dock :items="$items" />
    </div>
    import { Dock } from "@/components/markas/Dock";
    
    const items = [
      {
        label: "Files",
        icon: "M3 7a2 2 0 0 1 2-2h4l2 2h8a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",
        active: true,
      },
      {
        label: "Mail",
        icon: "M3 7a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2zM3 7l9 6 9-6",
        active: true,
      },
      {
        label: "Calendar",
        icon: "M5 5h14a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V7a2 2 0 0 1 2-2zM3 10h18M8 3v4M16 3v4",
      },
      {
        label: "Music",
        icon: "M9 18V5l12-2v13M9 18a3 3 0 1 1-6 0 3 3 0 0 1 6 0zM21 16a3 3 0 1 1-6 0 3 3 0 0 1 6 0z",
        active: true,
      },
      {
        label: "Photos",
        icon: "M5 4h14a1 1 0 0 1 1 1v14a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1zM4 16l5-5 4 4 3-3 4 4M15 8h.01",
      },
      {
        label: "Settings",
        icon: "M4 6h9M17 6h3M4 12h3M11 12h9M4 18h11M19 18h1M15 4v4M9 10v4M17 16v4",
      },
      { separator: true },
      {
        label: "Trash",
        icon: "M4 7h16M10 11v6M14 11v6M5 7l1 12a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2l1-12M9 7V4h6v3",
      },
    ];
    
    export default function DockExample() {
      return (
        <div className="relative grid h-[280px] place-items-end justify-center overflow-hidden rounded-xl border border-line bg-subtle px-4 pb-4">
          <div className="absolute inset-x-10 top-8 h-36 rounded-lg border border-line bg-surface shadow-overlay">
            <div className="flex gap-1.5 border-b border-line px-3 py-2.5">
              <span className="size-2.5 rounded-full bg-line"></span>
              <span className="size-2.5 rounded-full bg-line"></span>
              <span className="size-2.5 rounded-full bg-line"></span>
            </div>
            <p className="px-4 pt-4 text-sm font-medium text-ink">Inbox</p>
            <p className="px-4 pt-1 text-sm text-muted">
              3 new messages from the design team
            </p>
          </div>
          <Dock items={items} />
        </div>
      );
    }
    <script setup lang="ts">
    import Dock from "@/components/markas/Dock.vue";
    
    const items = [
      {
        label: "Files",
        icon: "M3 7a2 2 0 0 1 2-2h4l2 2h8a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",
        active: true,
      },
      {
        label: "Mail",
        icon: "M3 7a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2zM3 7l9 6 9-6",
        active: true,
      },
      {
        label: "Calendar",
        icon: "M5 5h14a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V7a2 2 0 0 1 2-2zM3 10h18M8 3v4M16 3v4",
      },
      {
        label: "Music",
        icon: "M9 18V5l12-2v13M9 18a3 3 0 1 1-6 0 3 3 0 0 1 6 0zM21 16a3 3 0 1 1-6 0 3 3 0 0 1 6 0z",
        active: true,
      },
      {
        label: "Photos",
        icon: "M5 4h14a1 1 0 0 1 1 1v14a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1zM4 16l5-5 4 4 3-3 4 4M15 8h.01",
      },
      {
        label: "Settings",
        icon: "M4 6h9M17 6h3M4 12h3M11 12h9M4 18h11M19 18h1M15 4v4M9 10v4M17 16v4",
      },
      { separator: true },
      {
        label: "Trash",
        icon: "M4 7h16M10 11v6M14 11v6M5 7l1 12a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2l1-12M9 7V4h6v3",
      },
    ];
    </script>
    
    <template>
      <div
        class="relative grid h-[280px] place-items-end justify-center overflow-hidden rounded-xl border border-line bg-subtle px-4 pb-4"
      >
        <div
          class="absolute inset-x-10 top-8 h-36 rounded-lg border border-line bg-surface shadow-overlay"
        >
          <div class="flex gap-1.5 border-b border-line px-3 py-2.5">
            <span class="size-2.5 rounded-full bg-line"></span
            ><span class="size-2.5 rounded-full bg-line"></span
            ><span class="size-2.5 rounded-full bg-line"></span>
          </div>
          <p class="px-4 pt-4 text-sm font-medium text-ink">Inbox</p>
          <p class="px-4 pt-1 text-sm text-muted">
            3 new messages from the design team
          </p>
        </div>
        <Dock :items="items" />
      </div>
    </template>
    <script lang="ts">
      import Dock, { type DockItem } from "$lib/components/markas/Dock.svelte";
    
      const items: DockItem[] = [
        {
          label: "Files",
          icon: "M3 7a2 2 0 0 1 2-2h4l2 2h8a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",
          active: true,
        },
        {
          label: "Mail",
          icon: "M3 7a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2zM3 7l9 6 9-6",
          active: true,
        },
        {
          label: "Calendar",
          icon: "M5 5h14a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V7a2 2 0 0 1 2-2zM3 10h18M8 3v4M16 3v4",
        },
        {
          label: "Music",
          icon: "M9 18V5l12-2v13M9 18a3 3 0 1 1-6 0 3 3 0 0 1 6 0zM21 16a3 3 0 1 1-6 0 3 3 0 0 1 6 0z",
          active: true,
        },
        {
          label: "Photos",
          icon: "M5 4h14a1 1 0 0 1 1 1v14a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1zM4 16l5-5 4 4 3-3 4 4M15 8h.01",
        },
        {
          label: "Settings",
          icon: "M4 6h9M17 6h3M4 12h3M11 12h9M4 18h11M19 18h1M15 4v4M9 10v4M17 16v4",
        },
        { separator: true },
        {
          label: "Trash",
          icon: "M4 7h16M10 11v6M14 11v6M5 7l1 12a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2l1-12M9 7V4h6v3",
        },
      ];
    </script>
    
    <div
      class="relative grid h-[280px] place-items-end justify-center overflow-hidden rounded-xl border border-line bg-subtle px-4 pb-4"
    >
      <div
        class="absolute inset-x-10 top-8 h-36 rounded-lg border border-line bg-surface shadow-overlay"
      >
        <div class="flex gap-1.5 border-b border-line px-3 py-2.5">
          <span class="size-2.5 rounded-full bg-line"></span>
          <span class="size-2.5 rounded-full bg-line"></span>
          <span class="size-2.5 rounded-full bg-line"></span>
        </div>
        <p class="px-4 pt-4 text-sm font-medium text-ink">Inbox</p>
        <p class="px-4 pt-1 text-sm text-muted">
          3 new messages from the design team
        </p>
      </div>
      <Dock {items} />
    </div>
    ---
    import Dock, { type DockItem } from "@/components/markas/Dock.astro";
    
    const items: DockItem[] = [
      {
        label: "Files",
        icon: "M3 7a2 2 0 0 1 2-2h4l2 2h8a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",
        active: true,
      },
      {
        label: "Mail",
        icon: "M3 7a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2zM3 7l9 6 9-6",
        active: true,
      },
      {
        label: "Calendar",
        icon: "M5 5h14a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V7a2 2 0 0 1 2-2zM3 10h18M8 3v4M16 3v4",
      },
      {
        label: "Music",
        icon: "M9 18V5l12-2v13M9 18a3 3 0 1 1-6 0 3 3 0 0 1 6 0zM21 16a3 3 0 1 1-6 0 3 3 0 0 1 6 0z",
        active: true,
      },
      {
        label: "Photos",
        icon: "M5 4h14a1 1 0 0 1 1 1v14a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1zM4 16l5-5 4 4 3-3 4 4M15 8h.01",
      },
      {
        label: "Settings",
        icon: "M4 6h9M17 6h3M4 12h3M11 12h9M4 18h11M19 18h1M15 4v4M9 10v4M17 16v4",
      },
      { separator: true },
      {
        label: "Trash",
        icon: "M4 7h16M10 11v6M14 11v6M5 7l1 12a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2l1-12M9 7V4h6v3",
      },
    ];
    ---
    
    <div
      class="relative grid h-[280px] place-items-end justify-center overflow-hidden rounded-xl border border-line bg-subtle px-4 pb-4"
    >
      <div
        class="absolute inset-x-10 top-8 h-36 rounded-lg border border-line bg-surface shadow-overlay"
      >
        <div class="flex gap-1.5 border-b border-line px-3 py-2.5">
          <span class="size-2.5 rounded-full bg-line"></span>
          <span class="size-2.5 rounded-full bg-line"></span>
          <span class="size-2.5 rounded-full bg-line"></span>
        </div>
        <p class="px-4 pt-4 text-sm font-medium text-ink">Inbox</p>
        <p class="px-4 pt-1 text-sm text-muted">
          3 new messages from the design team
        </p>
      </div>
      <Dock items={items} />
    </div>
    import { Component } from "@angular/core";
    import { Dock, type DockItem } from "./markas/dock.component";
    
    @Component({
      selector: "markas-example",
      imports: [Dock],
      template: `
        <div
          class="relative grid h-[280px] place-items-end justify-center overflow-hidden rounded-xl border border-line bg-subtle px-4 pb-4"
        >
          <div
            class="absolute inset-x-10 top-8 h-36 rounded-lg border border-line bg-surface shadow-overlay"
          >
            <div class="flex gap-1.5 border-b border-line px-3 py-2.5">
              <span class="size-2.5 rounded-full bg-line"></span>
              <span class="size-2.5 rounded-full bg-line"></span>
              <span class="size-2.5 rounded-full bg-line"></span>
            </div>
            <p class="px-4 pt-4 text-sm font-medium text-ink">Inbox</p>
            <p class="px-4 pt-1 text-sm text-muted">
              3 new messages from the design team
            </p>
          </div>
          <markas-dock [items]="items" />
        </div>
      `,
    })
    export default class DockExample {
      protected readonly items: DockItem[] = [
        {
          label: "Files",
          icon: "M3 7a2 2 0 0 1 2-2h4l2 2h8a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",
          active: true,
        },
        {
          label: "Mail",
          icon: "M3 7a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2zM3 7l9 6 9-6",
          active: true,
        },
        {
          label: "Calendar",
          icon: "M5 5h14a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V7a2 2 0 0 1 2-2zM3 10h18M8 3v4M16 3v4",
        },
        {
          label: "Music",
          icon: "M9 18V5l12-2v13M9 18a3 3 0 1 1-6 0 3 3 0 0 1 6 0zM21 16a3 3 0 1 1-6 0 3 3 0 0 1 6 0z",
          active: true,
        },
        {
          label: "Photos",
          icon: "M5 4h14a1 1 0 0 1 1 1v14a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1zM4 16l5-5 4 4 3-3 4 4M15 8h.01",
        },
        {
          label: "Settings",
          icon: "M4 6h9M17 6h3M4 12h3M11 12h9M4 18h11M19 18h1M15 4v4M9 10v4M17 16v4",
        },
        { separator: true },
        {
          label: "Trash",
          icon: "M4 7h16M10 11v6M14 11v6M5 7l1 12a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2l1-12M9 7V4h6v3",
        },
      ];
    }

    Examples

    Site links

    Editor tools

    Strong magnification

    Installation

    npx markasui@latest add dock

    Usage

    <x-markas.dock
        :magnification="1.6"
        x-on:select="openApp($event.detail)"
        :items="[
            ['label' => 'Files', 'value' => 'files', 'icon' => 'M3 7a2 2 0 0 1 2-2h4l2 2h8a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z', 'active' => true],
            ['label' => 'Mail', 'value' => 'mail', 'icon' => 'M3 7a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2zM3 7l9 6 9-6'],
            ['separator' => true],
            ['label' => 'Blog', 'href' => '/blog', 'icon' => 'M12 20h9M16.5 3.5a2.1 2.1 0 0 1 3 3L7 19l-4 1 1-4z'],
        ]"
    />
    import { Dock } from "@/components/markas/Dock";
    
    <Dock
      items={[
        { label: "Files", value: "files", icon: folderPath, active: true },
        { label: "Mail", value: "mail", icon: mailPath },
        { separator: true },
        { label: "Blog", href: "/blog", icon: penPath },
      ]}
      onItemSelect={openApp}
    />;
    <script setup lang="ts">
    import Dock from "@/components/markas/Dock.vue";
    </script>
    
    <template>
      <Dock :items="items" :magnification="1.6" @select="openApp" />
    </template>
    <script lang="ts">
      import Dock, { type DockItem } from "$lib/components/markas/Dock.svelte";
    
      const items: DockItem[] = [
        { label: "Files", value: "files", icon: folderPath, active: true },
        { label: "Mail", value: "mail", icon: mailPath },
        { separator: true },
        { label: "Blog", href: "/blog", icon: penPath },
      ];
    </script>
    
    <Dock {items} onItemSelect={openApp} />
    ---
    import Dock, { type DockItem } from "@/components/markas/Dock.astro";
    
    const items: DockItem[] = [
      { label: "Files", value: "files", icon: folderPath, active: true },
      { separator: true },
      { label: "Blog", href: "/blog", icon: penPath },
    ];
    ---
    
    <Dock items={items} />

    A small custom element magnifies the items and moves the tab stop. Pressing an item dispatches a bubbling markas-select event with its value as detail.

    import { Component } from "@angular/core";
    import { Dock, type DockItem } from "./markas/dock.component";
    
    @Component({
      selector: "app-dock",
      imports: [Dock],
      template: `<markas-dock [items]="items" (itemSelect)="openApp($event)" />`,
    })
    export class AppDock {
      items: DockItem[] = [
        { label: "Files", value: "files", icon: "M3 7h18v12H3z", active: true },
        { separator: true },
        { label: "Blog", href: "/blog", icon: "M12 20h9" },
      ];
      openApp(value: string) {}
    }
    • Items grow with a cosine falloff over 140px around the pointer, and around the focused item when you use the keyboard.
    • The dock is a toolbar with roving tabindex: Tab enters it once, arrows move between items.
    • Pressing an item plays a short bounce and fires select. Items with href navigate as normal links.
    • Reduced motion keeps every item at its base size and skips the bounce.
    • The dock never grows wider than its container. In a narrow one the items shrink evenly so every item stays visible.

    Props

    NameTypeDefaultDescription
    items({ label: string; icon: string; value?: string; href?: string; active?: boolean } | { separator: true })[][]Dock items in order. icon is the d attribute of a 24x24 stroked SVG path. { separator: true } draws a divider. Items with href render as links.
    magnificationnumber1.6How large the item under the pointer or focus grows. Neighbours within 140px grow less. 1 turns it off.
    onItemSelect / @select / x-on:select(value: string) => void-Fires when an item is pressed, with its value or label. Blade dispatches a select DOM event with the value as detail.
    dockLabelstringDockAccessible name of the toolbar.
    (itemSelect)output<string>-Angular only. Emits the value (or label) of the pressed item. Svelte uses onItemSelect like React.
    markas-selectCustomEvent<string>-Astro only. Bubbling event with the value of the pressed item as detail.

    Accessibility

    • The dock is a toolbar named by dockLabel. Only one item is in the tab order and Arrow Left, Arrow Right, Home, and End move between items (roving tabindex).
    • The label inside each item is its accessible name and appears as a tooltip on hover and keyboard focus.
    • Items with a dot carry aria-current="true". Separators use role="separator".
    • With reduced motion the magnification and launch bounce are off, items keep their base size.

    Related components

    More markasui components with the same classes in every framework.