Dashboard
The dashboard frame is the second place where every Sosialoka product looks like one family (Alternative A). The menu, search and account sit in the same place in every product, so people who use more than one product never have to look for them.
When to use
Section titled “When to use”- Use it for every signed-in page of a web app.
- Put lists, details and forms inside it. Don’t build a second header or a second sidebar.
Do and don’t
Section titled “Do and don’t”Anatomy
Section titled “Anatomy”- 1Sidebar with the product logo
- 2Header card, floating over a blur
- 3Search: opens the command palette
- 4Language code dropdown, then icon actions with tooltips
- 5Avatar and account menu, always last
- 6Content on background
- Sidebar: 16rem on the white
sidebarsurface, with the product logo on top. The active item usessidebar-accentand hasaria-current="page". - Header card: one card, 56px tall (
h-14 rounded-lg border-border bg-card shadow-md), that stays at the top while the page scrolls under a blur. It holds the search, the icon actions and the avatar, as the Cover Clearance header does. - Search: fills the card’s left side without a box of its own and opens the command palette. ⌘K or Ctrl+K opens it too.
- Actions: the language as an outlined pill with its code, then 36px ghost icon buttons in
muted-foreground, each named by a tooltip. - Account: the avatar, always last, opens the account menu.
- Content: the page, on
background.
- One search: the card and ⌘K open the same palette. The block listens for ⌘K once per page, so it never opens a second palette over a search card from Command.
- Menu: use five to seven items with icons. Settings go last. A product with more pages follows Navigation menu.
- Actions: the language first, then at most three icon actions in this order: mode, help, notifications. Build the icon actions with
DashboardIconButton, whoselabelbecomes its tooltip and name. - Mode: the icon shows the current mode (sun or moon); the tooltip says what a click does, such as “Mode gelap”.
- Language:
DashboardLanguageSelect, as in Lokasign: an outlined dropdown trigger with the current code, “ID” or “EN”, in mono and a chevron. It opens a menu of languages with the current one marked. It is a pill (rounded-full), the one pill in the header, and stays a menu so more languages can join. - Notifications:
badgeshows the unread count; leave it out at zero. The bell opens the panel from Notifications. - Account menu: show the name and one detail line, then the actions. “Keluar” goes last as a destructive item.
- Small screens: below
mdthe sidebar becomes a sheet that opens from the menu button. - Preview frames:
collapsible="none"keeps the sidebar in the page flow, such as inside a frame on a docs page.
| React | Vue | Flutter | Type | Default | Use |
|---|---|---|---|---|---|
nav |
nav |
ShadButton.ghost list |
pages, parents or sections | none | The menu. For sections, sub menus and counts, see Navigation menu. |
logo |
#logo slot |
widget | element | none | The product logo at the top of the sidebar. |
account |
account |
ShadAvatar |
{ name, initials, detail?, menu } |
none | The avatar and its menu. A menu item can set onSelect and destructive. |
actions |
#actions slot |
ShadButton.outline and ShadIconButton.ghost in a ShadTooltip |
elements | none | Actions between the search and the avatar: DashboardLanguageSelect (value, options, onValueChange, label; Vue v-model), then DashboardIconButton (label, badge?, the icon as its child). |
search |
search |
ShadInput in a ShadCard |
{ groups: { heading, items }[] } |
none | What the palette lists. An item runs its onSelect. |
collapsible |
collapsible |
none | offcanvas, icon, none |
offcanvas |
How the sidebar collapses. |
labels |
labels |
Text |
{ search, empty, account, menu } |
English | Text for the search card, the palette and screen readers. The example passes Indonesian. |
children |
default slot | Expanded child |
element | none | The page content. |
import { useState } from "react"import { BarChart3Icon, BellIcon, DiscIcon, FileTextIcon, HomeIcon, MoonIcon, SettingsIcon, SunIcon } from "lucide-react"import { DashboardIconButton, DashboardLanguageSelect, DashboardShell } from "@/components/blocks/dashboard-shell"import { Card, CardDescription, CardHeader, CardTitle } from "@/components/ui/card"
const nav = [ { title: "Dasbor", href: "#", icon: HomeIcon, active: true }, { title: "Rilis", href: "#rilis", icon: DiscIcon }, { title: "Royalti", href: "#royalti", icon: BarChart3Icon }, { title: "Dokumen", href: "#dokumen", icon: FileTextIcon }, { title: "Pengaturan", href: "#pengaturan", icon: SettingsIcon },]
const stats = [ { label: "Rilis aktif", value: "24" }, { label: "Streaming bulan ini", value: "182.430" }, { label: "Royalti bulan ini", value: "Rp4.812.500,00" },]
export default function DashboardShellDemo() { // Start from the mode the page is in, so the icon shows it. const [dark, setDark] = useState(() => typeof document !== "undefined" && document.documentElement.dataset.theme === "dark") const [language, setLanguage] = useState("id") const toggleMode = () => { setDark(!dark) document.documentElement.dataset.theme = dark ? "light" : "dark" } return ( <DashboardShell nav={nav} actions={ <> <DashboardLanguageSelect label="Bahasa" value={language} onValueChange={setLanguage} options={[ { code: "id", label: "Bahasa Indonesia" }, { code: "en", label: "English" }, ]} /> <DashboardIconButton label={dark ? "Mode terang" : "Mode gelap"} onClick={toggleMode}> {dark ? <MoonIcon /> : <SunIcon />} </DashboardIconButton> <DashboardIconButton label="Notifikasi" badge={3}> <BellIcon /> </DashboardIconButton> </> } labels={{ search: "Cari rilis, artis, atau dokumen", empty: "Tidak ada yang cocok.", account: "Akun {name}", menu: "Buka menu" }} logo={ <span className="flex items-center gap-2 font-semibold"> <span className="size-7 rounded-md bg-primary" /> Produkmu </span> } account={{ name: "Raka Pratama", initials: "RP", detail: "raka@contoh.id", menu: [{ label: "Profil" }, { label: "Pengaturan akun" }, { label: "Keluar", destructive: true }], }} search={{ groups: [ { heading: "Rilis", items: [{ label: "Senja di Kota" }, { label: "Kaset Pertama" }] }, { heading: "Menu", items: nav.map((item) => ({ label: item.title })) }, ], }} > <h1 className="text-2xl font-semibold">Dasbor</h1> <p className="mt-1 text-sm text-muted-foreground">Ringkasan katalogmu minggu ini.</p> <div className="mt-6 grid gap-4 sm:grid-cols-3"> {stats.map((stat) => ( <Card key={stat.label}> <CardHeader> <CardDescription>{stat.label}</CardDescription> <CardTitle className="text-2xl tabular-nums">{stat.value}</CardTitle> </CardHeader> </Card> ))} </div> </DashboardShell> )}<script setup lang="ts">import { BarChart3, Bell, Disc, FileText, Home, Moon, Settings, Sun } from "@lucide/vue"import { ref } from "vue"import { DashboardIconButton, DashboardLanguageSelect, DashboardShell } from "@/components/blocks/dashboard-shell"import { Card, CardDescription, CardHeader, CardTitle } from "@/components/ui/card"
const nav = [ { title: "Dasbor", href: "#", icon: Home, active: true }, { title: "Rilis", href: "#rilis", icon: Disc }, { title: "Royalti", href: "#royalti", icon: BarChart3 }, { title: "Dokumen", href: "#dokumen", icon: FileText }, { title: "Pengaturan", href: "#pengaturan", icon: Settings },]
const stats = [ { label: "Rilis aktif", value: "24" }, { label: "Streaming bulan ini", value: "182.430" }, { label: "Royalti bulan ini", value: "Rp4.812.500,00" },]
const account = { name: "Raka Pratama", initials: "RP", detail: "raka@contoh.id", menu: [{ label: "Profil" }, { label: "Pengaturan akun" }, { label: "Keluar", destructive: true }],}
const search = { groups: [ { heading: "Rilis", items: [{ label: "Senja di Kota" }, { label: "Kaset Pertama" }] }, { heading: "Menu", items: nav.map((item) => ({ label: item.title })) }, ],}// Start from the mode the page is in, so the icon shows it.const dark = ref(typeof document !== "undefined" && document.documentElement.dataset.theme === "dark")const language = ref("id")const languages = [ { code: "id", label: "Bahasa Indonesia" }, { code: "en", label: "English" },]function toggleMode() { dark.value = !dark.value document.documentElement.dataset.theme = dark.value ? "dark" : "light"}const labels = { search: "Cari rilis, artis, atau dokumen", empty: "Tidak ada yang cocok.", account: "Akun {name}", menu: "Buka menu" }</script>
<template> <DashboardShell :nav="nav" :account="account" :search="search" :labels="labels"> <template #logo> <span class="flex items-center gap-2 font-semibold"> <span class="size-7 rounded-md bg-primary" /> Produkmu </span> </template> <template #actions> <DashboardLanguageSelect v-model="language" label="Bahasa" :options="languages" /> <DashboardIconButton :label="dark ? 'Mode terang' : 'Mode gelap'" @click="toggleMode"> <Moon v-if="dark" /> <Sun v-else /> </DashboardIconButton> <DashboardIconButton label="Notifikasi" :badge="3"> <Bell /> </DashboardIconButton> </template>
<h1 class="text-2xl font-semibold">Dasbor</h1> <p class="mt-1 text-sm text-muted-foreground">Ringkasan katalogmu minggu ini.</p> <div class="mt-6 grid gap-4 sm:grid-cols-3"> <Card v-for="stat in stats" :key="stat.label"> <CardHeader> <CardDescription>{{ stat.label }}</CardDescription> <CardTitle class="text-2xl tabular-nums">{{ stat.value }}</CardTitle> </CardHeader> </Card> </div> </DashboardShell></template>// Flutter has no registry blocks: build the dashboard frame (Alt A) from widgets with the Sosialoka theme.// A white sidebar, then the floating header card: the search, the language (code + chevron), icon actions// (mode, notifications) and the account avatar last. Every icon action has a tooltip that names it.// On narrow screens, move the menu into a sheet opened from a menu button.import 'package:flutter/widgets.dart';import 'package:shadcn_ui/shadcn_ui.dart';import 'package:sosialoka_ui/sosialoka_ui.dart';
const _menu = ['Dasbor', 'Rilis', 'Royalti', 'Dokumen', 'Pengaturan'];const _stats = [('Rilis aktif', '24'), ('Streaming bulan ini', '182.430'), ('Royalti bulan ini', 'Rp4.812.500,00')];
class DashboardShellDemo extends StatelessWidget { const DashboardShellDemo({super.key, this.height = 560});
final double height;
@override Widget build(BuildContext context) { final theme = ShadTheme.of(context); final c = context.sosialoka; return SizedBox( height: height, child: Row( crossAxisAlignment: CrossAxisAlignment.stretch, children: [ Container( width: 256, padding: const EdgeInsets.all(8), decoration: BoxDecoration( color: theme.colorScheme.card, border: Border(right: BorderSide(color: theme.colorScheme.border)), ), child: Column( crossAxisAlignment: CrossAxisAlignment.stretch, children: [ for (final item in _menu) ShadButton.ghost( mainAxisAlignment: MainAxisAlignment.start, backgroundColor: item == 'Dasbor' ? c.primarySoft : null, foregroundColor: item == 'Dasbor' ? c.primaryText : theme.colorScheme.foreground, onPressed: () {}, child: Text(item), ), ], ), ), Expanded( child: ColoredBox( color: theme.colorScheme.background, child: Padding( padding: const EdgeInsets.all(24), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ ShadCard( padding: const EdgeInsets.symmetric(horizontal: 8), child: SizedBox( height: 54, child: Row( children: [ Expanded( child: ShadInput( placeholder: const Text('Cari rilis, artis, atau dokumen'), leading: const Icon(LucideIcons.search, size: 16), decoration: const ShadDecoration(border: ShadBorder.none, focusedBorder: ShadBorder.none), readOnly: true, onPressed: () {}, ), ), // Language first, as in Lokasign: the current code with a chevron, opening a menu of languages. ShadButton.outline( height: 36, decoration: const ShadDecoration(border: ShadBorder(radius: BorderRadius.all(Radius.circular(18)))), padding: const EdgeInsets.only(left: 12, right: 8), onPressed: () {}, trailing: Icon(LucideIcons.chevronDown, size: 14, color: theme.colorScheme.mutedForeground), child: Text('ID', style: TextStyle(fontFamily: theme.textTheme.family, fontFeatures: const [FontFeature.tabularFigures()], fontSize: 12, fontWeight: FontWeight.w500)), ), const SizedBox(width: 4), ShadTooltip( builder: (context) => const Text('Mode gelap'), child: ShadIconButton.ghost(icon: const Icon(LucideIcons.moon, size: 18), onPressed: () {}), ), ShadTooltip( builder: (context) => const Text('Notifikasi'), child: Stack( clipBehavior: Clip.none, children: [ ShadIconButton.ghost(icon: const Icon(LucideIcons.bell, size: 18), onPressed: () {}), Positioned( top: 4, right: 4, child: Container( constraints: const BoxConstraints(minWidth: 16), height: 16, alignment: Alignment.center, decoration: BoxDecoration(color: theme.colorScheme.destructive, borderRadius: BorderRadius.circular(8)), child: Text('3', style: TextStyle(fontSize: 10, fontWeight: FontWeight.w600, color: theme.colorScheme.destructiveForeground)), ), ), ], ), ), const SizedBox(width: 4), const ShadAvatar('', placeholder: Text('RP'), size: Size.square(36)), ], ), ), ), const SizedBox(height: 24), Text('Dasbor', style: theme.textTheme.h3), const SizedBox(height: 16), Row( children: [ for (final (label, value) in _stats) ...[ Expanded( child: ShadCard( description: Text(label), title: Text(value, style: theme.textTheme.h4), ), ), if (label != _stats.last.$1) const SizedBox(width: 16), ], ], ), ], ), ), ), ), ], ), ); }}Install
Section titled “Install”npx shadcn@latest add https://design.sosialoka.tech/r/react/dashboard-shell.jsonnpx shadcn-vue@latest add https://design.sosialoka.tech/r/vue/dashboard-shell.jsonThe block lands in components/blocks/ and installs the Sosialoka Sidebar, Command, Dropdown Menu and Avatar with it.
Flutter
Section titled “Flutter”Flutter has no blocks. The Flutter code builds the same frame from widgets: a sidebar column, the header card with the search, the icon actions and the avatar, and the content. On phones, move the menu into a sheet.
Accessibility
Section titled “Accessibility”- The active menu item has
aria-current="page". - The search is a button, and its name is the search text. The ⌘K hint is shown beside it.
- Each icon action is named by its
label, and a count is read with it, such as “Notifikasi (3)”. - The avatar button is named “Akun” followed by the account name.
