Skip to content
MarkasUI
Type to search

    Guide

    MarkasUI

    Form

    Feedback

    Overlay

    Navigation

    Data

    Sections

    Animations

    Backgrounds

    Buttons

    Templates

    Pages

    Dynamic Island

    Black pill inspired by the iPhone Dynamic Island. It morphs smoothly between idle, compact, and expanded states while its content crossfades.

    12:48

    Focus timer

    12:48

    Focus timer running

    9:41

    Wednesday, 5 November

    12:48

    Focus timer

    12:48

    Focus timer running

    9:41

    Wednesday, 5 November

    12:48

    Focus timer

    12:48

    Focus timer running

    9:41

    Wednesday, 5 November

    12:48

    Focus timer

    12:48

    Focus timer running

    9:41

    Wednesday, 5 November

    12:48

    Focus timer

    12:48

    Focus timer running

    9:41

    Wednesday, 5 November

    @php
        $panel = 'grid gap-4';
        $stage = 'relative h-[220px] overflow-hidden rounded-[2rem] border border-line bg-surface';
        $top = '@container absolute inset-x-0 top-3 px-3';
        $clock = 'pt-24 text-center text-5xl font-semibold text-ink tabular-nums';
        $date = 'pt-1 text-center text-sm text-muted';
        $controls = 'flex justify-center gap-1.5';
        $demoButton = 'h-8 rounded-full border border-line bg-surface px-3 text-sm font-medium text-ink transition-colors duration-150 ease-out hover:bg-subtle focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary aria-pressed:border-primary aria-pressed:bg-primary aria-pressed:text-on-primary motion-reduce:transition-none';
        $timerIcon = 'size-4 text-warning';
        $timerText = 'text-warning tabular-nums';
        $card = 'flex h-full flex-col justify-between';
        $cardHead = 'flex items-center gap-3';
        $badge = 'grid size-11 place-items-center rounded-full bg-warning/15 text-warning';
        $badgeIcon = 'size-5';
        $label = 'text-xs text-muted';
        $big = 'text-2xl leading-tight font-semibold tabular-nums';
        $actions = 'grid grid-cols-2 gap-2';
        $soft = 'h-9 rounded-full bg-subtle text-sm font-medium text-ink transition-colors duration-150 ease-out hover:bg-line focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary motion-reduce:transition-none';
        $stop = 'h-9 rounded-full bg-danger/15 text-sm font-medium text-danger transition-colors duration-150 ease-out hover:bg-danger/25 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary motion-reduce:transition-none';
    
        $timer = 'M12 8v5l3 2M9 2h6M12 21a8 8 0 1 0 0-16 8 8 0 0 0 0 16z';
        $states = ['idle' => 'Idle', 'compact' => 'Compact', 'expanded' => 'Expanded'];
    @endphp
    
    <div x-data="{ island: 'compact' }" class="{{ $panel }}">
        <div class="{{ $stage }}">
            <div class="{{ $top }}">
                <x-markas.dynamic-island
                    state="compact"
                    x-model="island"
                    :announcements="['compact' => 'Focus timer running', 'expanded' => 'Focus timer, 12 minutes 48 seconds left']"
                >
                    <x-slot:leading>
                        <svg aria-hidden="true" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" class="{{ $timerIcon }}"><path d="{{ $timer }}" /></svg>
                    </x-slot:leading>
                    <x-slot:trailing>
                        <span class="{{ $timerText }}">12:48</span>
                    </x-slot:trailing>
                    <x-slot:expanded>
                        <div class="{{ $card }}">
                            <div class="{{ $cardHead }}">
                                <span class="{{ $badge }}">
                                    <svg aria-hidden="true" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" class="{{ $badgeIcon }}"><path d="{{ $timer }}" /></svg>
                                </span>
                                <div>
                                    <p class="{{ $label }}">Focus timer</p>
                                    <p class="{{ $big }}">12:48</p>
                                </div>
                            </div>
                            <div class="{{ $actions }}">
                                <button type="button" x-on:click="island = 'compact'" class="{{ $soft }}">Minimize</button>
                                <button type="button" x-on:click="island = 'idle'" class="{{ $stop }}">End</button>
                            </div>
                        </div>
                    </x-slot:expanded>
                </x-markas.dynamic-island>
            </div>
            <p class="{{ $clock }}">9:41</p>
            <p class="{{ $date }}">Wednesday, 5 November</p>
        </div>
        <div role="group" aria-label="Island state" class="{{ $controls }}">
            @foreach ($states as $value => $text)
                <button
                    type="button"
                    aria-pressed="{{ $value === 'compact' ? 'true' : 'false' }}"
                    x-bind:aria-pressed="island === '{{ $value }}'"
                    x-on:click="island = '{{ $value }}'"
                    class="{{ $demoButton }}"
                >{{ $text }}</button>
            @endforeach
        </div>
    </div>
    import { useState } from "react";
    import {
      DynamicIsland,
      type DynamicIslandState,
    } from "@/components/markas/DynamicIsland";
    
    const panel = "grid gap-4";
    const stage =
      "relative h-[220px] overflow-hidden rounded-[2rem] border border-line bg-surface";
    const top = "@container absolute inset-x-0 top-3 px-3";
    const clock = "pt-24 text-center text-5xl font-semibold text-ink tabular-nums";
    const date = "pt-1 text-center text-sm text-muted";
    const controls = "flex justify-center gap-1.5";
    const demoButton =
      "h-8 rounded-full border border-line bg-surface px-3 text-sm font-medium text-ink transition-colors duration-150 ease-out hover:bg-subtle focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary aria-pressed:border-primary aria-pressed:bg-primary aria-pressed:text-on-primary motion-reduce:transition-none";
    const timerIcon = "size-4 text-warning";
    const timerText = "text-warning tabular-nums";
    const card = "flex h-full flex-col justify-between";
    const cardHead = "flex items-center gap-3";
    const badge =
      "grid size-11 place-items-center rounded-full bg-warning/15 text-warning";
    const badgeIcon = "size-5";
    const label = "text-xs text-muted";
    const big = "text-2xl leading-tight font-semibold tabular-nums";
    const actions = "grid grid-cols-2 gap-2";
    const soft =
      "h-9 rounded-full bg-subtle text-sm font-medium text-ink transition-colors duration-150 ease-out hover:bg-line focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary motion-reduce:transition-none";
    const stop =
      "h-9 rounded-full bg-danger/15 text-sm font-medium text-danger transition-colors duration-150 ease-out hover:bg-danger/25 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary motion-reduce:transition-none";
    
    const TIMER = "M12 8v5l3 2M9 2h6M12 21a8 8 0 1 0 0-16 8 8 0 0 0 0 16z";
    const states: { value: DynamicIslandState; label: string }[] = [
      { value: "idle", label: "Idle" },
      { value: "compact", label: "Compact" },
      { value: "expanded", label: "Expanded" },
    ];
    
    const Icon = ({ className }: { className: string }) => (
      <svg
        aria-hidden="true"
        viewBox="0 0 24 24"
        fill="none"
        stroke="currentColor"
        strokeWidth="1.5"
        strokeLinecap="round"
        strokeLinejoin="round"
        className={className}
      >
        <path d={TIMER} />
      </svg>
    );
    
    export default function DynamicIslandExample() {
      const [island, setIsland] = useState<DynamicIslandState>("compact");
      return (
        <div className={panel}>
          <div className={stage}>
            <div className={top}>
              <DynamicIsland
                state={island}
                announcements={{
                  compact: "Focus timer running",
                  expanded: "Focus timer, 12 minutes 48 seconds left",
                }}
                leading={<Icon className={timerIcon} />}
                trailing={<span className={timerText}>12:48</span>}
                expanded={
                  <div className={card}>
                    <div className={cardHead}>
                      <span className={badge}>
                        <Icon className={badgeIcon} />
                      </span>
                      <div>
                        <p className={label}>Focus timer</p>
                        <p className={big}>12:48</p>
                      </div>
                    </div>
                    <div className={actions}>
                      <button
                        type="button"
                        className={soft}
                        onClick={() => setIsland("compact")}
                      >
                        Minimize
                      </button>
                      <button
                        type="button"
                        className={stop}
                        onClick={() => setIsland("idle")}
                      >
                        End
                      </button>
                    </div>
                  </div>
                }
              />
            </div>
            <p className={clock}>9:41</p>
            <p className={date}>Wednesday, 5 November</p>
          </div>
          <div role="group" aria-label="Island state" className={controls}>
            {states.map((item) => (
              <button
                key={item.value}
                type="button"
                aria-pressed={island === item.value}
                className={demoButton}
                onClick={() => setIsland(item.value)}
              >
                {item.label}
              </button>
            ))}
          </div>
        </div>
      );
    }
    <script setup lang="ts">
    import { ref } from "vue";
    import DynamicIsland, {
      type DynamicIslandState,
    } from "@/components/markas/DynamicIsland.vue";
    
    const panel = "grid gap-4";
    const stage =
      "relative h-[220px] overflow-hidden rounded-[2rem] border border-line bg-surface";
    const top = "@container absolute inset-x-0 top-3 px-3";
    const clock = "pt-24 text-center text-5xl font-semibold text-ink tabular-nums";
    const date = "pt-1 text-center text-sm text-muted";
    const controls = "flex justify-center gap-1.5";
    const demoButton =
      "h-8 rounded-full border border-line bg-surface px-3 text-sm font-medium text-ink transition-colors duration-150 ease-out hover:bg-subtle focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary aria-pressed:border-primary aria-pressed:bg-primary aria-pressed:text-on-primary motion-reduce:transition-none";
    const timerIcon = "size-4 text-warning";
    const timerText = "text-warning tabular-nums";
    const card = "flex h-full flex-col justify-between";
    const cardHead = "flex items-center gap-3";
    const badge =
      "grid size-11 place-items-center rounded-full bg-warning/15 text-warning";
    const badgeIcon = "size-5";
    const label = "text-xs text-muted";
    const big = "text-2xl leading-tight font-semibold tabular-nums";
    const actions = "grid grid-cols-2 gap-2";
    const soft =
      "h-9 rounded-full bg-subtle text-sm font-medium text-ink transition-colors duration-150 ease-out hover:bg-line focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary motion-reduce:transition-none";
    const stop =
      "h-9 rounded-full bg-danger/15 text-sm font-medium text-danger transition-colors duration-150 ease-out hover:bg-danger/25 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary motion-reduce:transition-none";
    
    const TIMER = "M12 8v5l3 2M9 2h6M12 21a8 8 0 1 0 0-16 8 8 0 0 0 0 16z";
    const states: { value: DynamicIslandState; label: string }[] = [
      { value: "idle", label: "Idle" },
      { value: "compact", label: "Compact" },
      { value: "expanded", label: "Expanded" },
    ];
    
    const island = ref<DynamicIslandState>("compact");
    </script>
    
    <template>
      <div :class="panel">
        <div :class="stage">
          <div :class="top">
            <DynamicIsland
              :state="island"
              :announcements="{
                compact: 'Focus timer running',
                expanded: 'Focus timer, 12 minutes 48 seconds left',
              }"
            >
              <template #leading>
                <svg
                  aria-hidden="true"
                  viewBox="0 0 24 24"
                  fill="none"
                  stroke="currentColor"
                  stroke-width="1.5"
                  stroke-linecap="round"
                  stroke-linejoin="round"
                  :class="timerIcon"
                >
                  <path :d="TIMER" />
                </svg>
              </template>
              <template #trailing>
                <span :class="timerText">12:48</span>
              </template>
              <template #expanded>
                <div :class="card">
                  <div :class="cardHead">
                    <span :class="badge">
                      <svg
                        aria-hidden="true"
                        viewBox="0 0 24 24"
                        fill="none"
                        stroke="currentColor"
                        stroke-width="1.5"
                        stroke-linecap="round"
                        stroke-linejoin="round"
                        :class="badgeIcon"
                      >
                        <path :d="TIMER" />
                      </svg>
                    </span>
                    <div>
                      <p :class="label">Focus timer</p>
                      <p :class="big">12:48</p>
                    </div>
                  </div>
                  <div :class="actions">
                    <button type="button" :class="soft" @click="island = 'compact'">
                      Minimize
                    </button>
                    <button type="button" :class="stop" @click="island = 'idle'">
                      End
                    </button>
                  </div>
                </div>
              </template>
            </DynamicIsland>
          </div>
          <p :class="clock">9:41</p>
          <p :class="date">Wednesday, 5 November</p>
        </div>
        <div role="group" aria-label="Island state" :class="controls">
          <button
            v-for="item in states"
            :key="item.value"
            type="button"
            :aria-pressed="island === item.value"
            :class="demoButton"
            @click="island = item.value"
          >
            {{ item.label }}
          </button>
        </div>
      </div>
    </template>
    <script lang="ts">
      import DynamicIsland, {
        type DynamicIslandState,
      } from "$lib/components/markas/DynamicIsland.svelte";
    
      const panel = "grid gap-4";
      const stage =
        "relative h-[220px] overflow-hidden rounded-[2rem] border border-line bg-surface";
      const top = "@container absolute inset-x-0 top-3 px-3";
      const clock =
        "pt-24 text-center text-5xl font-semibold text-ink tabular-nums";
      const date = "pt-1 text-center text-sm text-muted";
      const controls = "flex justify-center gap-1.5";
      const demoButton =
        "h-8 rounded-full border border-line bg-surface px-3 text-sm font-medium text-ink transition-colors duration-150 ease-out hover:bg-subtle focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary aria-pressed:border-primary aria-pressed:bg-primary aria-pressed:text-on-primary motion-reduce:transition-none";
      const timerIcon = "size-4 text-warning";
      const timerText = "text-warning tabular-nums";
      const card = "flex h-full flex-col justify-between";
      const cardHead = "flex items-center gap-3";
      const badge =
        "grid size-11 place-items-center rounded-full bg-warning/15 text-warning";
      const badgeIcon = "size-5";
      const label = "text-xs text-muted";
      const big = "text-2xl leading-tight font-semibold tabular-nums";
      const actions = "grid grid-cols-2 gap-2";
      const soft =
        "h-9 rounded-full bg-subtle text-sm font-medium text-ink transition-colors duration-150 ease-out hover:bg-line focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary motion-reduce:transition-none";
      const stop =
        "h-9 rounded-full bg-danger/15 text-sm font-medium text-danger transition-colors duration-150 ease-out hover:bg-danger/25 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary motion-reduce:transition-none";
    
      const TIMER = "M12 8v5l3 2M9 2h6M12 21a8 8 0 1 0 0-16 8 8 0 0 0 0 16z";
      const states: { value: DynamicIslandState; label: string }[] = [
        { value: "idle", label: "Idle" },
        { value: "compact", label: "Compact" },
        { value: "expanded", label: "Expanded" },
      ];
    
      let island = $state<DynamicIslandState>("compact");
    </script>
    
    {#snippet icon(className: string)}
      <svg
        aria-hidden="true"
        viewBox="0 0 24 24"
        fill="none"
        stroke="currentColor"
        stroke-width="1.5"
        stroke-linecap="round"
        stroke-linejoin="round"
        class={className}
      >
        <path d={TIMER} />
      </svg>
    {/snippet}
    
    <div class={panel}>
      <div class={stage}>
        <div class={top}>
          <DynamicIsland
            state={island}
            announcements={{
              compact: "Focus timer running",
              expanded: "Focus timer, 12 minutes 48 seconds left",
            }}
          >
            {#snippet leading()}
              {@render icon(timerIcon)}
            {/snippet}
            {#snippet trailing()}
              <span class={timerText}>12:48</span>
            {/snippet}
            {#snippet expanded()}
              <div class={card}>
                <div class={cardHead}>
                  <span class={badge}>
                    {@render icon(badgeIcon)}
                  </span>
                  <div>
                    <p class={label}>Focus timer</p>
                    <p class={big}>12:48</p>
                  </div>
                </div>
                <div class={actions}>
                  <button
                    type="button"
                    class={soft}
                    onclick={() => (island = "compact")}>Minimize</button
                  >
                  <button
                    type="button"
                    class={stop}
                    onclick={() => (island = "idle")}>End</button
                  >
                </div>
              </div>
            {/snippet}
          </DynamicIsland>
        </div>
        <p class={clock}>9:41</p>
        <p class={date}>Wednesday, 5 November</p>
      </div>
      <div role="group" aria-label="Island state" class={controls}>
        {#each states as item (item.value)}
          <button
            type="button"
            aria-pressed={island === item.value}
            class={demoButton}
            onclick={() => (island = item.value)}>{item.label}</button
          >
        {/each}
      </div>
    </div>
    ---
    import DynamicIsland, { type DynamicIslandState } from "@/components/markas/DynamicIsland.astro";
    
    const panel = "grid gap-4";
    const stage =
      "relative h-[220px] overflow-hidden rounded-[2rem] border border-line bg-surface";
    const top = "@container absolute inset-x-0 top-3 px-3";
    const clock =
      "pt-24 text-center text-5xl font-semibold text-ink tabular-nums";
    const date = "pt-1 text-center text-sm text-muted";
    const controls = "flex justify-center gap-1.5";
    const demoButton =
      "h-8 rounded-full border border-line bg-surface px-3 text-sm font-medium text-ink transition-colors duration-150 ease-out hover:bg-subtle focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary aria-pressed:border-primary aria-pressed:bg-primary aria-pressed:text-on-primary motion-reduce:transition-none";
    const timerIcon = "size-4 text-warning";
    const timerText = "text-warning tabular-nums";
    const card = "flex h-full flex-col justify-between";
    const cardHead = "flex items-center gap-3";
    const badge =
      "grid size-11 place-items-center rounded-full bg-warning/15 text-warning";
    const badgeIcon = "size-5";
    const label = "text-xs text-muted";
    const big = "text-2xl leading-tight font-semibold tabular-nums";
    const actions = "grid grid-cols-2 gap-2";
    const soft =
      "h-9 rounded-full bg-subtle text-sm font-medium text-ink transition-colors duration-150 ease-out hover:bg-line focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary motion-reduce:transition-none";
    const stop =
      "h-9 rounded-full bg-danger/15 text-sm font-medium text-danger transition-colors duration-150 ease-out hover:bg-danger/25 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary motion-reduce:transition-none";
    
    const TIMER = "M12 8v5l3 2M9 2h6M12 21a8 8 0 1 0 0-16 8 8 0 0 0 0 16z";
    const states: { value: DynamicIslandState; label: string }[] = [
      { value: "idle", label: "Idle" },
      { value: "compact", label: "Compact" },
      { value: "expanded", label: "Expanded" },
    ];
    ---
    
    <div class={panel} data-island-demo>
      <div class={stage}>
        <div class={top}>
          <DynamicIsland
            state="compact"
            announcements={{
              compact: "Focus timer running",
              expanded: "Focus timer, 12 minutes 48 seconds left",
            }}
          >
            <Fragment slot="leading">
              <svg
                aria-hidden="true"
                viewBox="0 0 24 24"
                fill="none"
                stroke="currentColor"
                stroke-width="1.5"
                stroke-linecap="round"
                stroke-linejoin="round"
                class={timerIcon}
              >
                <path d={TIMER}></path>
              </svg>
            </Fragment>
            <span slot="trailing" class={timerText}>12:48</span>
            <div slot="expanded" class={card}>
              <div class={cardHead}>
                <span class={badge}>
                  <svg
                aria-hidden="true"
                viewBox="0 0 24 24"
                fill="none"
                stroke="currentColor"
                stroke-width="1.5"
                stroke-linecap="round"
                stroke-linejoin="round"
                class={badgeIcon}
              >
                <path d={TIMER}></path>
              </svg>
                </span>
                <div>
                  <p class={label}>Focus timer</p>
                  <p class={big}>12:48</p>
                </div>
              </div>
              <div class={actions}>
                <button type="button" class={soft} data-island-set="compact">Minimize</button>
                <button type="button" class={stop} data-island-set="idle">End</button>
              </div>
            </div>
          </DynamicIsland>
        </div>
        <p class={clock}>9:41</p>
        <p class={date}>Wednesday, 5 November</p>
      </div>
      <div role="group" aria-label="Island state" class={controls}>
        {
          states.map((item) => (
            <button
              type="button"
              aria-pressed={item.value === "compact" ? "true" : "false"}
              data-island-set={item.value}
              class={demoButton}
            >
              {item.label}
            </button>
          ))
        }
      </div>
    </div>
    
    <script>
      // Demo wiring: buttons with data-island-set move the island to that state.
      document.addEventListener("click", (event) => {
        const button = (event.target as Element).closest<HTMLElement>(
          "[data-island-set]",
        );
        const demo = button?.closest("[data-island-demo]");
        if (!button || !demo) return;
        const state = button.dataset.islandSet ?? "idle";
        demo.querySelector("markas-dynamic-island")?.setAttribute("state", state);
        demo.querySelectorAll("[aria-pressed]").forEach((other) =>
          other.setAttribute(
            "aria-pressed",
            String(other.getAttribute("data-island-set") === state),
          ),
        );
      });
    </script>
    import { Component, signal } from "@angular/core";
    import {
      DynamicIsland,
      type DynamicIslandState,
    } from "./markas/dynamic-island.component";
    
    @Component({
      selector: "markas-example",
      imports: [DynamicIsland],
      template: `
        <div [class]="panel">
          <div [class]="stage">
            <div [class]="top">
              <markas-dynamic-island
                [state]="island()"
                [announcements]="announcements"
              >
                <ng-container leading>
                  <svg
                    aria-hidden="true"
                    viewBox="0 0 24 24"
                    fill="none"
                    stroke="currentColor"
                    stroke-width="1.5"
                    stroke-linecap="round"
                    stroke-linejoin="round"
                    [class]="timerIcon"
                  >
                    <path [attr.d]="TIMER" />
                  </svg>
                </ng-container>
                <span trailing [class]="timerText">12:48</span>
                <div expanded [class]="card">
                  <div [class]="cardHead">
                    <span [class]="badge">
                      <svg
                        aria-hidden="true"
                        viewBox="0 0 24 24"
                        fill="none"
                        stroke="currentColor"
                        stroke-width="1.5"
                        stroke-linecap="round"
                        stroke-linejoin="round"
                        [class]="badgeIcon"
                      >
                        <path [attr.d]="TIMER" />
                      </svg>
                    </span>
                    <div>
                      <p [class]="label">Focus timer</p>
                      <p [class]="big">12:48</p>
                    </div>
                  </div>
                  <div [class]="actions">
                    <button
                      type="button"
                      [class]="soft"
                      (click)="island.set('compact')"
                    >
                      Minimize
                    </button>
                    <button
                      type="button"
                      [class]="stop"
                      (click)="island.set('idle')"
                    >
                      End
                    </button>
                  </div>
                </div>
              </markas-dynamic-island>
            </div>
            <p [class]="clock">9:41</p>
            <p [class]="date">Wednesday, 5 November</p>
          </div>
          <div role="group" aria-label="Island state" [class]="controls">
            @for (item of states; track item.value) {
              <button
                type="button"
                [attr.aria-pressed]="island() === item.value"
                [class]="demoButton"
                (click)="island.set(item.value)"
              >
                {{ item.label }}
              </button>
            }
          </div>
        </div>
      `,
    })
    export default class DynamicIslandExample {
      protected readonly panel = "grid gap-4";
      protected readonly stage =
        "relative h-[220px] overflow-hidden rounded-[2rem] border border-line bg-surface";
      protected readonly top = "@container absolute inset-x-0 top-3 px-3";
      protected readonly clock =
        "pt-24 text-center text-5xl font-semibold text-ink tabular-nums";
      protected readonly date = "pt-1 text-center text-sm text-muted";
      protected readonly controls = "flex justify-center gap-1.5";
      protected readonly demoButton =
        "h-8 rounded-full border border-line bg-surface px-3 text-sm font-medium text-ink transition-colors duration-150 ease-out hover:bg-subtle focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary aria-pressed:border-primary aria-pressed:bg-primary aria-pressed:text-on-primary motion-reduce:transition-none";
      protected readonly timerIcon = "size-4 text-warning";
      protected readonly timerText = "text-warning tabular-nums";
      protected readonly card = "flex h-full flex-col justify-between";
      protected readonly cardHead = "flex items-center gap-3";
      protected readonly badge =
        "grid size-11 place-items-center rounded-full bg-warning/15 text-warning";
      protected readonly badgeIcon = "size-5";
      protected readonly label = "text-xs text-muted";
      protected readonly big = "text-2xl leading-tight font-semibold tabular-nums";
      protected readonly actions = "grid grid-cols-2 gap-2";
      protected readonly soft =
        "h-9 rounded-full bg-subtle text-sm font-medium text-ink transition-colors duration-150 ease-out hover:bg-line focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary motion-reduce:transition-none";
      protected readonly stop =
        "h-9 rounded-full bg-danger/15 text-sm font-medium text-danger transition-colors duration-150 ease-out hover:bg-danger/25 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary motion-reduce:transition-none";
      protected readonly TIMER =
        "M12 8v5l3 2M9 2h6M12 21a8 8 0 1 0 0-16 8 8 0 0 0 0 16z";
      protected readonly states: { value: DynamicIslandState; label: string }[] = [
        { value: "idle", label: "Idle" },
        { value: "compact", label: "Compact" },
        { value: "expanded", label: "Expanded" },
      ];
      protected readonly announcements = {
        compact: "Focus timer running",
        expanded: "Focus timer, 12 minutes 48 seconds left",
      };
      protected readonly island = signal<DynamicIslandState>("compact");
    }

    Examples

    Now playing

    Hujan di Kota

    Nadia Sukma

    1:243:34

    Hujan di Kota

    Nadia Sukma

    1:243:34

    Hujan di Kota

    Nadia Sukma

    1:243:34

    Hujan di Kota

    Nadia Sukma

    1:24 3:34

    Hujan di Kota

    Nadia Sukma

    1:243:34

    Incoming call

    Rina
    0:42

    Mobile

    Rina Santoso

    Incoming call from Rina Santoso

    Rina
    0:42

    Mobile

    Rina Santoso

    Incoming call from Rina Santoso

    Rina
    0:42

    Mobile

    Rina Santoso

    Incoming call from Rina Santoso

    Rina
    0:42

    Mobile

    Rina Santoso

    Incoming call from Rina Santoso

    Rina
    0:42

    Mobile

    Rina Santoso

    Incoming call from Rina Santoso

    Payment received

    +Rp2,5jt

    Payment received

    Rp 2.500.000

    PT Sinar Jaya, invoice INV-2041

    Payment received, Rp 2.500.000

    +Rp2,5jt

    Payment received

    Rp 2.500.000

    PT Sinar Jaya, invoice INV-2041

    Payment received, Rp 2.500.000

    +Rp2,5jt

    Payment received

    Rp 2.500.000

    PT Sinar Jaya, invoice INV-2041

    Payment received, Rp 2.500.000

    +Rp2,5jt

    Payment received

    Rp 2.500.000

    PT Sinar Jaya, invoice INV-2041

    Payment received, Rp 2.500.000

    +Rp2,5jt

    Payment received

    Rp 2.500.000

    PT Sinar Jaya, invoice INV-2041

    Payment received, Rp 2.500.000

    Installation

    npx markasui@latest add dynamic-island

    Usage

    <div x-data="{ island: 'compact' }">
        <x-markas.dynamic-island
            state="compact"
            x-model="island"
            :announcements="['expanded' => 'Focus timer, 12 minutes left']"
        >
            <x-slot:leading><svg aria-hidden="true">...</svg></x-slot:leading>
            <x-slot:trailing><span class="tabular-nums">12:48</span></x-slot:trailing>
            <x-slot:expanded>
                <p>Focus timer</p>
                <button type="button" x-on:click="island = 'idle'">End</button>
            </x-slot:expanded>
        </x-markas.dynamic-island>
        <button type="button" x-on:click="island = 'expanded'">Show timer</button>
    </div>
    import { DynamicIsland } from "@/components/markas/DynamicIsland";
    
    const [state, setState] = useState<"idle" | "compact" | "expanded">("compact");
    
    <DynamicIsland
      state={state}
      leading={<TimerIcon />}
      trailing={<span className="tabular-nums">12:48</span>}
      expanded={<TimerCard onEnd={() => setState("idle")} />}
      announcements={{ expanded: "Focus timer, 12 minutes left" }}
    />;
    <script setup lang="ts">
    import DynamicIsland from "@/components/markas/DynamicIsland.vue";
    
    const state = ref<"idle" | "compact" | "expanded">("compact");
    </script>
    
    <template>
      <DynamicIsland :state="state" :announcements="{ expanded: 'Focus timer' }">
        <template #leading><TimerIcon /></template>
        <template #trailing><span class="tabular-nums">12:48</span></template>
        <template #expanded><TimerCard @end="state = 'idle'" /></template>
      </DynamicIsland>
    </template>
    <script lang="ts">
      import DynamicIsland, {
        type DynamicIslandState,
      } from "$lib/components/markas/DynamicIsland.svelte";
    
      let state = $state<DynamicIslandState>("compact");
    </script>
    
    <DynamicIsland
      {state}
      announcements={{ expanded: "Focus timer, 12 minutes left" }}
    >
      {#snippet leading()}<TimerIcon />{/snippet}
      {#snippet trailing()}<span class="tabular-nums">12:48</span>{/snippet}
      {#snippet expanded()}
        <TimerCard onEnd={() => (state = "idle")} />
      {/snippet}
    </DynamicIsland>
    ---
    import DynamicIsland from "@/components/markas/DynamicIsland.astro";
    ---
    
    <DynamicIsland
      state="compact"
      announcements={{ expanded: "Focus timer, 12 minutes left" }}
    >
      <TimerIcon slot="leading" />
      <span slot="trailing" class="tabular-nums">12:48</span>
      <TimerCard slot="expanded" />
    </DynamicIsland>
    
    <script>
      document
        .querySelector("markas-dynamic-island")
        ?.setAttribute("state", "expanded");
    </script>

    The island renders its first state on the server. Change it later by setting the state attribute on markas-dynamic-island; the panels, inert, and announcement follow.

    import { Component, signal } from "@angular/core";
    import {
      DynamicIsland,
      type DynamicIslandState,
    } from "./markas/dynamic-island.component";
    
    @Component({
      selector: "app-timer-island",
      imports: [DynamicIsland],
      template: `
        <markas-dynamic-island [state]="state()" [announcements]="announcements">
          <span leading class="size-2 rounded-full bg-warning"></span>
          <span trailing class="tabular-nums">12:48</span>
          <div expanded>
            <button type="button" (click)="state.set('idle')">End</button>
          </div>
        </markas-dynamic-island>
      `,
    })
    export class TimerIsland {
      state = signal<DynamicIslandState>("compact");
      announcements = { expanded: "Focus timer, 12 minutes left" };
    }

    Elements with the idle, leading, trailing, or expanded attribute fill the matching slot. An ng-container works too.

    • Width, height, and corner radius move with one springy CSS transition. The incoming content fades and sharpens in a beat later.
    • Each state’s content keeps its final size and is revealed by the growing pill, so text never reflows mid-animation.
    • The island adds the dark class to itself, so it is a black pill on light pages and a ringed one on dark pages, and nested components use dark tokens.
    • Sizes come from --island-idle-width, --island-compact-width, --island-expanded-width, and --island-expanded-height (defaults 7.5rem, 15rem, 22rem, 9.5rem).
    • The island never grows wider than its parent. Its content is capped at the nearest size container, or the screen when there is none, so give a narrow parent the @container class (as the examples do) and the content fits too.

    Props

    NameTypeDefaultDescription
    state"idle" | "compact" | "expanded"idleCurrent state, controlled by you. Blade also follows a parent value bound with x-model.
    idleReactNode / slot-Content of the small idle pill, usually empty.
    leadingReactNode / slot-Left side of the compact pill, such as an icon or album art.
    trailingReactNode / slot-Right side of the compact pill, such as a timer or short value.
    expandedReactNode / slot-Content of the large card, with room for text and buttons.
    announcements{ idle?: string; compact?: string; expanded?: string }{}Text a polite live region reads when the island moves to that state. Only fill the states that matter.
    islandLabelstringLive activityAccessible name of the island region.
    state attributeidle | compact | expanded-Astro only. Set the state attribute on markas-dynamic-island from a script to morph the island after the first render.

    Accessibility

    • The island is a region named by islandLabel. Content of the states that are not shown is inert, so it cannot be focused or read.
    • A visually hidden aria-live="polite" paragraph reads the announcement of the current state, so important changes are heard without moving focus.
    • Size changes and the crossfade are pure CSS transitions. With reduced motion the island jumps straight to the new size.
    • Give icon-only buttons inside the slots an aria-label, and keep the controls that change the state outside the island.

    Related components

    More markasui components with the same classes in every framework.