Lewati ke konten
MarkasUI
Ketik untuk mencari

    Panduan

    MarkasUI

    Form

    Feedback

    Overlay

    Navigasi

    Data

    Section

    Animasi

    Latar

    Tombol

    Template

    Halaman

    Bottom Navigation

    Bar bawah gaya aplikasi mobile. Pill meluncur ke item terpilih, labelnya muncul, dan bar bisa menciut jadi ikon saat konten discroll.

    Total balance

    Rp 12.480.000

    Recent transactions

    • Kopi Kenangan Today, 08:12 -Rp 32.000
    • Salary Today, 07:00 +Rp 9.500.000
    • GoRide Yesterday, 18:40 -Rp 18.500
    • Tokopedia Yesterday, 13:05 -Rp 245.000
    • Electricity token 3 Nov, 20:15 -Rp 200.000
    • Transfer from Rina 3 Nov, 09:30 +Rp 150.000
    • Indomaret 2 Nov, 19:02 -Rp 67.800
    • Netflix 1 Nov, 00:01 -Rp 54.000
    • Freelance invoice 31 Oct, 16:45 +Rp 2.750.000
    • Sate Khas Senayan 30 Oct, 20:10 -Rp 128.000

    Total balance

    Rp 12.480.000

    Recent transactions

    • Kopi KenanganToday, 08:12-Rp 32.000
    • SalaryToday, 07:00+Rp 9.500.000
    • GoRideYesterday, 18:40-Rp 18.500
    • TokopediaYesterday, 13:05-Rp 245.000
    • Electricity token3 Nov, 20:15-Rp 200.000
    • Transfer from Rina3 Nov, 09:30+Rp 150.000
    • Indomaret2 Nov, 19:02-Rp 67.800
    • Netflix1 Nov, 00:01-Rp 54.000
    • Freelance invoice31 Oct, 16:45+Rp 2.750.000
    • Sate Khas Senayan30 Oct, 20:10-Rp 128.000

    Total balance

    Rp 12.480.000

    Recent transactions

    • Kopi KenanganToday, 08:12-Rp 32.000
    • SalaryToday, 07:00+Rp 9.500.000
    • GoRideYesterday, 18:40-Rp 18.500
    • TokopediaYesterday, 13:05-Rp 245.000
    • Electricity token3 Nov, 20:15-Rp 200.000
    • Transfer from Rina3 Nov, 09:30+Rp 150.000
    • Indomaret2 Nov, 19:02-Rp 67.800
    • Netflix1 Nov, 00:01-Rp 54.000
    • Freelance invoice31 Oct, 16:45+Rp 2.750.000
    • Sate Khas Senayan30 Oct, 20:10-Rp 128.000

    Total balance

    Rp 12.480.000

    Recent transactions

    • Kopi Kenangan Today, 08:12 -Rp 32.000
    • Salary Today, 07:00 +Rp 9.500.000
    • GoRide Yesterday, 18:40 -Rp 18.500
    • Tokopedia Yesterday, 13:05 -Rp 245.000
    • Electricity token 3 Nov, 20:15 -Rp 200.000
    • Transfer from Rina 3 Nov, 09:30 +Rp 150.000
    • Indomaret 2 Nov, 19:02 -Rp 67.800
    • Netflix 1 Nov, 00:01 -Rp 54.000
    • Freelance invoice 31 Oct, 16:45 +Rp 2.750.000
    • Sate Khas Senayan 30 Oct, 20:10 -Rp 128.000

    Total balance

    Rp 12.480.000

    Recent transactions

    • Kopi KenanganToday, 08:12-Rp 32.000
    • SalaryToday, 07:00+Rp 9.500.000
    • GoRideYesterday, 18:40-Rp 18.500
    • TokopediaYesterday, 13:05-Rp 245.000
    • Electricity token3 Nov, 20:15-Rp 200.000
    • Transfer from Rina3 Nov, 09:30+Rp 150.000
    • Indomaret2 Nov, 19:02-Rp 67.800
    • Netflix1 Nov, 00:01-Rp 54.000
    • Freelance invoice31 Oct, 16:45+Rp 2.750.000
    • Sate Khas Senayan30 Oct, 20:10-Rp 128.000
    @php
        $items = [
            ['value' => 'home', 'label' => 'Home', 'icon' => 'M3 10.5 12 3l9 7.5V20a1 1 0 0 1-1 1h-5v-6H9v6H4a1 1 0 0 1-1-1z'],
            ['value' => 'activity', 'label' => 'Activity', 'icon' => 'M3 3v18h18M7 15l4-4 3 3 5-6'],
            ['value' => 'cards', 'label' => 'Cards', '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 10h18M7 15h3'],
            ['value' => 'profile', 'label' => 'Profile', 'icon' => 'M12 12a4 4 0 1 0 0-8 4 4 0 0 0 0 8zM4 21a8 8 0 0 1 16 0'],
        ];
        $transactions = [
            ['Kopi Kenangan', 'Today, 08:12', '-Rp 32.000'],
            ['Salary', 'Today, 07:00', '+Rp 9.500.000'],
            ['GoRide', 'Yesterday, 18:40', '-Rp 18.500'],
            ['Tokopedia', 'Yesterday, 13:05', '-Rp 245.000'],
            ['Electricity token', '3 Nov, 20:15', '-Rp 200.000'],
            ['Transfer from Rina', '3 Nov, 09:30', '+Rp 150.000'],
            ['Indomaret', '2 Nov, 19:02', '-Rp 67.800'],
            ['Netflix', '1 Nov, 00:01', '-Rp 54.000'],
            ['Freelance invoice', '31 Oct, 16:45', '+Rp 2.750.000'],
            ['Sate Khas Senayan', '30 Oct, 20:10', '-Rp 128.000'],
        ];
    @endphp
    
    <div class="relative mx-auto h-[560px] w-full max-w-[360px] overflow-hidden rounded-[2.5rem] border border-line bg-surface">
        <div role="region" aria-label="Transactions" tabindex="0" class="h-full overflow-y-auto px-5 pt-8 pb-28 focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-primary">
            <p class="text-sm text-muted">Total balance</p>
            <p class="mt-1 text-3xl font-semibold text-ink tabular-nums">Rp 12.480.000</p>
            <p class="mt-8 mb-1 text-sm font-medium text-ink">Recent transactions</p>
            <ul class="divide-y divide-line">
                @foreach ($transactions as [$name, $time, $amount])
                    <li class="flex items-center justify-between py-3">
                        <span class="grid">
                            <span class="text-sm font-medium text-ink">{{ $name }}</span>
                            <span class="text-xs text-muted">{{ $time }}</span>
                        </span>
                        <span class="text-sm font-medium text-ink tabular-nums">{{ $amount }}</span>
                    </li>
                @endforeach
            </ul>
        </div>
        <x-markas.bottom-navigation :items="$items" shrink-on-scroll class="absolute inset-x-4 bottom-4" />
    </div>
    import { BottomNavigation } from "@/components/markas/BottomNavigation";
    
    const items = [
      {
        value: "home",
        label: "Home",
        icon: "M3 10.5 12 3l9 7.5V20a1 1 0 0 1-1 1h-5v-6H9v6H4a1 1 0 0 1-1-1z",
      },
      { value: "activity", label: "Activity", icon: "M3 3v18h18M7 15l4-4 3 3 5-6" },
      {
        value: "cards",
        label: "Cards",
        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 10h18M7 15h3",
      },
      {
        value: "profile",
        label: "Profile",
        icon: "M12 12a4 4 0 1 0 0-8 4 4 0 0 0 0 8zM4 21a8 8 0 0 1 16 0",
      },
    ];
    
    const transactions = [
      ["Kopi Kenangan", "Today, 08:12", "-Rp 32.000"],
      ["Salary", "Today, 07:00", "+Rp 9.500.000"],
      ["GoRide", "Yesterday, 18:40", "-Rp 18.500"],
      ["Tokopedia", "Yesterday, 13:05", "-Rp 245.000"],
      ["Electricity token", "3 Nov, 20:15", "-Rp 200.000"],
      ["Transfer from Rina", "3 Nov, 09:30", "+Rp 150.000"],
      ["Indomaret", "2 Nov, 19:02", "-Rp 67.800"],
      ["Netflix", "1 Nov, 00:01", "-Rp 54.000"],
      ["Freelance invoice", "31 Oct, 16:45", "+Rp 2.750.000"],
      ["Sate Khas Senayan", "30 Oct, 20:10", "-Rp 128.000"],
    ];
    
    export default function BottomNavigationExample() {
      return (
        <div className="relative mx-auto h-[560px] w-full max-w-[360px] overflow-hidden rounded-[2.5rem] border border-line bg-surface">
          <div
            role="region"
            aria-label="Transactions"
            tabIndex={0}
            className="h-full overflow-y-auto px-5 pt-8 pb-28 focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-primary"
          >
            <p className="text-sm text-muted">Total balance</p>
            <p className="mt-1 text-3xl font-semibold text-ink tabular-nums">
              Rp 12.480.000
            </p>
            <p className="mt-8 mb-1 text-sm font-medium text-ink">
              Recent transactions
            </p>
            <ul className="divide-y divide-line">
              {transactions.map(([name, time, amount]) => (
                <li key={name} className="flex items-center justify-between py-3">
                  <span className="grid">
                    <span className="text-sm font-medium text-ink">{name}</span>
                    <span className="text-xs text-muted">{time}</span>
                  </span>
                  <span className="text-sm font-medium text-ink tabular-nums">
                    {amount}
                  </span>
                </li>
              ))}
            </ul>
          </div>
          <BottomNavigation
            items={items}
            shrinkOnScroll
            className="absolute inset-x-4 bottom-4"
          />
        </div>
      );
    }
    <script setup lang="ts">
    import BottomNavigation from "@/components/markas/BottomNavigation.vue";
    
    const items = [
      {
        value: "home",
        label: "Home",
        icon: "M3 10.5 12 3l9 7.5V20a1 1 0 0 1-1 1h-5v-6H9v6H4a1 1 0 0 1-1-1z",
      },
      { value: "activity", label: "Activity", icon: "M3 3v18h18M7 15l4-4 3 3 5-6" },
      {
        value: "cards",
        label: "Cards",
        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 10h18M7 15h3",
      },
      {
        value: "profile",
        label: "Profile",
        icon: "M12 12a4 4 0 1 0 0-8 4 4 0 0 0 0 8zM4 21a8 8 0 0 1 16 0",
      },
    ];
    
    const transactions = [
      ["Kopi Kenangan", "Today, 08:12", "-Rp 32.000"],
      ["Salary", "Today, 07:00", "+Rp 9.500.000"],
      ["GoRide", "Yesterday, 18:40", "-Rp 18.500"],
      ["Tokopedia", "Yesterday, 13:05", "-Rp 245.000"],
      ["Electricity token", "3 Nov, 20:15", "-Rp 200.000"],
      ["Transfer from Rina", "3 Nov, 09:30", "+Rp 150.000"],
      ["Indomaret", "2 Nov, 19:02", "-Rp 67.800"],
      ["Netflix", "1 Nov, 00:01", "-Rp 54.000"],
      ["Freelance invoice", "31 Oct, 16:45", "+Rp 2.750.000"],
      ["Sate Khas Senayan", "30 Oct, 20:10", "-Rp 128.000"],
    ];
    </script>
    
    <template>
      <div
        class="relative mx-auto h-[560px] w-full max-w-[360px] overflow-hidden rounded-[2.5rem] border border-line bg-surface"
      >
        <div
          role="region"
          aria-label="Transactions"
          tabindex="0"
          class="h-full overflow-y-auto px-5 pt-8 pb-28 focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-primary"
        >
          <p class="text-sm text-muted">Total balance</p>
          <p class="mt-1 text-3xl font-semibold text-ink tabular-nums">
            Rp 12.480.000
          </p>
          <p class="mt-8 mb-1 text-sm font-medium text-ink">Recent transactions</p>
          <ul class="divide-y divide-line">
            <li
              v-for="[name, time, amount] in transactions"
              :key="name"
              class="flex items-center justify-between py-3"
            >
              <span class="grid">
                <span class="text-sm font-medium text-ink">{{ name }}</span>
                <span class="text-xs text-muted">{{ time }}</span>
              </span>
              <span class="text-sm font-medium text-ink tabular-nums">{{
                amount
              }}</span>
            </li>
          </ul>
        </div>
        <BottomNavigation
          :items="items"
          shrink-on-scroll
          class="absolute inset-x-4 bottom-4"
        />
      </div>
    </template>
    <script lang="ts">
      import BottomNavigation from "$lib/components/markas/BottomNavigation.svelte";
    
      const items = [
        {
          value: "home",
          label: "Home",
          icon: "M3 10.5 12 3l9 7.5V20a1 1 0 0 1-1 1h-5v-6H9v6H4a1 1 0 0 1-1-1z",
        },
        {
          value: "activity",
          label: "Activity",
          icon: "M3 3v18h18M7 15l4-4 3 3 5-6",
        },
        {
          value: "cards",
          label: "Cards",
          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 10h18M7 15h3",
        },
        {
          value: "profile",
          label: "Profile",
          icon: "M12 12a4 4 0 1 0 0-8 4 4 0 0 0 0 8zM4 21a8 8 0 0 1 16 0",
        },
      ];
    
      const transactions = [
        ["Kopi Kenangan", "Today, 08:12", "-Rp 32.000"],
        ["Salary", "Today, 07:00", "+Rp 9.500.000"],
        ["GoRide", "Yesterday, 18:40", "-Rp 18.500"],
        ["Tokopedia", "Yesterday, 13:05", "-Rp 245.000"],
        ["Electricity token", "3 Nov, 20:15", "-Rp 200.000"],
        ["Transfer from Rina", "3 Nov, 09:30", "+Rp 150.000"],
        ["Indomaret", "2 Nov, 19:02", "-Rp 67.800"],
        ["Netflix", "1 Nov, 00:01", "-Rp 54.000"],
        ["Freelance invoice", "31 Oct, 16:45", "+Rp 2.750.000"],
        ["Sate Khas Senayan", "30 Oct, 20:10", "-Rp 128.000"],
      ];
    </script>
    
    <div
      class="relative mx-auto h-[560px] w-full max-w-[360px] overflow-hidden rounded-[2.5rem] border border-line bg-surface"
    >
      <!-- svelte-ignore a11y_no_noninteractive_tabindex -->
      <div
        role="region"
        aria-label="Transactions"
        tabindex="0"
        class="h-full overflow-y-auto px-5 pt-8 pb-28 focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-primary"
      >
        <p class="text-sm text-muted">Total balance</p>
        <p class="mt-1 text-3xl font-semibold text-ink tabular-nums">
          Rp 12.480.000
        </p>
        <p class="mt-8 mb-1 text-sm font-medium text-ink">Recent transactions</p>
        <ul class="divide-y divide-line">
          {#each transactions as [name, time, amount] (name)}
            <li class="flex items-center justify-between py-3">
              <span class="grid">
                <span class="text-sm font-medium text-ink">{name}</span>
                <span class="text-xs text-muted">{time}</span>
              </span>
              <span class="text-sm font-medium text-ink tabular-nums">{amount}</span
              >
            </li>
          {/each}
        </ul>
      </div>
      <BottomNavigation
        {items}
        shrinkOnScroll
        class="absolute inset-x-4 bottom-4"
      />
    </div>
    ---
    import BottomNavigation from "@/components/markas/BottomNavigation.astro";
    
    const items = [
      {
        value: "home",
        label: "Home",
        icon: "M3 10.5 12 3l9 7.5V20a1 1 0 0 1-1 1h-5v-6H9v6H4a1 1 0 0 1-1-1z",
      },
      { value: "activity", label: "Activity", icon: "M3 3v18h18M7 15l4-4 3 3 5-6" },
      {
        value: "cards",
        label: "Cards",
        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 10h18M7 15h3",
      },
      {
        value: "profile",
        label: "Profile",
        icon: "M12 12a4 4 0 1 0 0-8 4 4 0 0 0 0 8zM4 21a8 8 0 0 1 16 0",
      },
    ];
    
    const transactions = [
      ["Kopi Kenangan", "Today, 08:12", "-Rp 32.000"],
      ["Salary", "Today, 07:00", "+Rp 9.500.000"],
      ["GoRide", "Yesterday, 18:40", "-Rp 18.500"],
      ["Tokopedia", "Yesterday, 13:05", "-Rp 245.000"],
      ["Electricity token", "3 Nov, 20:15", "-Rp 200.000"],
      ["Transfer from Rina", "3 Nov, 09:30", "+Rp 150.000"],
      ["Indomaret", "2 Nov, 19:02", "-Rp 67.800"],
      ["Netflix", "1 Nov, 00:01", "-Rp 54.000"],
      ["Freelance invoice", "31 Oct, 16:45", "+Rp 2.750.000"],
      ["Sate Khas Senayan", "30 Oct, 20:10", "-Rp 128.000"],
    ];
    ---
    
    <div
      class="relative mx-auto h-[560px] w-full max-w-[360px] overflow-hidden rounded-[2.5rem] border border-line bg-surface"
    >
      <div
        role="region"
        aria-label="Transactions"
        tabindex="0"
        class="h-full overflow-y-auto px-5 pt-8 pb-28 focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-primary"
      >
        <p class="text-sm text-muted">Total balance</p>
        <p class="mt-1 text-3xl font-semibold text-ink tabular-nums">Rp 12.480.000</p>
        <p class="mt-8 mb-1 text-sm font-medium text-ink">Recent transactions</p>
        <ul class="divide-y divide-line">
          {
            transactions.map(([name, time, amount]) => (
              <li class="flex items-center justify-between py-3">
                <span class="grid">
                  <span class="text-sm font-medium text-ink">{name}</span>
                  <span class="text-xs text-muted">{time}</span>
                </span>
                <span class="text-sm font-medium text-ink tabular-nums">{amount}</span>
              </li>
            ))
          }
        </ul>
      </div>
      <BottomNavigation items={items} shrinkOnScroll class="absolute inset-x-4 bottom-4" />
    </div>
    import { Component } from "@angular/core";
    import { BottomNavigation } from "./markas/bottom-navigation.component";
    
    @Component({
      selector: "markas-example",
      imports: [BottomNavigation],
      template: `
        <div
          class="relative mx-auto h-[560px] w-full max-w-[360px] overflow-hidden rounded-[2.5rem] border border-line bg-surface"
        >
          <div
            role="region"
            aria-label="Transactions"
            tabindex="0"
            class="h-full overflow-y-auto px-5 pt-8 pb-28 focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-primary"
          >
            <p class="text-sm text-muted">Total balance</p>
            <p class="mt-1 text-3xl font-semibold text-ink tabular-nums">
              Rp 12.480.000
            </p>
            <p class="mt-8 mb-1 text-sm font-medium text-ink">
              Recent transactions
            </p>
            <ul class="divide-y divide-line">
              @for (row of transactions; track row[0]) {
                <li class="flex items-center justify-between py-3">
                  <span class="grid">
                    <span class="text-sm font-medium text-ink">{{ row[0] }}</span>
                    <span class="text-xs text-muted">{{ row[1] }}</span>
                  </span>
                  <span class="text-sm font-medium text-ink tabular-nums">{{
                    row[2]
                  }}</span>
                </li>
              }
            </ul>
          </div>
          <markas-bottom-navigation
            [items]="items"
            shrinkOnScroll
            class="absolute inset-x-4 bottom-4"
          />
        </div>
      `,
    })
    export default class BottomNavigationExample {
      protected readonly items = [
        {
          value: "home",
          label: "Home",
          icon: "M3 10.5 12 3l9 7.5V20a1 1 0 0 1-1 1h-5v-6H9v6H4a1 1 0 0 1-1-1z",
        },
        {
          value: "activity",
          label: "Activity",
          icon: "M3 3v18h18M7 15l4-4 3 3 5-6",
        },
        {
          value: "cards",
          label: "Cards",
          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 10h18M7 15h3",
        },
        {
          value: "profile",
          label: "Profile",
          icon: "M12 12a4 4 0 1 0 0-8 4 4 0 0 0 0 8zM4 21a8 8 0 0 1 16 0",
        },
      ];
    
      protected readonly transactions = [
        ["Kopi Kenangan", "Today, 08:12", "-Rp 32.000"],
        ["Salary", "Today, 07:00", "+Rp 9.500.000"],
        ["GoRide", "Yesterday, 18:40", "-Rp 18.500"],
        ["Tokopedia", "Yesterday, 13:05", "-Rp 245.000"],
        ["Electricity token", "3 Nov, 20:15", "-Rp 200.000"],
        ["Transfer from Rina", "3 Nov, 09:30", "+Rp 150.000"],
        ["Indomaret", "2 Nov, 19:02", "-Rp 67.800"],
        ["Netflix", "1 Nov, 00:01", "-Rp 54.000"],
        ["Freelance invoice", "31 Oct, 16:45", "+Rp 2.750.000"],
        ["Sate Khas Senayan", "30 Oct, 20:10", "-Rp 128.000"],
      ];
    }

    Contoh

    Dengan tombol aksi

    Moments

    Moments

    Moments

    Moments

    Moments

    Badge

    Link

    Orders

    2 parcels on the way to Bandung

    Orders

    2 parcels on the way to Bandung

    Orders

    2 parcels on the way to Bandung

    Orders

    2 parcels on the way to Bandung

    Orders

    2 parcels on the way to Bandung

    Instalasi

    npx markasui@latest add bottom-navigation

    Pemakaian

    <div class="relative h-dvh overflow-hidden">
        <main class="h-full overflow-y-auto pb-28">...</main>
        <x-markas.bottom-navigation
            shrink-on-scroll
            default-value="beranda"
            nav-label="Navigasi utama"
            action-label="Transfer baru"
            badge-label="{count} baru"
            class="absolute inset-x-4 bottom-4"
            :items="[
                ['value' => 'beranda', 'label' => 'Beranda', 'icon' => 'M3 10.5 12 3l9 7.5V20a1 1 0 0 1-1 1h-5v-6H9v6H4a1 1 0 0 1-1-1z'],
                ['value' => 'aktivitas', 'label' => 'Aktivitas', 'icon' => 'M3 3v18h18M7 15l4-4 3 3 5-6', 'badge' => 2],
                ['value' => 'profil', 'label' => 'Profil', 'href' => '/profil', 'icon' => 'M12 12a4 4 0 1 0 0-8 4 4 0 0 0 0 8zM4 21a8 8 0 0 1 16 0'],
            ]"
        >
            <x-slot:action>
                <svg class="size-6" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" aria-hidden="true"><path d="M12 5v14M5 12h14" /></svg>
            </x-slot:action>
        </x-markas.bottom-navigation>
    </div>
    import { BottomNavigation } from "@/components/markas/BottomNavigation";
    
    const [tab, setTab] = useState("beranda");
    
    <BottomNavigation
      items={items}
      value={tab}
      onValueChange={setTab}
      shrinkOnScroll
      navLabel="Navigasi utama"
      badgeLabel="{count} baru"
      action={<PlusIcon className="size-6" />}
      actionLabel="Transfer baru"
      onAction={bukaTransfer}
      className="absolute inset-x-4 bottom-4"
    />;
    <script setup lang="ts">
    import { ref } from "vue";
    import BottomNavigation from "@/components/markas/BottomNavigation.vue";
    
    const tab = ref("beranda");
    </script>
    
    <template>
      <BottomNavigation
        v-model="tab"
        :items="items"
        shrink-on-scroll
        nav-label="Navigasi utama"
        action-label="Transfer baru"
        badge-label="{count} baru"
        class="absolute inset-x-4 bottom-4"
        @action="bukaTransfer"
      >
        <template #action><PlusIcon class="size-6" /></template>
      </BottomNavigation>
    </template>
    <script lang="ts">
      import BottomNavigation from "$lib/components/markas/BottomNavigation.svelte";
    
      let tab = $state("home");
    </script>
    
    <BottomNavigation
      {items}
      bind:value={tab}
      shrinkOnScroll
      actionLabel="New transfer"
      onaction={openTransfer}
      class="absolute inset-x-4 bottom-4"
    >
      {#snippet action()}
        <PlusIcon class="size-6" />
      {/snippet}
    </BottomNavigation>

    Tombol aksi hanya dirender kalau snippet action diisi.

    ---
    import BottomNavigation from "@/components/markas/BottomNavigation.astro";
    ---
    
    <BottomNavigation
      items={items}
      defaultValue="home"
      shrinkOnScroll
      actionLabel="New transfer"
      class="absolute inset-x-4 bottom-4"
    >
      <PlusIcon slot="action" class="size-6" />
    </BottomNavigation>

    Custom element kecil menggeser pill dan mengecilkan bar. Ia mengirim markas-change (value sebagai detail) dan markas-action, keduanya menggelembung.

    import { Component, signal } from "@angular/core";
    import { BottomNavigation } from "./markas/bottom-navigation.component";
    
    @Component({
      selector: "app-wallet-nav",
      imports: [BottomNavigation],
      template: `
        <markas-bottom-navigation
          [items]="items"
          [(value)]="tab"
          shrinkOnScroll
          actionLabel="New transfer"
          (action)="openTransfer()"
          class="absolute inset-x-4 bottom-4"
        >
          <svg action class="size-6" viewBox="0 0 24 24" aria-hidden="true">
            <path d="M12 5v14M5 12h14" stroke="currentColor" />
          </svg>
        </markas-bottom-navigation>
      `,
    })
    export class WalletNav {
      items = [{ value: "home", label: "Home", icon: "M3 10.5 12 3l9 7.5V20H3z" }];
      tab = signal("home");
      openTransfer() {}
    }

    Elemen dengan atribut action mengisi tombol aksi bulat.

    • Letakkan bar di dalam elemen yang discroll (atau di sebelahnya, dalam induk yang sama). shrinkOnScroll mendengarkan scroll di dalam elemen induk bar dan di halaman.
    • Beri konten yang discroll padding bawah (sekitar pb-28) agar baris terakhir tidak tertutup bar.
    • Pill dan label murni CSS berdasarkan indeks terpilih, jadi render pertama di server sudah menampilkan keadaan yang benar.
    • Item dengan href tetap link sungguhan. Menekannya tetap memindahkan pill untuk aplikasi satu halaman.

    Props

    NamaTipeDefaultKeterangan
    items{ value: string; label: string; icon: string; href?: string; badge?: number | string }[][]Daftar tujuan. icon adalah atribut d path SVG 24x24 bergaris. Item dengan href menjadi link, sisanya tombol.
    value / v-modelstring-Item terpilih yang dikendalikan di React (dengan onValueChange) dan Vue (v-model).
    defaultValuestringfirst itemItem terpilih saat render pertama.
    onValueChange / x-on:change(value: string) => void-Dipicu saat item dipilih. Blade mengirim event DOM change dengan value sebagai detail.
    shrinkOnScrollbooleanfalseMenciut jadi ikon saat konten di sekitar bar (elemen induk atau halaman) discroll turun, kembali saat scroll naik.
    action / #action / x-slot:actionReactNode | slot-Ikon untuk tombol aksi bulat di samping bar. Tombol hanya muncul bila ini diisi.
    onAction / @action / x-on:action() => void-Dipicu saat tombol aksi ditekan.
    navLabelstringMainNama aksesibel elemen nav.
    actionLabelstringCreateNama aksesibel tombol aksi.
    badgeLabelstring{count} newTeks tersembunyi yang dibacakan setelah item ber-badge. {count} diganti isi badge.
    bind:valuestring-Khusus Svelte. Binding dua arah item aktif. Svelte juga menerima onValueChange, onaction, dan snippet action.
    [(value)] / (action)model<string> / output<void>-Khusus Angular. Item aktif dengan binding dua arah, dan tekanan tombol aksi. Elemen dengan atribut action mengisi tombolnya.
    markas-change / markas-actionCustomEvent-Khusus Astro. Event menggelembung dari markas-bottom-navigation: value terpilih sebagai detail, dan tekanan tombol aksi (slot="action").

    Aksesibilitas

    • Bar adalah landmark nav bernama navLabel, berisi daftar link atau tombol sesuai urutan tab.
    • Item terpilih memakai aria-current="page". Setiap label tetap menjadi nama aksesibel walau sedang disembunyikan secara visual.
    • Badge disembunyikan dari screen reader dan dibacakan lewat badgeLabel.
    • Dengan reduced motion, pill dan label berganti tanpa gerakan.

    Komponen terkait

    Komponen markasui lain dengan class yang sama di setiap framework.