Mobile app
The mobile app frame is the phone version of the Dashboard: the same places for the title, the search and the main destinations in every Sosialoka app, from Cover Clearance to My Loka Link.
When to use
Section titled “When to use”- Use it for every signed-in screen of a phone app, and for a web app on phones.
- Put lists, details and forms inside it. Don’t build a second header or a second navigation.
Anatomy
Section titled “Anatomy”- Top bar: 56px tall, with the screen title on the left and at most two icon buttons on the right, such as notifications. An optional search field sits under it.
- Content: the screen, on
background, with room at the bottom so the last item is never hidden behind the bottom nav. - Bottom nav: 3 to 5 destinations, each an icon above a label. The current one is in
primary, without a pill behind it.
- Top bar holds the title, two icon buttons and the search, nothing else. Greetings, summary cards, tabs and filters go in the content below it.
- Home screen: the greeting, the featured card’s title and headline figures at the top may use
font-brand; everything else stays infont-sans. See Brand moments. - Bottom nav: 3 to 5 destinations, labels always shown, targets at least 48px tall. Put Account last.
- Sort and filter open a Drawer from the bottom, never a page.
- Rows use Item; a status goes in a Badge on the row.
- Safe areas: the top bar and the bottom nav keep clear of the notch and the home indicator (
env(safe-area-inset-*)).
| React | Vue | Flutter | Type | Default | Use |
|---|---|---|---|---|---|
title |
title |
Text |
text | none | The screen title. |
nav |
nav |
a Row of icon and label buttons |
{ title, href, icon, active? }[] |
none | The bottom nav. |
actions |
#actions slot |
ShadIconButton.ghost |
element | none | At most two icon buttons in the top bar. |
search |
#search slot |
ShadInput |
element | none | The optional search under the title. |
labels |
labels |
Semantics |
{ nav } |
English | The name of the bottom nav for screen readers, such as “Navigasi utama”. |
children |
default slot | Expanded child |
element | none | The screen content. |
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, ), ), ], ), ), ), ), ), ], ), ), ), ], ), ), ); }}Install
Section titled “Install”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.jsonThe block lands in components/blocks/. Install Item, Drawer, Badge, Input Group, Button, Label and Radio Group for the content shown here.
Flutter
Section titled “Flutter”Flutter apps build the same frame from widgets: a Column with the top bar, an Expanded list of ShadItem, and a bottom row of icon and label buttons inside a SafeArea. A Material NavigationBar works too if it follows the same rules: labels always shown, the current item in primary, no pill indicator.
Accessibility
Section titled “Accessibility”- The bottom nav is a
navnamed “Main navigation” by default (“Navigasi utama” in the example); the current destination hasaria-current="page". - Every destination shows its label, so it never relies on the icon alone.
- Icon buttons in the top bar have a name, such as “Notifikasi”.
- The bell opens the notifications page, not a popover: see Notifications.
