Aplikasi mobile
Kerangka aplikasi mobile adalah versi HP dari Dasbor: judul, pencarian, dan tujuan utama ada di tempat yang sama di setiap aplikasi Sosialoka, dari Cover Clearance sampai My Loka Link.
Kapan dipakai
Section titled “Kapan dipakai”- Pakai untuk setiap layar aplikasi HP setelah masuk, dan untuk aplikasi web di HP.
- Taruh list, detail, dan form di dalamnya. Jangan membuat header atau navigasi kedua.
Anatomi
Section titled “Anatomi”- Top bar: tinggi 56px, dengan judul layar di kiri dan maksimal dua tombol ikon di kanan, misalnya notifikasi. Kolom pencarian opsional ada di bawahnya.
- Konten: layarnya, berlatar
background, dengan ruang di bawah supaya item terakhir tidak tertutup bottom nav. - Bottom nav: 3 sampai 5 tujuan, masing-masing ikon di atas label. Tujuan saat ini berwarna
primary, tanpa pil di belakangnya.
Aturan
Section titled “Aturan”- Top bar hanya berisi judul, dua tombol ikon, dan pencarian. Sapaan, kartu ringkasan, tab, dan filter masuk ke konten di bawahnya.
- Beranda: sapaan, judul kartu unggulan, dan angka utama di bagian atas boleh memakai
font-brand; selebihnya tetapfont-sans. Lihat Momen brand. - Bottom nav: 3 sampai 5 tujuan, label selalu tampil, target setinggi minimal 48px. Taruh Akun paling akhir.
- Urutkan dan filter membuka Drawer dari bawah, bukan halaman.
- Baris memakai Item; status ditaruh di Badge pada barisnya.
- Safe area: top bar dan bottom nav menjauhi notch dan garis home (
env(safe-area-inset-*)).
| React | Vue | Flutter | Tipe | Default | Kegunaan |
|---|---|---|---|---|---|
title |
title |
Text |
teks | tidak ada | Judul layar. |
nav |
nav |
Row berisi tombol ikon dan label |
{ title, href, icon, active? }[] |
tidak ada | Bottom nav. |
actions |
slot #actions |
ShadIconButton.ghost |
elemen | tidak ada | Maksimal dua tombol ikon di top bar. |
search |
slot #search |
ShadInput |
elemen | tidak ada | Pencarian opsional di bawah judul. |
labels |
labels |
Semantics |
{ nav } |
bahasa Inggris | Nama bottom nav untuk pembaca layar, misalnya “Navigasi utama”. |
children |
slot bawaan | anak Expanded |
elemen | tidak ada | Isi layar. |
import { useId } from "react"import { BarChart3Icon, BellIcon, DiscIcon, HomeIcon, SearchIcon, UserIcon } from "lucide-react"import { MobileShell } from "@/components/blocks/mobile-shell"import { Badge } from "@/components/ui/badge"import { Button } from "@/components/ui/button"import { Drawer, DrawerClose, DrawerContent, DrawerFooter, DrawerHeader, DrawerTitle, DrawerTrigger,} from "@/components/ui/drawer"import { InputGroup, InputGroupAddon, InputGroupInput } from "@/components/ui/input-group"import { Item, ItemContent, ItemDescription, ItemGroup, ItemTitle } from "@/components/ui/item"import { Label } from "@/components/ui/label"import { RadioGroup, RadioGroupItem } from "@/components/ui/radio-group"
const nav = [ { title: "Beranda", href: "#", icon: HomeIcon }, { title: "Rilis", href: "#rilis", icon: DiscIcon, active: true }, { title: "Royalti", href: "#royalti", icon: BarChart3Icon }, { title: "Notifikasi", href: "#notifikasi", icon: BellIcon }, { title: "Akun", href: "#akun", icon: UserIcon },]
const releases = [ { title: "Senja di Kota", artist: "Rara Senandika", status: "success", label: "Terbit" }, { title: "Kaset Pertama", artist: "Bima Laras", status: "warning", label: "Menunggu" }, { title: "Pulang Sore", artist: "Nada Kirana", status: "info", label: "Dijadwalkan" }, { title: "Hujan Bulan Juni", artist: "Arka Wening", status: "success", label: "Terbit" }, { title: "Lampu Kota", artist: "Sinta Maharani", status: "destructive", label: "Ditolak" }, { title: "Jalan Pulang", artist: "Raka Pratama", status: "success", label: "Terbit" },] as const
export default function MobileShellDemo() { const id = useId() return ( <MobileShell title="Rilis" nav={nav} labels={{ nav: "Navigasi utama" }} actions={ <Button variant="ghost" size="icon-lg" className="size-11" aria-label="Notifikasi"> <BellIcon /> </Button> } search={ <InputGroup> <InputGroupAddon> <SearchIcon /> </InputGroupAddon> <InputGroupInput type="search" aria-label="Cari rilis" placeholder="Cari judul atau artis" /> </InputGroup> } > <div className="mb-3 flex items-center justify-between"> <p className="text-sm text-muted-foreground">6 rilis</p> <Drawer> <DrawerTrigger render={<Button variant="outline" size="sm" />}>Urutkan</DrawerTrigger> <DrawerContent> <DrawerHeader> <DrawerTitle>Urutkan rilis</DrawerTitle> </DrawerHeader> <RadioGroup defaultValue="newest" aria-label="Urutan" className="px-4"> {[ ["newest", "Terbaru"], ["oldest", "Terlama"], ["title", "Judul A–Z"], ].map(([value, label]) => ( <div key={value} className="flex items-center gap-3"> <RadioGroupItem value={value} id={`${id}-${value}`} /> <Label htmlFor={`${id}-${value}`}>{label}</Label> </div> ))} </RadioGroup> <DrawerFooter> <DrawerClose render={<Button />}>Terapkan</DrawerClose> </DrawerFooter> </DrawerContent> </Drawer> </div> <ItemGroup className="gap-2"> {releases.map((r) => ( <Item key={r.title} variant="outline" render={<a href="#" />}> <ItemContent> <ItemTitle>{r.title}</ItemTitle> <ItemDescription>{r.artist}</ItemDescription> </ItemContent> <Badge variant={r.status}>{r.label}</Badge> </Item> ))} </ItemGroup> </MobileShell> )}<script setup lang="ts">import { useId } from "vue"import { BarChart3, Bell, Disc, Home, Search, User } from "@lucide/vue"import { MobileShell } from "@/components/blocks/mobile-shell"import { Badge } from "@/components/ui/badge"import { Button } from "@/components/ui/button"import { Drawer, DrawerClose, DrawerContent, DrawerFooter, DrawerHeader, DrawerTitle, DrawerTrigger } from "@/components/ui/drawer"import { InputGroup, InputGroupAddon, InputGroupInput } from "@/components/ui/input-group"import { Item, ItemContent, ItemDescription, ItemGroup, ItemTitle } from "@/components/ui/item"import { Label } from "@/components/ui/label"import { RadioGroup, RadioGroupItem } from "@/components/ui/radio-group"
const nav = [ { title: "Beranda", href: "#", icon: Home }, { title: "Rilis", href: "#rilis", icon: Disc, active: true }, { title: "Royalti", href: "#royalti", icon: BarChart3 }, { title: "Notifikasi", href: "#notifikasi", icon: Bell }, { title: "Akun", href: "#akun", icon: User },]
const releases = [ { title: "Senja di Kota", artist: "Rara Senandika", status: "success", label: "Terbit" }, { title: "Kaset Pertama", artist: "Bima Laras", status: "warning", label: "Menunggu" }, { title: "Pulang Sore", artist: "Nada Kirana", status: "info", label: "Dijadwalkan" }, { title: "Hujan Bulan Juni", artist: "Arka Wening", status: "success", label: "Terbit" }, { title: "Lampu Kota", artist: "Sinta Maharani", status: "destructive", label: "Ditolak" }, { title: "Jalan Pulang", artist: "Raka Pratama", status: "success", label: "Terbit" },] as const
const orders = [ { value: "newest", label: "Terbaru" }, { value: "oldest", label: "Terlama" }, { value: "title", label: "Judul A–Z" },]const id = useId()</script>
<template> <MobileShell title="Rilis" :nav="nav" :labels="{ nav: 'Navigasi utama' }"> <template #actions> <Button variant="ghost" size="icon-lg" class="size-11" aria-label="Notifikasi"> <Bell /> </Button> </template> <template #search> <InputGroup> <InputGroupAddon> <Search /> </InputGroupAddon> <InputGroupInput type="search" aria-label="Cari rilis" placeholder="Cari judul atau artis" /> </InputGroup> </template>
<div class="mb-3 flex items-center justify-between"> <p class="text-sm text-muted-foreground">6 rilis</p> <Drawer> <DrawerTrigger as-child> <Button variant="outline" size="sm">Urutkan</Button> </DrawerTrigger> <DrawerContent> <DrawerHeader> <DrawerTitle>Urutkan rilis</DrawerTitle> </DrawerHeader> <RadioGroup default-value="newest" aria-label="Urutan" class="px-4"> <div v-for="o in orders" :key="o.value" class="flex items-center gap-3"> <RadioGroupItem :id="`${id}-${o.value}`" :value="o.value" /> <Label :for="`${id}-${o.value}`">{{ o.label }}</Label> </div> </RadioGroup> <DrawerFooter> <DrawerClose as-child> <Button>Terapkan</Button> </DrawerClose> </DrawerFooter> </DrawerContent> </Drawer> </div> <ItemGroup class="gap-2"> <Item v-for="r in releases" :key="r.title" variant="outline" as-child> <a href="#"> <ItemContent> <ItemTitle>{{ r.title }}</ItemTitle> <ItemDescription>{{ r.artist }}</ItemDescription> </ItemContent> <Badge :variant="r.status">{{ r.label }}</Badge> </a> </Item> </ItemGroup> </MobileShell></template>// The phone app frame: a top bar with the title, one icon button and the search, the content, and a// bottom nav of five destinations. Greetings, summary cards, tabs and filters go in the content.import 'package:flutter/widgets.dart';import 'package:shadcn_ui/shadcn_ui.dart';
const mobileNav = [ (LucideIcons.house, 'Beranda'), (LucideIcons.disc, 'Rilis'), (LucideIcons.chartColumn, 'Royalti'), (LucideIcons.bell, 'Notifikasi'), (LucideIcons.user, 'Akun'),];
const mobileReleases = [ ('Senja di Kota', 'Rara Senandika', 'Terbit'), ('Kaset Pertama', 'Bima Laras', 'Menunggu'), ('Pulang Sore', 'Nada Kirana', 'Dijadwalkan'), ('Hujan Bulan Juni', 'Arka Wening', 'Terbit'), ('Lampu Kota', 'Sinta Maharani', 'Ditolak'), ('Jalan Pulang', 'Raka Pratama', 'Terbit'),];
class MobileShellDemo extends StatelessWidget { const MobileShellDemo({super.key, this.active = 1});
final int active;
@override Widget build(BuildContext context) { final theme = ShadTheme.of(context); final border = BorderSide(color: theme.colorScheme.border); return SizedBox( width: 390, height: 720, child: DecoratedBox( decoration: BoxDecoration(color: theme.colorScheme.background), child: Column( children: [ // Top bar: title, at most two icon buttons, then the search. DecoratedBox( decoration: BoxDecoration(border: Border(bottom: border)), child: Padding( padding: const EdgeInsets.fromLTRB(16, 0, 16, 12), child: Column( children: [ SizedBox( height: 56, child: Row( children: [ Expanded(child: Text('Rilis', style: theme.textTheme.large)), ShadIconButton.ghost( width: 44, height: 44, icon: const Icon(LucideIcons.bell, size: 20, semanticLabel: 'Notifikasi'), onPressed: () {}, ), ], ), ), const ShadInput( placeholder: Text('Cari judul atau artis'), leading: Icon(LucideIcons.search, size: 16), ), ], ), ), ), Expanded( child: ListView.separated( padding: const EdgeInsets.all(16), itemCount: mobileReleases.length, separatorBuilder: (_, _) => const SizedBox(height: 8), itemBuilder: (context, i) { final (title, artist, status) = mobileReleases[i]; // ShadItem's actions slot is narrow, so the status badge sits beside the title. return ShadItem.outline( title: Row(children: [Expanded(child: Text(title)), ShadBadge.secondary(child: Text(status))]), description: Text(artist), onPressed: () {}, ); }, ), ), // Bottom nav: icon above an always-visible label, 48px tall targets, the current page in primary. DecoratedBox( decoration: BoxDecoration(border: Border(top: border), color: theme.colorScheme.background), child: SafeArea( top: false, child: Row( children: [ for (var i = 0; i < mobileNav.length; i++) Expanded( child: Semantics( selected: i == active, button: true, child: GestureDetector( onTap: () {}, child: ConstrainedBox( constraints: const BoxConstraints(minHeight: 56), child: Column( mainAxisAlignment: MainAxisAlignment.center, spacing: 4, children: [ Icon( mobileNav[i].$1, size: 20, color: i == active ? theme.colorScheme.primary : theme.colorScheme.mutedForeground, ), Text( mobileNav[i].$2, maxLines: 1, overflow: TextOverflow.ellipsis, style: theme.textTheme.small.copyWith( fontSize: 12, color: i == active ? theme.colorScheme.primary : theme.colorScheme.mutedForeground, ), ), ], ), ), ), ), ), ], ), ), ), ], ), ), ); }}Pasang
Section titled “Pasang”npx shadcn@latest add https://design.sosialoka.tech/r/react/mobile-shell.jsonnpx shadcn-vue@latest add https://design.sosialoka.tech/r/vue/mobile-shell.jsonBlok ini masuk ke components/blocks/. Pasang Item, Drawer, Badge, Input Group, Button, Label, dan Radio Group untuk isi yang ditampilkan di sini.
Flutter
Section titled “Flutter”Aplikasi Flutter membangun kerangka yang sama dari widget: Column berisi top bar, daftar ShadItem di dalam Expanded, dan baris tombol ikon dan label di dalam SafeArea. NavigationBar Material juga boleh dipakai asal mengikuti aturan yang sama: label selalu tampil, item saat ini berwarna primary, tanpa indikator pil.
Aksesibilitas
Section titled “Aksesibilitas”- Bottom nav berupa
navbernama “Main navigation” secara bawaan (“Navigasi utama” di contoh); tujuan saat ini punyaaria-current="page". - Setiap tujuan menampilkan labelnya, jadi tidak pernah hanya mengandalkan ikon.
- Tombol ikon di top bar punya nama, misalnya “Notifikasi”.
- Lonceng membuka halaman notifikasi, bukan popover: lihat Notifikasi.
