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
Contoh
Dengan tombol aksi
Moments
Moments
Moments
Moments
Moments
Badge
@php
$items = [
['value' => 'chats', 'label' => 'Chats', 'icon' => 'M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z', 'badge' => 3],
['value' => 'calls', 'label' => 'Calls', 'icon' => 'M22 16.9v3a2 2 0 0 1-2.2 2 19.8 19.8 0 0 1-8.6-3.1 19.5 19.5 0 0 1-6-6A19.8 19.8 0 0 1 2.1 4.2 2 2 0 0 1 4.1 2h3a2 2 0 0 1 2 1.7c.1 1 .4 1.9.7 2.8a2 2 0 0 1-.5 2.1L8 9.9a16 16 0 0 0 6 6l1.3-1.3a2 2 0 0 1 2.1-.4c.9.3 1.8.6 2.8.7a2 2 0 0 1 1.7 2z'],
['value' => 'updates', 'label' => 'Updates', 'icon' => 'M6 8a6 6 0 1 1 12 0c0 7 3 9 3 9H3s3-2 3-9M10.3 21a1.94 1.94 0 0 0 3.4 0', 'badge' => 12],
['value' => 'settings', 'label' => 'Settings', 'icon' => 'M4 6h10M18 6h2M4 12h4M12 12h8M4 18h12M20 18h0M16 4v4M10 10v4M18 16v4'],
];
@endphp
<div class="rounded-2xl bg-subtle p-6">
<x-markas.bottom-navigation :items="$items" default-value="updates" />
</div>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-navigationpnpm dlx markasui@latest add bottom-navigationyarn dlx markasui@latest add bottom-navigationbunx --bun markasui@latest add bottom-navigation- Pastikan Tailwind CSS v4 dan markas.css sudah terpasang. Lihat Instalasi.
- Pasang dependensi:
npm install alpinejs - Salin source komponen di bawah ini ke
resources/views/components/markas/bottom-navigation.blade.php.
- Pastikan Tailwind CSS v4 dan markas.css sudah terpasang. Lihat Instalasi.
- Salin source komponen di bawah ini ke
src/components/markas/BottomNavigation.tsx.
- Pastikan Tailwind CSS v4 dan markas.css sudah terpasang. Lihat Instalasi.
- Salin source komponen di bawah ini ke
src/components/markas/BottomNavigation.vue.
- Pastikan Tailwind CSS v4 dan markas.css sudah terpasang. Lihat Instalasi.
- Salin source komponen di bawah ini ke
src/lib/components/markas/BottomNavigation.svelte.
- Pastikan Tailwind CSS v4 dan markas.css sudah terpasang. Lihat Instalasi.
- Salin source komponen di bawah ini ke
src/components/markas/BottomNavigation.astro.
- Pastikan Tailwind CSS v4 dan markas.css sudah terpasang. Lihat Instalasi.
- Salin source komponen di bawah ini ke
src/app/markas/bottom-navigation.component.ts.
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
| Nama | Tipe | Default | Keterangan |
|---|---|---|---|
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-model | string | - | Item terpilih yang dikendalikan di React (dengan onValueChange) dan Vue (v-model). |
defaultValue | string | first item | Item terpilih saat render pertama. |
onValueChange / x-on:change | (value: string) => void | - | Dipicu saat item dipilih. Blade mengirim event DOM change dengan value sebagai detail. |
shrinkOnScroll | boolean | false | Menciut jadi ikon saat konten di sekitar bar (elemen induk atau halaman) discroll turun, kembali saat scroll naik. |
action / #action / x-slot:action | ReactNode | 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. |
navLabel | string | Main | Nama aksesibel elemen nav. |
actionLabel | string | Create | Nama aksesibel tombol aksi. |
badgeLabel | string | {count} new | Teks tersembunyi yang dibacakan setelah item ber-badge. {count} diganti isi badge. |
bind:value | string | - | 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-action | CustomEvent | - | 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.
- Card StackTumpukan kartu bertingkat. Geser, tombol panah, atau tombol navigasi membuang kartu teratas lalu kartu berikutnya naik. Berputar, dengan indikator posisi.
- Chat MessagePesan dalam percakapan AI. Gelembung user di kanan, balasan asisten dengan avatar, aksi saat hover, indikator mengetik, dan efek streaming token opsional.
- Currency InputKolom uang yang memformat saat mengetik (Rp 12.500.000), menjaga posisi kursor, dan mengirim angka murni. Opsional chip nominal cepat.
- DockDock ala macOS. Ikon membesar halus mengikuti kursor atau fokus, label muncul di atas, item terbuka bertitik, dan memantul saat dibuka.
- Drag ElementsArea kartu atau stiker yang bisa diseret dengan momentum ringan di dalam batasnya. Panah menggeser item yang fokus, Escape mengembalikannya.
- Dynamic IslandPill hitam terinspirasi Dynamic Island iPhone. Memuai mulus antara keadaan idle, compact, dan expanded sambil kontennya crossfade.