Sidebar aplikasi dengan grup link, indikator aktif yang meluncur, sub-item yang bisa dibuka, mode rail ikon, dan dialog off-canvas di tata letak sempit.
Projects / Website redesign
Sprint 14
Open
24
Shipped
18
Up next
Projects / Website redesign
Sprint 14
Open
24
Shipped
18
Up next
Projects / Website redesign
Sprint 14
Open
24
Shipped
18
Up next
Projects / Website redesign
Sprint 14
Open
24
Shipped
18
Up next
Projects / Website redesign
Sprint 14
Open
24
Shipped
18
Up next
<x-markas.sidebar :sections="[
[
'items' => [
[
'label' => 'Home',
'href' => '/',
'icon' => 'M3 10.5 12 3l9 7.5V20a1 1 0 0 1-1 1h-5v-6h-6v6H4a1 1 0 0 1-1-1z',
],
[
'label' => 'Inbox',
'href' => '/inbox',
'icon' => 'M3 13h5l1.5 3h5l1.5-3h5M5 5h14l2 8v6a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1v-6z',
'badge' => 12,
],
],
],
[
'title' => 'Workspace',
'items' => [
[
'label' => 'Projects',
'icon' => 'M3 7a2 2 0 0 1 2-2h4l2 2h8a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z',
'children' => [
['label' => 'Website redesign', 'href' => '/projects/website', 'active' => true],
['label' => 'Mobile app', 'href' => '/projects/mobile'],
['label' => 'Design system', 'href' => '/projects/design-system'],
],
],
[
'label' => 'Analytics',
'href' => '/analytics',
'icon' => 'M3 3v18h18M7 15l4-4 3 3 5-6',
],
],
],
[
'title' => 'Account',
'items' => [
[
'label' => 'Settings',
'href' => '/settings',
'icon' => 'M4 6h9m4 0h3M4 12h3m4 0h9M4 18h11m4 0h1M15 4v4M9 10v4M17 16v4',
],
],
],
]" breakpoint="sm" class="h-[540px] rounded-xl border border-line">
<x-slot:header>
<svg class="size-7 shrink-0" viewBox="0 0 1464 1430" aria-hidden="true"><polygon points="354,578 1256,138 1171,430 268,868" class="fill-ink/15" /><polygon points="553,443 1455,3 1370,295 467,733" class="fill-ink/55" /><polygon points="421,762 1325,318 1240,611 336,1050" class="fill-success/35" /><polygon points="265,1073 1169,629 1084,922 180,1362" class="fill-ink/25" /><polygon points="93,965 997,521 912,814 8,1253" class="fill-ink/75" /><polygon points="347,1135 1251,691 1166,984 262,1424" class="fill-success" /></svg>
<div class="grid min-w-0 leading-tight"><span class="font-semibold text-ink">MarkasUI</span><span class="text-xs text-muted">Pro workspace</span></div>
</x-slot:header>
<x-slot:footer>
<span class="relative grid size-8 shrink-0 place-items-center rounded-full bg-primary-soft text-xs font-semibold text-ink">RS<span aria-hidden="true" class="absolute -right-0.5 -bottom-0.5 size-2.5 rounded-full border-2 border-surface bg-success"></span></span>
<span class="grid min-w-0 flex-1 leading-tight"><span class="truncate font-medium text-ink">Rina Saputra</span><span class="truncate text-xs text-muted">rina@markasui.com</span></span>
<svg class="size-4 shrink-0 text-faint" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="m8 9 4-4 4 4m0 6-4 4-4-4" /></svg>
</x-slot:footer>
<div class="flex min-w-0 flex-1 flex-col gap-4 p-5">
<div class="grid gap-1">
<p class="text-xs text-muted">Projects / Website redesign</p>
<p class="text-lg font-semibold tracking-tight text-ink">Sprint 14</p>
</div>
<div class="grid grid-cols-2 gap-3">
<div class="rounded-xl border border-line bg-surface p-3"><p class="text-xs text-muted">Open</p><p class="mt-1 text-xl font-semibold text-ink">24</p></div>
<div class="rounded-xl border border-line bg-surface p-3"><p class="text-xs text-muted">Shipped</p><p class="mt-1 text-xl font-semibold text-ink">18</p></div>
</div>
<div class="grid content-start gap-3 rounded-xl border border-line bg-surface p-4">
<p class="text-xs font-medium text-faint">Up next</p>
@foreach ([['Hero copy review', 'bg-success'], ['Pricing page QA', 'bg-warning'], ['Footer links audit', 'bg-faint']] as [$label, $tone])
<div class="flex items-center gap-2.5"><span aria-hidden="true" class="size-2 shrink-0 rounded-full {{ $tone }}"></span><span class="truncate text-sm text-ink">{{ $label }}</span></div>
@endforeach
</div>
</div>
</x-markas.sidebar>import { Sidebar } from "@/components/markas/Sidebar";
const mark = [
{ points: "354,578 1256,138 1171,430 268,868", className: "fill-ink/15" },
{ points: "553,443 1455,3 1370,295 467,733", className: "fill-ink/55" },
{
points: "421,762 1325,318 1240,611 336,1050",
className: "fill-success/35",
},
{ points: "265,1073 1169,629 1084,922 180,1362", className: "fill-ink/25" },
{ points: "93,965 997,521 912,814 8,1253", className: "fill-ink/75" },
{
points: "347,1135 1251,691 1166,984 262,1424",
className: "fill-success",
},
];
const sections = [
{
items: [
{
label: "Home",
href: "/",
icon: "M3 10.5 12 3l9 7.5V20a1 1 0 0 1-1 1h-5v-6h-6v6H4a1 1 0 0 1-1-1z",
},
{
label: "Inbox",
href: "/inbox",
icon: "M3 13h5l1.5 3h5l1.5-3h5M5 5h14l2 8v6a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1v-6z",
badge: 12,
},
],
},
{
title: "Workspace",
items: [
{
label: "Projects",
icon: "M3 7a2 2 0 0 1 2-2h4l2 2h8a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",
children: [
{
label: "Website redesign",
href: "/projects/website",
active: true,
},
{
label: "Mobile app",
href: "/projects/mobile",
},
{
label: "Design system",
href: "/projects/design-system",
},
],
},
{
label: "Analytics",
href: "/analytics",
icon: "M3 3v18h18M7 15l4-4 3 3 5-6",
},
],
},
{
title: "Account",
items: [
{
label: "Settings",
href: "/settings",
icon: "M4 6h9m4 0h3M4 12h3m4 0h9M4 18h11m4 0h1M15 4v4M9 10v4M17 16v4",
},
],
},
];
const tasks = [
{ label: "Hero copy review", tone: "bg-success" },
{ label: "Pricing page QA", tone: "bg-warning" },
{ label: "Footer links audit", tone: "bg-faint" },
];
export default function SidebarExample() {
return (
<Sidebar
sections={sections}
breakpoint="sm"
className="h-[540px] rounded-xl border border-line"
header={
<>
<svg
className="size-7 shrink-0"
viewBox="0 0 1464 1430"
aria-hidden="true"
>
{mark.map((shape) => (
<polygon
key={shape.points}
points={shape.points}
className={shape.className}
/>
))}
</svg>
<div className="grid min-w-0 leading-tight">
<span className="font-semibold text-ink">MarkasUI</span>
<span className="text-xs text-muted">Pro workspace</span>
</div>
</>
}
footer={
<>
<span className="relative grid size-8 shrink-0 place-items-center rounded-full bg-primary-soft text-xs font-semibold text-ink">
RS
<span
aria-hidden="true"
className="absolute -right-0.5 -bottom-0.5 size-2.5 rounded-full border-2 border-surface bg-success"
></span>
</span>
<span className="grid min-w-0 flex-1 leading-tight">
<span className="truncate font-medium text-ink">Rina Saputra</span>
<span className="truncate text-xs text-muted">
rina@markasui.com
</span>
</span>
<svg
className="size-4 shrink-0 text-faint"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
strokeWidth="1.5"
strokeLinecap="round"
strokeLinejoin="round"
aria-hidden="true"
>
<path d="m8 9 4-4 4 4m0 6-4 4-4-4" />
</svg>
</>
}
>
<div className="flex min-w-0 flex-1 flex-col gap-4 p-5">
<div className="grid gap-1">
<p className="text-xs text-muted">Projects / Website redesign</p>
<p className="text-lg font-semibold tracking-tight text-ink">
Sprint 14
</p>
</div>
<div className="grid grid-cols-2 gap-3">
<div className="rounded-xl border border-line bg-surface p-3">
<p className="text-xs text-muted">Open</p>
<p className="mt-1 text-xl font-semibold text-ink">24</p>
</div>
<div className="rounded-xl border border-line bg-surface p-3">
<p className="text-xs text-muted">Shipped</p>
<p className="mt-1 text-xl font-semibold text-ink">18</p>
</div>
</div>
<div className="grid content-start gap-3 rounded-xl border border-line bg-surface p-4">
<p className="text-xs font-medium text-faint">Up next</p>
{tasks.map((task) => (
<div key={task.label} className="flex items-center gap-2.5">
<span
aria-hidden="true"
className={`size-2 shrink-0 rounded-full ${task.tone}`}
></span>
<span className="truncate text-sm text-ink">{task.label}</span>
</div>
))}
</div>
</div>
</Sidebar>
);
}<script setup lang="ts">
import Sidebar from "@/components/markas/Sidebar.vue";
const mark = [
{ points: "354,578 1256,138 1171,430 268,868", className: "fill-ink/15" },
{ points: "553,443 1455,3 1370,295 467,733", className: "fill-ink/55" },
{
points: "421,762 1325,318 1240,611 336,1050",
className: "fill-success/35",
},
{ points: "265,1073 1169,629 1084,922 180,1362", className: "fill-ink/25" },
{ points: "93,965 997,521 912,814 8,1253", className: "fill-ink/75" },
{
points: "347,1135 1251,691 1166,984 262,1424",
className: "fill-success",
},
];
const sections = [
{
items: [
{
label: "Home",
href: "/",
icon: "M3 10.5 12 3l9 7.5V20a1 1 0 0 1-1 1h-5v-6h-6v6H4a1 1 0 0 1-1-1z",
},
{
label: "Inbox",
href: "/inbox",
icon: "M3 13h5l1.5 3h5l1.5-3h5M5 5h14l2 8v6a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1v-6z",
badge: 12,
},
],
},
{
title: "Workspace",
items: [
{
label: "Projects",
icon: "M3 7a2 2 0 0 1 2-2h4l2 2h8a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",
children: [
{
label: "Website redesign",
href: "/projects/website",
active: true,
},
{
label: "Mobile app",
href: "/projects/mobile",
},
{
label: "Design system",
href: "/projects/design-system",
},
],
},
{
label: "Analytics",
href: "/analytics",
icon: "M3 3v18h18M7 15l4-4 3 3 5-6",
},
],
},
{
title: "Account",
items: [
{
label: "Settings",
href: "/settings",
icon: "M4 6h9m4 0h3M4 12h3m4 0h9M4 18h11m4 0h1M15 4v4M9 10v4M17 16v4",
},
],
},
];
const tasks = [
{ label: "Hero copy review", tone: "bg-success" },
{ label: "Pricing page QA", tone: "bg-warning" },
{ label: "Footer links audit", tone: "bg-faint" },
];
</script>
<template>
<Sidebar
:sections="sections"
breakpoint="sm"
class="h-[540px] rounded-xl border border-line"
>
<template #header>
<svg class="size-7 shrink-0" viewBox="0 0 1464 1430" aria-hidden="true">
<polygon
v-for="shape in mark"
:key="shape.points"
:points="shape.points"
:class="shape.className"
/>
</svg>
<div class="grid min-w-0 leading-tight">
<span class="font-semibold text-ink">MarkasUI</span>
<span class="text-xs text-muted">Pro workspace</span>
</div>
</template>
<template #footer>
<span
class="relative grid size-8 shrink-0 place-items-center rounded-full bg-primary-soft text-xs font-semibold text-ink"
>
RS
<span
aria-hidden="true"
class="absolute -right-0.5 -bottom-0.5 size-2.5 rounded-full border-2 border-surface bg-success"
></span>
</span>
<span class="grid min-w-0 flex-1 leading-tight">
<span class="truncate font-medium text-ink">Rina Saputra</span>
<span class="truncate text-xs text-muted">rina@markasui.com</span>
</span>
<svg
class="size-4 shrink-0 text-faint"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
stroke-width="1.5"
stroke-linecap="round"
stroke-linejoin="round"
aria-hidden="true"
>
<path d="m8 9 4-4 4 4m0 6-4 4-4-4" />
</svg>
</template>
<div class="flex min-w-0 flex-1 flex-col gap-4 p-5">
<div class="grid gap-1">
<p class="text-xs text-muted">Projects / Website redesign</p>
<p class="text-lg font-semibold tracking-tight text-ink">Sprint 14</p>
</div>
<div class="grid grid-cols-2 gap-3">
<div class="rounded-xl border border-line bg-surface p-3">
<p class="text-xs text-muted">Open</p>
<p class="mt-1 text-xl font-semibold text-ink">24</p>
</div>
<div class="rounded-xl border border-line bg-surface p-3">
<p class="text-xs text-muted">Shipped</p>
<p class="mt-1 text-xl font-semibold text-ink">18</p>
</div>
</div>
<div
class="grid content-start gap-3 rounded-xl border border-line bg-surface p-4"
>
<p class="text-xs font-medium text-faint">Up next</p>
<div
v-for="task in tasks"
:key="task.label"
class="flex items-center gap-2.5"
>
<span
aria-hidden="true"
:class="`size-2 shrink-0 rounded-full ${task.tone}`"
></span>
<span class="truncate text-sm text-ink">{{ task.label }}</span>
</div>
</div>
</div>
</Sidebar>
</template><script lang="ts">
import Sidebar from "$lib/components/markas/Sidebar.svelte";
const mark = [
{ points: "354,578 1256,138 1171,430 268,868", className: "fill-ink/15" },
{ points: "553,443 1455,3 1370,295 467,733", className: "fill-ink/55" },
{
points: "421,762 1325,318 1240,611 336,1050",
className: "fill-success/35",
},
{ points: "265,1073 1169,629 1084,922 180,1362", className: "fill-ink/25" },
{ points: "93,965 997,521 912,814 8,1253", className: "fill-ink/75" },
{
points: "347,1135 1251,691 1166,984 262,1424",
className: "fill-success",
},
];
const sections = [
{
items: [
{
label: "Home",
href: "/",
icon: "M3 10.5 12 3l9 7.5V20a1 1 0 0 1-1 1h-5v-6h-6v6H4a1 1 0 0 1-1-1z",
},
{
label: "Inbox",
href: "/inbox",
icon: "M3 13h5l1.5 3h5l1.5-3h5M5 5h14l2 8v6a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1v-6z",
badge: 12,
},
],
},
{
title: "Workspace",
items: [
{
label: "Projects",
icon: "M3 7a2 2 0 0 1 2-2h4l2 2h8a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",
children: [
{
label: "Website redesign",
href: "/projects/website",
active: true,
},
{
label: "Mobile app",
href: "/projects/mobile",
},
{
label: "Design system",
href: "/projects/design-system",
},
],
},
{
label: "Analytics",
href: "/analytics",
icon: "M3 3v18h18M7 15l4-4 3 3 5-6",
},
],
},
{
title: "Account",
items: [
{
label: "Settings",
href: "/settings",
icon: "M4 6h9m4 0h3M4 12h3m4 0h9M4 18h11m4 0h1M15 4v4M9 10v4M17 16v4",
},
],
},
];
const tasks = [
{ label: "Hero copy review", tone: "bg-success" },
{ label: "Pricing page QA", tone: "bg-warning" },
{ label: "Footer links audit", tone: "bg-faint" },
];
</script>
<Sidebar
{sections}
breakpoint="sm"
class="h-[540px] rounded-xl border border-line"
>{#snippet header()}
<svg class="size-7 shrink-0" viewBox="0 0 1464 1430" aria-hidden="true"
>{#each mark as shape (shape.points)}
<polygon points={shape.points} class={shape.className} />
{/each}</svg
>
<div class="grid min-w-0 leading-tight">
<span class="font-semibold text-ink">MarkasUI</span>
<span class="text-xs text-muted">Pro workspace</span>
</div>
{/snippet}
{#snippet footer()}
<span
class="relative grid size-8 shrink-0 place-items-center rounded-full bg-primary-soft text-xs font-semibold text-ink"
>
RS
<span
aria-hidden="true"
class="absolute -right-0.5 -bottom-0.5 size-2.5 rounded-full border-2 border-surface bg-success"
></span></span
>
<span class="grid min-w-0 flex-1 leading-tight"
><span class="truncate font-medium text-ink">Rina Saputra</span>
<span class="truncate text-xs text-muted">rina@markasui.com</span></span
>
<svg
class="size-4 shrink-0 text-faint"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
stroke-width="1.5"
stroke-linecap="round"
stroke-linejoin="round"
aria-hidden="true"><path d="m8 9 4-4 4 4m0 6-4 4-4-4" /></svg
>
{/snippet}
<div class="flex min-w-0 flex-1 flex-col gap-4 p-5">
<div class="grid gap-1">
<p class="text-xs text-muted">Projects / Website redesign</p>
<p class="text-lg font-semibold tracking-tight text-ink">Sprint 14</p>
</div>
<div class="grid grid-cols-2 gap-3">
<div class="rounded-xl border border-line bg-surface p-3">
<p class="text-xs text-muted">Open</p>
<p class="mt-1 text-xl font-semibold text-ink">24</p>
</div>
<div class="rounded-xl border border-line bg-surface p-3">
<p class="text-xs text-muted">Shipped</p>
<p class="mt-1 text-xl font-semibold text-ink">18</p>
</div>
</div>
<div
class="grid content-start gap-3 rounded-xl border border-line bg-surface p-4"
>
<p class="text-xs font-medium text-faint">Up next</p>
{#each tasks as task (task.label)}
<div class="flex items-center gap-2.5">
<span
aria-hidden="true"
class={`size-2 shrink-0 rounded-full ${task.tone}`}
></span> <span class="truncate text-sm text-ink">{task.label}</span>
</div>
{/each}
</div>
</div></Sidebar
>---
import Sidebar from "@/components/markas/Sidebar.astro";
const mark = [
{ points: "354,578 1256,138 1171,430 268,868", className: "fill-ink/15" },
{ points: "553,443 1455,3 1370,295 467,733", className: "fill-ink/55" },
{
points: "421,762 1325,318 1240,611 336,1050",
className: "fill-success/35",
},
{ points: "265,1073 1169,629 1084,922 180,1362", className: "fill-ink/25" },
{ points: "93,965 997,521 912,814 8,1253", className: "fill-ink/75" },
{
points: "347,1135 1251,691 1166,984 262,1424",
className: "fill-success",
},
];
const sections = [
{
items: [
{
label: "Home",
href: "/",
icon: "M3 10.5 12 3l9 7.5V20a1 1 0 0 1-1 1h-5v-6h-6v6H4a1 1 0 0 1-1-1z",
},
{
label: "Inbox",
href: "/inbox",
icon: "M3 13h5l1.5 3h5l1.5-3h5M5 5h14l2 8v6a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1v-6z",
badge: 12,
},
],
},
{
title: "Workspace",
items: [
{
label: "Projects",
icon: "M3 7a2 2 0 0 1 2-2h4l2 2h8a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",
children: [
{
label: "Website redesign",
href: "/projects/website",
active: true,
},
{
label: "Mobile app",
href: "/projects/mobile",
},
{
label: "Design system",
href: "/projects/design-system",
},
],
},
{
label: "Analytics",
href: "/analytics",
icon: "M3 3v18h18M7 15l4-4 3 3 5-6",
},
],
},
{
title: "Account",
items: [
{
label: "Settings",
href: "/settings",
icon: "M4 6h9m4 0h3M4 12h3m4 0h9M4 18h11m4 0h1M15 4v4M9 10v4M17 16v4",
},
],
},
];
const tasks = [
{ label: "Hero copy review", tone: "bg-success" },
{ label: "Pricing page QA", tone: "bg-warning" },
{ label: "Footer links audit", tone: "bg-faint" },
];
---
<Sidebar
{sections}
breakpoint="sm"
class="h-[540px] rounded-xl border border-line"
><Fragment slot="header">
<svg class="size-7 shrink-0" viewBox="0 0 1464 1430" aria-hidden="true"
>{mark.map((shape) => (
<polygon points={shape.points} class={shape.className} />
))}</svg
>
<div class="grid min-w-0 leading-tight">
<span class="font-semibold text-ink">MarkasUI</span>
<span class="text-xs text-muted">Pro workspace</span>
</div>
</Fragment>
<Fragment slot="footer">
<span
class="relative grid size-8 shrink-0 place-items-center rounded-full bg-primary-soft text-xs font-semibold text-ink"
>
RS
<span
aria-hidden="true"
class="absolute -right-0.5 -bottom-0.5 size-2.5 rounded-full border-2 border-surface bg-success"
></span></span
>
<span class="grid min-w-0 flex-1 leading-tight"
><span class="truncate font-medium text-ink">Rina Saputra</span>
<span class="truncate text-xs text-muted">rina@markasui.com</span></span
>
<svg
class="size-4 shrink-0 text-faint"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
stroke-width="1.5"
stroke-linecap="round"
stroke-linejoin="round"
aria-hidden="true"><path d="m8 9 4-4 4 4m0 6-4 4-4-4" /></svg
>
</Fragment>
<div class="flex min-w-0 flex-1 flex-col gap-4 p-5">
<div class="grid gap-1">
<p class="text-xs text-muted">Projects / Website redesign</p>
<p class="text-lg font-semibold tracking-tight text-ink">Sprint 14</p>
</div>
<div class="grid grid-cols-2 gap-3">
<div class="rounded-xl border border-line bg-surface p-3">
<p class="text-xs text-muted">Open</p>
<p class="mt-1 text-xl font-semibold text-ink">24</p>
</div>
<div class="rounded-xl border border-line bg-surface p-3">
<p class="text-xs text-muted">Shipped</p>
<p class="mt-1 text-xl font-semibold text-ink">18</p>
</div>
</div>
<div
class="grid content-start gap-3 rounded-xl border border-line bg-surface p-4"
>
<p class="text-xs font-medium text-faint">Up next</p>
{tasks.map((task) => (
<div class="flex items-center gap-2.5">
<span
aria-hidden="true"
class={`size-2 shrink-0 rounded-full ${task.tone}`}
></span> <span class="truncate text-sm text-ink">{task.label}</span>
</div>
))}
</div>
</div></Sidebar
>import { Component } from "@angular/core";
import { Sidebar } from "./markas/sidebar.component";
const mark = [
{ points: "354,578 1256,138 1171,430 268,868", className: "fill-ink/15" },
{ points: "553,443 1455,3 1370,295 467,733", className: "fill-ink/55" },
{
points: "421,762 1325,318 1240,611 336,1050",
className: "fill-success/35",
},
{ points: "265,1073 1169,629 1084,922 180,1362", className: "fill-ink/25" },
{ points: "93,965 997,521 912,814 8,1253", className: "fill-ink/75" },
{
points: "347,1135 1251,691 1166,984 262,1424",
className: "fill-success",
},
];
const sections = [
{
items: [
{
label: "Home",
href: "/",
icon: "M3 10.5 12 3l9 7.5V20a1 1 0 0 1-1 1h-5v-6h-6v6H4a1 1 0 0 1-1-1z",
},
{
label: "Inbox",
href: "/inbox",
icon: "M3 13h5l1.5 3h5l1.5-3h5M5 5h14l2 8v6a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1v-6z",
badge: 12,
},
],
},
{
title: "Workspace",
items: [
{
label: "Projects",
icon: "M3 7a2 2 0 0 1 2-2h4l2 2h8a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",
children: [
{
label: "Website redesign",
href: "/projects/website",
active: true,
},
{
label: "Mobile app",
href: "/projects/mobile",
},
{
label: "Design system",
href: "/projects/design-system",
},
],
},
{
label: "Analytics",
href: "/analytics",
icon: "M3 3v18h18M7 15l4-4 3 3 5-6",
},
],
},
{
title: "Account",
items: [
{
label: "Settings",
href: "/settings",
icon: "M4 6h9m4 0h3M4 12h3m4 0h9M4 18h11m4 0h1M15 4v4M9 10v4M17 16v4",
},
],
},
];
const tasks = [
{ label: "Hero copy review", tone: "bg-success" },
{ label: "Pricing page QA", tone: "bg-warning" },
{ label: "Footer links audit", tone: "bg-faint" },
];
@Component({
selector: "markas-example",
imports: [Sidebar],
template: `
<markas-sidebar
[sections]="sections"
breakpoint="sm"
class="h-[540px] rounded-xl border border-line"
><ng-template #header>
<svg class="size-7 shrink-0" viewBox="0 0 1464 1430" aria-hidden="true">
@for (shape of mark; track shape.points) {
<polygon
[attr.points]="shape.points"
[class]="shape.className"
></polygon>
}
</svg>
<div class="grid min-w-0 leading-tight">
<span class="font-semibold text-ink">MarkasUI</span>
<span class="text-xs text-muted">Pro workspace</span>
</div>
</ng-template>
<ng-template #footer>
<span
class="relative grid size-8 shrink-0 place-items-center rounded-full bg-primary-soft text-xs font-semibold text-ink"
>
RS
<span
aria-hidden="true"
class="absolute -right-0.5 -bottom-0.5 size-2.5 rounded-full border-2 border-surface bg-success"
></span
></span>
<span class="grid min-w-0 flex-1 leading-tight"
><span class="truncate font-medium text-ink">Rina Saputra</span>
<span class="truncate text-xs text-muted"
>rina@markasui.com</span
></span
>
<svg
class="size-4 shrink-0 text-faint"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
stroke-width="1.5"
stroke-linecap="round"
stroke-linejoin="round"
aria-hidden="true"
>
<path d="m8 9 4-4 4 4m0 6-4 4-4-4"></path>
</svg>
</ng-template>
<div class="flex min-w-0 flex-1 flex-col gap-4 p-5">
<div class="grid gap-1">
<p class="text-xs text-muted">Projects / Website redesign</p>
<p class="text-lg font-semibold tracking-tight text-ink">Sprint 14</p>
</div>
<div class="grid grid-cols-2 gap-3">
<div class="rounded-xl border border-line bg-surface p-3">
<p class="text-xs text-muted">Open</p>
<p class="mt-1 text-xl font-semibold text-ink">24</p>
</div>
<div class="rounded-xl border border-line bg-surface p-3">
<p class="text-xs text-muted">Shipped</p>
<p class="mt-1 text-xl font-semibold text-ink">18</p>
</div>
</div>
<div
class="grid content-start gap-3 rounded-xl border border-line bg-surface p-4"
>
<p class="text-xs font-medium text-faint">Up next</p>
@for (task of tasks; track task.label) {
<div class="flex items-center gap-2.5">
<span
aria-hidden="true"
[class]="\`size-2 shrink-0 rounded-full \${task.tone}\`"
></span>
<span class="truncate text-sm text-ink">{{ task.label }}</span>
</div>
}
</div>
</div></markas-sidebar
>
`,
})
export default class SidebarExample {
protected readonly mark = mark;
protected readonly sections = sections;
protected readonly tasks = tasks;
}Contoh
Pemilih workspace
Monday, 9 November
Hi, Dimas
Today
Review pricing PR
Ship Combobox docs
Fix Modal focus
Monday, 9 November
Hi, Dimas
Today
Review pricing PR
Ship Combobox docs
Fix Modal focus
Monday, 9 November
Hi, Dimas
Today
Review pricing PR
Ship Combobox docs
Fix Modal focus
Monday, 9 November
Hi, Dimas
Today
Review pricing PR
Ship Combobox docs
Fix Modal focus
Monday, 9 November
Hi, Dimas
Today
Review pricing PR
Ship Combobox docs
Fix Modal focus
<x-markas.sidebar :sections="[
[
'items' => [
[
'label' => 'Home',
'href' => '/',
'icon' => 'M3 10.5 12 3l9 7.5V20a1 1 0 0 1-1 1h-5v-6h-6v6H4a1 1 0 0 1-1-1z',
'active' => true,
],
[
'label' => 'Inbox',
'href' => '/inbox',
'icon' => 'M3 13h5l1.5 3h5l1.5-3h5M5 5h14l2 8v6a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1v-6z',
'badge' => 3,
],
[
'label' => 'My tasks',
'href' => '/tasks',
'icon' => 'm9 11 3 3 8-8M20 12v7a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1h11',
],
],
],
[
'title' => 'Projects',
'items' => [
[
'label' => 'Website relaunch',
'href' => '/projects/website',
'icon' => 'M3 7a2 2 0 0 1 2-2h4l2 2h8a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z',
],
[
'label' => 'Design system',
'href' => '/projects/design-system',
'icon' => 'M4 4h6v6H4zm10 0h6v6h-6zM4 14h6v6H4zm10 0h6v6h-6z',
],
[
'label' => 'Mobile app',
'href' => '/projects/mobile',
'icon' => 'M8 3h8a1 1 0 0 1 1 1v16a1 1 0 0 1-1 1H8a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1m3 15h2',
],
],
],
]" breakpoint="sm" class="h-[600px] rounded-xl border border-line">
<x-slot:header>
<x-markas.dropdown-menu
:items="[
['label' => 'MarkasUI', 'value' => 'markasui'],
['label' => 'MarkasUI Docs', 'value' => 'markasui-docs'],
['separator' => true],
['label' => 'Create workspace', 'value' => 'create'],
]"
class="w-full [&>button]:h-10 [&>button]:w-full [&>button]:justify-start [&>button]:gap-2.5 [&>button]:border-transparent [&>button]:bg-transparent [&>button]:px-1.5 [&>button>svg:last-child]:ms-auto"
>
<x-slot:trigger>
<svg class="size-6 shrink-0" viewBox="0 0 1464 1430" aria-hidden="true"><polygon points="354,578 1256,138 1171,430 268,868" class="fill-ink/15" /><polygon points="553,443 1455,3 1370,295 467,733" class="fill-ink/55" /><polygon points="421,762 1325,318 1240,611 336,1050" class="fill-success/35" /><polygon points="265,1073 1169,629 1084,922 180,1362" class="fill-ink/25" /><polygon points="93,965 997,521 912,814 8,1253" class="fill-ink/75" /><polygon points="347,1135 1251,691 1166,984 262,1424" class="fill-success" /></svg>
<span class="grid text-left leading-tight"><span class="font-semibold">MarkasUI</span><span class="text-xs font-normal text-muted">Pro workspace</span></span>
</x-slot:trigger>
</x-markas.dropdown-menu>
</x-slot:header>
<x-slot:footer>
<div class="grid w-full gap-3 whitespace-normal">
<div class="grid gap-2.5 rounded-xl border border-line bg-canvas p-3 in-data-[state=collapsed]:hidden">
<div class="flex items-center justify-between"><span class="font-medium text-ink">Free plan</span><span class="text-xs text-muted">3 of 5 projects</span></div>
<div class="h-1.5 overflow-hidden rounded-full bg-subtle"><div class="h-full w-3/5 rounded-full bg-success"></div></div>
<p class="text-xs leading-relaxed text-muted">Unlock every template and the Figma kit.</p>
<a href="/pricing" class="inline-flex h-8 items-center justify-center rounded-lg bg-primary text-xs font-medium text-on-primary transition-colors duration-150 ease-out hover:bg-primary-strong">Upgrade to Pro</a>
</div>
<div class="flex items-center gap-3">
<span class="grid size-8 shrink-0 place-items-center rounded-full bg-primary-soft text-xs font-semibold text-ink">DA</span>
<span class="grid min-w-0 leading-tight"><span class="truncate font-medium text-ink">Dimas Arya</span><span class="truncate text-xs text-muted">dimas@markasui.com</span></span>
</div>
</div>
</x-slot:footer>
<div class="flex min-w-0 flex-1 flex-col gap-4 p-5">
<div class="grid gap-1">
<p class="text-xs text-muted">Monday, 9 November</p>
<p class="text-lg font-semibold tracking-tight text-ink">Hi, Dimas</p>
</div>
<div class="grid gap-2 rounded-xl border border-line bg-surface p-4">
<p class="text-xs font-medium text-faint">Today</p>
<p class="text-sm text-ink">Review pricing PR</p>
<p class="text-sm text-ink">Ship Combobox docs</p>
<p class="text-sm text-muted line-through">Fix Modal focus</p>
</div>
</div>
</x-markas.sidebar>import { DropdownMenu } from "@/components/markas/DropdownMenu";
import { Sidebar } from "@/components/markas/Sidebar";
const mark = [
{ points: "354,578 1256,138 1171,430 268,868", className: "fill-ink/15" },
{ points: "553,443 1455,3 1370,295 467,733", className: "fill-ink/55" },
{
points: "421,762 1325,318 1240,611 336,1050",
className: "fill-success/35",
},
{ points: "265,1073 1169,629 1084,922 180,1362", className: "fill-ink/25" },
{ points: "93,965 997,521 912,814 8,1253", className: "fill-ink/75" },
{
points: "347,1135 1251,691 1166,984 262,1424",
className: "fill-success",
},
];
const workspaces = [
{ label: "MarkasUI", value: "markasui" },
{ label: "MarkasUI Docs", value: "markasui-docs" },
{ separator: true as const },
{ label: "Create workspace", value: "create" },
];
const switcher =
"w-full [&>button]:h-10 [&>button]:w-full [&>button]:justify-start [&>button]:gap-2.5 [&>button]:border-transparent [&>button]:bg-transparent [&>button]:px-1.5 [&>button>svg:last-child]:ms-auto";
const sections = [
{
items: [
{
label: "Home",
href: "/",
icon: "M3 10.5 12 3l9 7.5V20a1 1 0 0 1-1 1h-5v-6h-6v6H4a1 1 0 0 1-1-1z",
active: true,
},
{
label: "Inbox",
href: "/inbox",
icon: "M3 13h5l1.5 3h5l1.5-3h5M5 5h14l2 8v6a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1v-6z",
badge: 3,
},
{
label: "My tasks",
href: "/tasks",
icon: "m9 11 3 3 8-8M20 12v7a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1h11",
},
],
},
{
title: "Projects",
items: [
{
label: "Website relaunch",
href: "/projects/website",
icon: "M3 7a2 2 0 0 1 2-2h4l2 2h8a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",
},
{
label: "Design system",
href: "/projects/design-system",
icon: "M4 4h6v6H4zm10 0h6v6h-6zM4 14h6v6H4zm10 0h6v6h-6z",
},
{
label: "Mobile app",
href: "/projects/mobile",
icon: "M8 3h8a1 1 0 0 1 1 1v16a1 1 0 0 1-1 1H8a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1m3 15h2",
},
],
},
];
export default function Example() {
return (
<Sidebar
sections={sections}
breakpoint="sm"
className="h-[600px] rounded-xl border border-line"
header={
<DropdownMenu
items={workspaces}
className={switcher}
trigger={
<>
<svg
className="size-6 shrink-0"
viewBox="0 0 1464 1430"
aria-hidden="true"
>
{mark.map((shape) => (
<polygon
key={shape.points}
points={shape.points}
className={shape.className}
/>
))}
</svg>
<span className="grid text-left leading-tight">
<span className="font-semibold">MarkasUI</span>
<span className="text-xs font-normal text-muted">
Pro workspace
</span>
</span>
</>
}
/>
}
footer={
<div className="grid w-full gap-3 whitespace-normal">
<div className="grid gap-2.5 rounded-xl border border-line bg-canvas p-3 in-data-[state=collapsed]:hidden">
<div className="flex items-center justify-between">
<span className="font-medium text-ink">Free plan</span>
<span className="text-xs text-muted">3 of 5 projects</span>
</div>
<div className="h-1.5 overflow-hidden rounded-full bg-subtle">
<div className="h-full w-3/5 rounded-full bg-success"></div>
</div>
<p className="text-xs leading-relaxed text-muted">
Unlock every template and the Figma kit.
</p>
<a
href="/pricing"
className="inline-flex h-8 items-center justify-center rounded-lg bg-primary text-xs font-medium text-on-primary transition-colors duration-150 ease-out hover:bg-primary-strong"
>
Upgrade to Pro
</a>
</div>
<div className="flex items-center gap-3">
<span className="grid size-8 shrink-0 place-items-center rounded-full bg-primary-soft text-xs font-semibold text-ink">
DA
</span>
<span className="grid min-w-0 leading-tight">
<span className="truncate font-medium text-ink">Dimas Arya</span>
<span className="truncate text-xs text-muted">
dimas@markasui.com
</span>
</span>
</div>
</div>
}
>
<div className="flex min-w-0 flex-1 flex-col gap-4 p-5">
<div className="grid gap-1">
<p className="text-xs text-muted">Monday, 9 November</p>
<p className="text-lg font-semibold tracking-tight text-ink">
Hi, Dimas
</p>
</div>
<div className="grid gap-2 rounded-xl border border-line bg-surface p-4">
<p className="text-xs font-medium text-faint">Today</p>
<p className="text-sm text-ink">Review pricing PR</p>
<p className="text-sm text-ink">Ship Combobox docs</p>
<p className="text-sm text-muted line-through">Fix Modal focus</p>
</div>
</div>
</Sidebar>
);
}<script setup lang="ts">
import DropdownMenu from "@/components/markas/DropdownMenu.vue";
import Sidebar from "@/components/markas/Sidebar.vue";
const mark = [
{ points: "354,578 1256,138 1171,430 268,868", className: "fill-ink/15" },
{ points: "553,443 1455,3 1370,295 467,733", className: "fill-ink/55" },
{
points: "421,762 1325,318 1240,611 336,1050",
className: "fill-success/35",
},
{ points: "265,1073 1169,629 1084,922 180,1362", className: "fill-ink/25" },
{ points: "93,965 997,521 912,814 8,1253", className: "fill-ink/75" },
{
points: "347,1135 1251,691 1166,984 262,1424",
className: "fill-success",
},
];
const workspaces = [
{ label: "MarkasUI", value: "markasui" },
{ label: "MarkasUI Docs", value: "markasui-docs" },
{ separator: true as const },
{ label: "Create workspace", value: "create" },
];
const switcher =
"w-full [&>button]:h-10 [&>button]:w-full [&>button]:justify-start [&>button]:gap-2.5 [&>button]:border-transparent [&>button]:bg-transparent [&>button]:px-1.5 [&>button>svg:last-child]:ms-auto";
const sections = [
{
items: [
{
label: "Home",
href: "/",
icon: "M3 10.5 12 3l9 7.5V20a1 1 0 0 1-1 1h-5v-6h-6v6H4a1 1 0 0 1-1-1z",
active: true,
},
{
label: "Inbox",
href: "/inbox",
icon: "M3 13h5l1.5 3h5l1.5-3h5M5 5h14l2 8v6a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1v-6z",
badge: 3,
},
{
label: "My tasks",
href: "/tasks",
icon: "m9 11 3 3 8-8M20 12v7a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1h11",
},
],
},
{
title: "Projects",
items: [
{
label: "Website relaunch",
href: "/projects/website",
icon: "M3 7a2 2 0 0 1 2-2h4l2 2h8a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",
},
{
label: "Design system",
href: "/projects/design-system",
icon: "M4 4h6v6H4zm10 0h6v6h-6zM4 14h6v6H4zm10 0h6v6h-6z",
},
{
label: "Mobile app",
href: "/projects/mobile",
icon: "M8 3h8a1 1 0 0 1 1 1v16a1 1 0 0 1-1 1H8a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1m3 15h2",
},
],
},
];
</script>
<template>
<Sidebar
:sections="sections"
breakpoint="sm"
class="h-[600px] rounded-xl border border-line"
>
<template #header>
<DropdownMenu :items="workspaces" :class="switcher">
<template #trigger>
<svg
class="size-6 shrink-0"
viewBox="0 0 1464 1430"
aria-hidden="true"
>
<polygon
v-for="shape in mark"
:key="shape.points"
:points="shape.points"
:class="shape.className"
/>
</svg>
<span class="grid text-left leading-tight">
<span class="font-semibold">MarkasUI</span>
<span class="text-xs font-normal text-muted">Pro workspace</span>
</span>
</template>
</DropdownMenu>
</template>
<template #footer>
<div class="grid w-full gap-3 whitespace-normal">
<div
class="grid gap-2.5 rounded-xl border border-line bg-canvas p-3 in-data-[state=collapsed]:hidden"
>
<div class="flex items-center justify-between">
<span class="font-medium text-ink">Free plan</span>
<span class="text-xs text-muted">3 of 5 projects</span>
</div>
<div class="h-1.5 overflow-hidden rounded-full bg-subtle">
<div class="h-full w-3/5 rounded-full bg-success"></div>
</div>
<p class="text-xs leading-relaxed text-muted">
Unlock every template and the Figma kit.
</p>
<a
href="/pricing"
class="inline-flex h-8 items-center justify-center rounded-lg bg-primary text-xs font-medium text-on-primary transition-colors duration-150 ease-out hover:bg-primary-strong"
>
Upgrade to Pro
</a>
</div>
<div class="flex items-center gap-3">
<span
class="grid size-8 shrink-0 place-items-center rounded-full bg-primary-soft text-xs font-semibold text-ink"
>
DA
</span>
<span class="grid min-w-0 leading-tight">
<span class="truncate font-medium text-ink">Dimas Arya</span>
<span class="truncate text-xs text-muted">dimas@markasui.com</span>
</span>
</div>
</div>
</template>
<div class="flex min-w-0 flex-1 flex-col gap-4 p-5">
<div class="grid gap-1">
<p class="text-xs text-muted">Monday, 9 November</p>
<p class="text-lg font-semibold tracking-tight text-ink">Hi, Dimas</p>
</div>
<div class="grid gap-2 rounded-xl border border-line bg-surface p-4">
<p class="text-xs font-medium text-faint">Today</p>
<p class="text-sm text-ink">Review pricing PR</p>
<p class="text-sm text-ink">Ship Combobox docs</p>
<p class="text-sm text-muted line-through">Fix Modal focus</p>
</div>
</div>
</Sidebar>
</template><script lang="ts">
import DropdownMenu from "$lib/components/markas/DropdownMenu.svelte";
import Sidebar from "$lib/components/markas/Sidebar.svelte";
const mark = [
{ points: "354,578 1256,138 1171,430 268,868", className: "fill-ink/15" },
{ points: "553,443 1455,3 1370,295 467,733", className: "fill-ink/55" },
{
points: "421,762 1325,318 1240,611 336,1050",
className: "fill-success/35",
},
{ points: "265,1073 1169,629 1084,922 180,1362", className: "fill-ink/25" },
{ points: "93,965 997,521 912,814 8,1253", className: "fill-ink/75" },
{
points: "347,1135 1251,691 1166,984 262,1424",
className: "fill-success",
},
];
const workspaces = [
{ label: "MarkasUI", value: "markasui" },
{ label: "MarkasUI Docs", value: "markasui-docs" },
{ separator: true as const },
{ label: "Create workspace", value: "create" },
];
const switcher =
"w-full [&>button]:h-10 [&>button]:w-full [&>button]:justify-start [&>button]:gap-2.5 [&>button]:border-transparent [&>button]:bg-transparent [&>button]:px-1.5 [&>button>svg:last-child]:ms-auto";
const sections = [
{
items: [
{
label: "Home",
href: "/",
icon: "M3 10.5 12 3l9 7.5V20a1 1 0 0 1-1 1h-5v-6h-6v6H4a1 1 0 0 1-1-1z",
active: true,
},
{
label: "Inbox",
href: "/inbox",
icon: "M3 13h5l1.5 3h5l1.5-3h5M5 5h14l2 8v6a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1v-6z",
badge: 3,
},
{
label: "My tasks",
href: "/tasks",
icon: "m9 11 3 3 8-8M20 12v7a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1h11",
},
],
},
{
title: "Projects",
items: [
{
label: "Website relaunch",
href: "/projects/website",
icon: "M3 7a2 2 0 0 1 2-2h4l2 2h8a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",
},
{
label: "Design system",
href: "/projects/design-system",
icon: "M4 4h6v6H4zm10 0h6v6h-6zM4 14h6v6H4zm10 0h6v6h-6z",
},
{
label: "Mobile app",
href: "/projects/mobile",
icon: "M8 3h8a1 1 0 0 1 1 1v16a1 1 0 0 1-1 1H8a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1m3 15h2",
},
],
},
];
</script>
<Sidebar
{sections}
breakpoint="sm"
class="h-[600px] rounded-xl border border-line"
>{#snippet header()}
<DropdownMenu items={workspaces} class={switcher}
>{#snippet trigger()}
<svg class="size-6 shrink-0" viewBox="0 0 1464 1430" aria-hidden="true"
>{#each mark as shape (shape.points)}
<polygon points={shape.points} class={shape.className} />
{/each}</svg
>
<span class="grid text-left leading-tight"
><span class="font-semibold">MarkasUI</span>
<span class="text-xs font-normal text-muted">Pro workspace</span
></span
>
{/snippet}</DropdownMenu
>
{/snippet}
{#snippet footer()}
<div class="grid w-full gap-3 whitespace-normal">
<div
class="grid gap-2.5 rounded-xl border border-line bg-canvas p-3 in-data-[state=collapsed]:hidden"
>
<div class="flex items-center justify-between">
<span class="font-medium text-ink">Free plan</span>
<span class="text-xs text-muted">3 of 5 projects</span>
</div>
<div class="h-1.5 overflow-hidden rounded-full bg-subtle">
<div class="h-full w-3/5 rounded-full bg-success"></div>
</div>
<p class="text-xs leading-relaxed text-muted">
Unlock every template and the Figma kit.
</p>
<a
href="/pricing"
class="inline-flex h-8 items-center justify-center rounded-lg bg-primary text-xs font-medium text-on-primary transition-colors duration-150 ease-out hover:bg-primary-strong"
>
Upgrade to Pro
</a>
</div>
<div class="flex items-center gap-3">
<span
class="grid size-8 shrink-0 place-items-center rounded-full bg-primary-soft text-xs font-semibold text-ink"
>
DA
</span>
<span class="grid min-w-0 leading-tight"
><span class="truncate font-medium text-ink">Dimas Arya</span>
<span class="truncate text-xs text-muted">dimas@markasui.com</span
></span
>
</div>
</div>
{/snippet}
<div class="flex min-w-0 flex-1 flex-col gap-4 p-5">
<div class="grid gap-1">
<p class="text-xs text-muted">Monday, 9 November</p>
<p class="text-lg font-semibold tracking-tight text-ink">Hi, Dimas</p>
</div>
<div class="grid gap-2 rounded-xl border border-line bg-surface p-4">
<p class="text-xs font-medium text-faint">Today</p>
<p class="text-sm text-ink">Review pricing PR</p>
<p class="text-sm text-ink">Ship Combobox docs</p>
<p class="text-sm text-muted line-through">Fix Modal focus</p>
</div>
</div></Sidebar
>---
import DropdownMenu from "@/components/markas/DropdownMenu.astro";
import Sidebar from "@/components/markas/Sidebar.astro";
const mark = [
{ points: "354,578 1256,138 1171,430 268,868", className: "fill-ink/15" },
{ points: "553,443 1455,3 1370,295 467,733", className: "fill-ink/55" },
{
points: "421,762 1325,318 1240,611 336,1050",
className: "fill-success/35",
},
{ points: "265,1073 1169,629 1084,922 180,1362", className: "fill-ink/25" },
{ points: "93,965 997,521 912,814 8,1253", className: "fill-ink/75" },
{
points: "347,1135 1251,691 1166,984 262,1424",
className: "fill-success",
},
];
const workspaces = [
{ label: "MarkasUI", value: "markasui" },
{ label: "MarkasUI Docs", value: "markasui-docs" },
{ separator: true as const },
{ label: "Create workspace", value: "create" },
];
const switcher =
"w-full [&>button]:h-10 [&>button]:w-full [&>button]:justify-start [&>button]:gap-2.5 [&>button]:border-transparent [&>button]:bg-transparent [&>button]:px-1.5 [&>button>svg:last-child]:ms-auto";
const sections = [
{
items: [
{
label: "Home",
href: "/",
icon: "M3 10.5 12 3l9 7.5V20a1 1 0 0 1-1 1h-5v-6h-6v6H4a1 1 0 0 1-1-1z",
active: true,
},
{
label: "Inbox",
href: "/inbox",
icon: "M3 13h5l1.5 3h5l1.5-3h5M5 5h14l2 8v6a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1v-6z",
badge: 3,
},
{
label: "My tasks",
href: "/tasks",
icon: "m9 11 3 3 8-8M20 12v7a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1h11",
},
],
},
{
title: "Projects",
items: [
{
label: "Website relaunch",
href: "/projects/website",
icon: "M3 7a2 2 0 0 1 2-2h4l2 2h8a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",
},
{
label: "Design system",
href: "/projects/design-system",
icon: "M4 4h6v6H4zm10 0h6v6h-6zM4 14h6v6H4zm10 0h6v6h-6z",
},
{
label: "Mobile app",
href: "/projects/mobile",
icon: "M8 3h8a1 1 0 0 1 1 1v16a1 1 0 0 1-1 1H8a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1m3 15h2",
},
],
},
];
---
<Sidebar
{sections}
breakpoint="sm"
class="h-[600px] rounded-xl border border-line"
><Fragment slot="header">
<DropdownMenu items={workspaces} class={switcher}
><Fragment slot="trigger">
<svg class="size-6 shrink-0" viewBox="0 0 1464 1430" aria-hidden="true"
>{mark.map((shape) => (
<polygon points={shape.points} class={shape.className} />
))}</svg
>
<span class="grid text-left leading-tight"
><span class="font-semibold">MarkasUI</span>
<span class="text-xs font-normal text-muted">Pro workspace</span
></span
>
</Fragment></DropdownMenu
>
</Fragment>
<Fragment slot="footer">
<div class="grid w-full gap-3 whitespace-normal">
<div
class="grid gap-2.5 rounded-xl border border-line bg-canvas p-3 in-data-[state=collapsed]:hidden"
>
<div class="flex items-center justify-between">
<span class="font-medium text-ink">Free plan</span>
<span class="text-xs text-muted">3 of 5 projects</span>
</div>
<div class="h-1.5 overflow-hidden rounded-full bg-subtle">
<div class="h-full w-3/5 rounded-full bg-success"></div>
</div>
<p class="text-xs leading-relaxed text-muted">
Unlock every template and the Figma kit.
</p>
<a
href="/pricing"
class="inline-flex h-8 items-center justify-center rounded-lg bg-primary text-xs font-medium text-on-primary transition-colors duration-150 ease-out hover:bg-primary-strong"
>
Upgrade to Pro
</a>
</div>
<div class="flex items-center gap-3">
<span
class="grid size-8 shrink-0 place-items-center rounded-full bg-primary-soft text-xs font-semibold text-ink"
>
DA
</span>
<span class="grid min-w-0 leading-tight"
><span class="truncate font-medium text-ink">Dimas Arya</span>
<span class="truncate text-xs text-muted">dimas@markasui.com</span
></span
>
</div>
</div>
</Fragment>
<div class="flex min-w-0 flex-1 flex-col gap-4 p-5">
<div class="grid gap-1">
<p class="text-xs text-muted">Monday, 9 November</p>
<p class="text-lg font-semibold tracking-tight text-ink">Hi, Dimas</p>
</div>
<div class="grid gap-2 rounded-xl border border-line bg-surface p-4">
<p class="text-xs font-medium text-faint">Today</p>
<p class="text-sm text-ink">Review pricing PR</p>
<p class="text-sm text-ink">Ship Combobox docs</p>
<p class="text-sm text-muted line-through">Fix Modal focus</p>
</div>
</div></Sidebar
>import { Component } from "@angular/core";
import { DropdownMenu } from "./markas/dropdown-menu.component";
import { Sidebar } from "./markas/sidebar.component";
const mark = [
{ points: "354,578 1256,138 1171,430 268,868", className: "fill-ink/15" },
{ points: "553,443 1455,3 1370,295 467,733", className: "fill-ink/55" },
{
points: "421,762 1325,318 1240,611 336,1050",
className: "fill-success/35",
},
{ points: "265,1073 1169,629 1084,922 180,1362", className: "fill-ink/25" },
{ points: "93,965 997,521 912,814 8,1253", className: "fill-ink/75" },
{
points: "347,1135 1251,691 1166,984 262,1424",
className: "fill-success",
},
];
const workspaces = [
{ label: "MarkasUI", value: "markasui" },
{ label: "MarkasUI Docs", value: "markasui-docs" },
{ separator: true as const },
{ label: "Create workspace", value: "create" },
];
const switcher =
"w-full [&>button]:h-10 [&>button]:w-full [&>button]:justify-start [&>button]:gap-2.5 [&>button]:border-transparent [&>button]:bg-transparent [&>button]:px-1.5 [&>button>svg:last-child]:ms-auto";
const sections = [
{
items: [
{
label: "Home",
href: "/",
icon: "M3 10.5 12 3l9 7.5V20a1 1 0 0 1-1 1h-5v-6h-6v6H4a1 1 0 0 1-1-1z",
active: true,
},
{
label: "Inbox",
href: "/inbox",
icon: "M3 13h5l1.5 3h5l1.5-3h5M5 5h14l2 8v6a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1v-6z",
badge: 3,
},
{
label: "My tasks",
href: "/tasks",
icon: "m9 11 3 3 8-8M20 12v7a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1h11",
},
],
},
{
title: "Projects",
items: [
{
label: "Website relaunch",
href: "/projects/website",
icon: "M3 7a2 2 0 0 1 2-2h4l2 2h8a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",
},
{
label: "Design system",
href: "/projects/design-system",
icon: "M4 4h6v6H4zm10 0h6v6h-6zM4 14h6v6H4zm10 0h6v6h-6z",
},
{
label: "Mobile app",
href: "/projects/mobile",
icon: "M8 3h8a1 1 0 0 1 1 1v16a1 1 0 0 1-1 1H8a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1m3 15h2",
},
],
},
];
@Component({
selector: "markas-example",
imports: [DropdownMenu, Sidebar],
template: `
<markas-sidebar
[sections]="sections"
breakpoint="sm"
class="h-[600px] rounded-xl border border-line"
><ng-template #header>
<markas-dropdown-menu
[items]="workspaces"
class="w-full [&>button]:h-10 [&>button]:w-full [&>button]:justify-start [&>button]:gap-2.5 [&>button]:border-transparent [&>button]:bg-transparent [&>button]:px-1.5 [&>button>svg:last-child]:ms-auto"
><ng-container trigger>
<svg
class="size-6 shrink-0"
viewBox="0 0 1464 1430"
aria-hidden="true"
>
@for (shape of mark; track shape.points) {
<polygon
[attr.points]="shape.points"
[class]="shape.className"
></polygon>
}
</svg>
<span class="grid text-left leading-tight"
><span class="font-semibold">MarkasUI</span>
<span class="text-xs font-normal text-muted"
>Pro workspace</span
></span
>
</ng-container></markas-dropdown-menu
>
</ng-template>
<ng-template #footer>
<div class="grid w-full gap-3 whitespace-normal">
<div
class="grid gap-2.5 rounded-xl border border-line bg-canvas p-3 in-data-[state=collapsed]:hidden"
>
<div class="flex items-center justify-between">
<span class="font-medium text-ink">Free plan</span>
<span class="text-xs text-muted">3 of 5 projects</span>
</div>
<div class="h-1.5 overflow-hidden rounded-full bg-subtle">
<div class="h-full w-3/5 rounded-full bg-success"></div>
</div>
<p class="text-xs leading-relaxed text-muted">
Unlock every template and the Figma kit.
</p>
<a
href="/pricing"
class="inline-flex h-8 items-center justify-center rounded-lg bg-primary text-xs font-medium text-on-primary transition-colors duration-150 ease-out hover:bg-primary-strong"
>
Upgrade to Pro
</a>
</div>
<div class="flex items-center gap-3">
<span
class="grid size-8 shrink-0 place-items-center rounded-full bg-primary-soft text-xs font-semibold text-ink"
>
DA
</span>
<span class="grid min-w-0 leading-tight"
><span class="truncate font-medium text-ink">Dimas Arya</span>
<span class="truncate text-xs text-muted"
>dimas@markasui.com</span
></span
>
</div>
</div>
</ng-template>
<div class="flex min-w-0 flex-1 flex-col gap-4 p-5">
<div class="grid gap-1">
<p class="text-xs text-muted">Monday, 9 November</p>
<p class="text-lg font-semibold tracking-tight text-ink">Hi, Dimas</p>
</div>
<div class="grid gap-2 rounded-xl border border-line bg-surface p-4">
<p class="text-xs font-medium text-faint">Today</p>
<p class="text-sm text-ink">Review pricing PR</p>
<p class="text-sm text-ink">Ship Combobox docs</p>
<p class="text-sm text-muted line-through">Fix Modal focus</p>
</div>
</div></markas-sidebar
>
`,
})
export default class SidebarWorkspaceExample {
protected readonly mark = mark;
protected readonly workspaces = workspaces;
protected readonly switcher = switcher;
protected readonly sections = sections;
}Rail dan panel
Components
61Forms
Button
Six variants, three sizes, and a loading state.
Components
61Forms
Button
Six variants, three sizes, and a loading state.
Components
61Forms
Button
Six variants, three sizes, and a loading state.
Components
61Forms
Button
Six variants, three sizes, and a loading state.
Components
61Forms
Button
Six variants, three sizes, and a loading state.
@php
$link = 'flex h-8 items-center justify-between rounded-md px-2 text-muted transition-colors duration-150 ease-out hover:bg-subtle hover:text-ink focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary aria-[current=page]:bg-subtle aria-[current=page]:font-medium aria-[current=page]:text-ink motion-reduce:transition-none';
$groups = [
['title' => 'Forms', 'links' => [['Button', 6, true], ['Input', 4, false], ['Select', 3, false], ['Checkbox', 4, false]]],
['title' => 'Overlays', 'links' => [['Modal', 3, false], ['Drawer', 2, false], ['Popover', 4, false]]],
];
@endphp
<x-markas.sidebar :sections="[
[
'items' => [
[
'label' => 'Home',
'href' => '/',
'icon' => 'M3 10.5 12 3l9 7.5V20a1 1 0 0 1-1 1h-5v-6h-6v6H4a1 1 0 0 1-1-1z',
],
[
'label' => 'Inbox',
'href' => '/inbox',
'icon' => 'M3 13h5l1.5 3h5l1.5-3h5M5 5h14l2 8v6a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1v-6z',
'badge' => 2,
],
[
'label' => 'Components',
'href' => '/components',
'icon' => 'M4 4h6v6H4zm10 0h6v6h-6zM4 14h6v6H4zm10 0h6v6h-6z',
'active' => true,
],
[
'label' => 'Templates',
'href' => '/templates',
'icon' => 'M3 4h18v16H3zm0 5h18M9 9v11',
],
[
'label' => 'Analytics',
'href' => '/analytics',
'icon' => 'M3 3v18h18M7 15l4-4 3 3 5-6',
],
],
],
[
'items' => [
[
'label' => 'Settings',
'href' => '/settings',
'icon' => 'M4 6h9m4 0h3M4 12h3m4 0h9M4 18h11m4 0h1M15 4v4M9 10v4M17 16v4',
],
],
],
]" breakpoint="sm" :collapsed="true" class="h-[480px] rounded-xl border border-line">
<x-slot:header>
<svg class="size-7 shrink-0" viewBox="0 0 1464 1430" aria-hidden="true"><polygon points="354,578 1256,138 1171,430 268,868" class="fill-ink/15" /><polygon points="553,443 1455,3 1370,295 467,733" class="fill-ink/55" /><polygon points="421,762 1325,318 1240,611 336,1050" class="fill-success/35" /><polygon points="265,1073 1169,629 1084,922 180,1362" class="fill-ink/25" /><polygon points="93,965 997,521 912,814 8,1253" class="fill-ink/75" /><polygon points="347,1135 1251,691 1166,984 262,1424" class="fill-success" /></svg>
</x-slot:header>
<x-slot:footer>
<span class="grid size-8 shrink-0 place-items-center rounded-full bg-primary-soft text-xs font-semibold text-ink">SW</span>
</x-slot:footer>
<div class="flex min-h-0 flex-1">
<div class="flex w-48 shrink-0 flex-col border-r border-line bg-surface">
<div class="flex h-14 shrink-0 items-center justify-between border-b border-line px-4">
<p class="text-sm font-semibold text-ink">Components</p>
<span class="rounded-full bg-subtle px-2 py-0.5 text-xs text-muted">61</span>
</div>
<nav aria-label="Components" class="grid min-h-0 content-start gap-4 overflow-y-auto p-3 text-sm">
@foreach ($groups as $group)
<div class="grid gap-0.5">
<p class="px-2 pb-1 text-xs font-medium text-faint">{{ $group['title'] }}</p>
@foreach ($group['links'] as [$label, $count, $active])
<a href="#" @if ($active) aria-current="page" @endif class="{{ $link }}">{{ $label }}<span class="text-xs text-faint">{{ $count }}</span></a>
@endforeach
</div>
@endforeach
</nav>
</div>
<div class="flex min-w-0 flex-1 flex-col gap-3 p-4">
<div class="grid gap-1">
<p class="text-xs text-muted">Forms</p>
<p class="text-base font-semibold text-ink">Button</p>
<p class="text-xs leading-relaxed text-muted">Six variants, three sizes, and a loading state.</p>
</div>
<div class="grid flex-1 place-content-center justify-items-center gap-2 rounded-xl border border-line bg-surface p-4">
<span class="rounded-lg bg-primary px-3 py-1.5 text-xs font-medium text-on-primary">Get started</span>
<span class="rounded-lg border border-line px-3 py-1.5 text-xs font-medium text-ink">View docs</span>
</div>
</div>
</div>
</x-markas.sidebar>import { Sidebar } from "@/components/markas/Sidebar";
const mark = [
{ points: "354,578 1256,138 1171,430 268,868", className: "fill-ink/15" },
{ points: "553,443 1455,3 1370,295 467,733", className: "fill-ink/55" },
{
points: "421,762 1325,318 1240,611 336,1050",
className: "fill-success/35",
},
{ points: "265,1073 1169,629 1084,922 180,1362", className: "fill-ink/25" },
{ points: "93,965 997,521 912,814 8,1253", className: "fill-ink/75" },
{
points: "347,1135 1251,691 1166,984 262,1424",
className: "fill-success",
},
];
const sections = [
{
items: [
{
label: "Home",
href: "/",
icon: "M3 10.5 12 3l9 7.5V20a1 1 0 0 1-1 1h-5v-6h-6v6H4a1 1 0 0 1-1-1z",
},
{
label: "Inbox",
href: "/inbox",
icon: "M3 13h5l1.5 3h5l1.5-3h5M5 5h14l2 8v6a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1v-6z",
badge: 2,
},
{
label: "Components",
href: "/components",
icon: "M4 4h6v6H4zm10 0h6v6h-6zM4 14h6v6H4zm10 0h6v6h-6z",
active: true,
},
{
label: "Templates",
href: "/templates",
icon: "M3 4h18v16H3zm0 5h18M9 9v11",
},
{
label: "Analytics",
href: "/analytics",
icon: "M3 3v18h18M7 15l4-4 3 3 5-6",
},
],
},
{
items: [
{
label: "Settings",
href: "/settings",
icon: "M4 6h9m4 0h3M4 12h3m4 0h9M4 18h11m4 0h1M15 4v4M9 10v4M17 16v4",
},
],
},
];
const groups = [
{
title: "Forms",
links: [
{ label: "Button", count: 6, active: true },
{ label: "Input", count: 4 },
{ label: "Select", count: 3 },
{ label: "Checkbox", count: 4 },
],
},
{
title: "Overlays",
links: [
{ label: "Modal", count: 3 },
{ label: "Drawer", count: 2 },
{ label: "Popover", count: 4 },
],
},
];
const link =
"flex h-8 items-center justify-between rounded-md px-2 text-muted transition-colors duration-150 ease-out hover:bg-subtle hover:text-ink focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary aria-[current=page]:bg-subtle aria-[current=page]:font-medium aria-[current=page]:text-ink motion-reduce:transition-none";
export default function Example() {
return (
<Sidebar
sections={sections}
breakpoint="sm"
defaultCollapsed
className="h-[480px] rounded-xl border border-line"
header={
<svg
className="size-7 shrink-0"
viewBox="0 0 1464 1430"
aria-hidden="true"
>
{mark.map((shape) => (
<polygon
key={shape.points}
points={shape.points}
className={shape.className}
/>
))}
</svg>
}
footer={
<span className="grid size-8 shrink-0 place-items-center rounded-full bg-primary-soft text-xs font-semibold text-ink">
SW
</span>
}
>
<div className="flex min-h-0 flex-1">
<div className="flex w-48 shrink-0 flex-col border-r border-line bg-surface">
<div className="flex h-14 shrink-0 items-center justify-between border-b border-line px-4">
<p className="text-sm font-semibold text-ink">Components</p>
<span className="rounded-full bg-subtle px-2 py-0.5 text-xs text-muted">
61
</span>
</div>
<nav
aria-label="Components"
className="grid min-h-0 content-start gap-4 overflow-y-auto p-3 text-sm"
>
{groups.map((group) => (
<div key={group.title} className="grid gap-0.5">
<p className="px-2 pb-1 text-xs font-medium text-faint">
{group.title}
</p>
{group.links.map((item) => (
<a
key={item.label}
href="#"
aria-current={item.active ? "page" : undefined}
className={link}
>
{item.label}
<span className="text-xs text-faint">{item.count}</span>
</a>
))}
</div>
))}
</nav>
</div>
<div className="flex min-w-0 flex-1 flex-col gap-3 p-4">
<div className="grid gap-1">
<p className="text-xs text-muted">Forms</p>
<p className="text-base font-semibold text-ink">Button</p>
<p className="text-xs leading-relaxed text-muted">
Six variants, three sizes, and a loading state.
</p>
</div>
<div className="grid flex-1 place-content-center justify-items-center gap-2 rounded-xl border border-line bg-surface p-4">
<span className="rounded-lg bg-primary px-3 py-1.5 text-xs font-medium text-on-primary">
Get started
</span>
<span className="rounded-lg border border-line px-3 py-1.5 text-xs font-medium text-ink">
View docs
</span>
</div>
</div>
</div>
</Sidebar>
);
}<script setup lang="ts">
import Sidebar from "@/components/markas/Sidebar.vue";
const mark = [
{ points: "354,578 1256,138 1171,430 268,868", className: "fill-ink/15" },
{ points: "553,443 1455,3 1370,295 467,733", className: "fill-ink/55" },
{
points: "421,762 1325,318 1240,611 336,1050",
className: "fill-success/35",
},
{ points: "265,1073 1169,629 1084,922 180,1362", className: "fill-ink/25" },
{ points: "93,965 997,521 912,814 8,1253", className: "fill-ink/75" },
{
points: "347,1135 1251,691 1166,984 262,1424",
className: "fill-success",
},
];
const sections = [
{
items: [
{
label: "Home",
href: "/",
icon: "M3 10.5 12 3l9 7.5V20a1 1 0 0 1-1 1h-5v-6h-6v6H4a1 1 0 0 1-1-1z",
},
{
label: "Inbox",
href: "/inbox",
icon: "M3 13h5l1.5 3h5l1.5-3h5M5 5h14l2 8v6a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1v-6z",
badge: 2,
},
{
label: "Components",
href: "/components",
icon: "M4 4h6v6H4zm10 0h6v6h-6zM4 14h6v6H4zm10 0h6v6h-6z",
active: true,
},
{
label: "Templates",
href: "/templates",
icon: "M3 4h18v16H3zm0 5h18M9 9v11",
},
{
label: "Analytics",
href: "/analytics",
icon: "M3 3v18h18M7 15l4-4 3 3 5-6",
},
],
},
{
items: [
{
label: "Settings",
href: "/settings",
icon: "M4 6h9m4 0h3M4 12h3m4 0h9M4 18h11m4 0h1M15 4v4M9 10v4M17 16v4",
},
],
},
];
const groups = [
{
title: "Forms",
links: [
{ label: "Button", count: 6, active: true },
{ label: "Input", count: 4 },
{ label: "Select", count: 3 },
{ label: "Checkbox", count: 4 },
],
},
{
title: "Overlays",
links: [
{ label: "Modal", count: 3 },
{ label: "Drawer", count: 2 },
{ label: "Popover", count: 4 },
],
},
];
const link =
"flex h-8 items-center justify-between rounded-md px-2 text-muted transition-colors duration-150 ease-out hover:bg-subtle hover:text-ink focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary aria-[current=page]:bg-subtle aria-[current=page]:font-medium aria-[current=page]:text-ink motion-reduce:transition-none";
</script>
<template>
<Sidebar
:sections="sections"
breakpoint="sm"
:collapsed="true"
class="h-[480px] rounded-xl border border-line"
>
<template #header>
<svg class="size-7 shrink-0" viewBox="0 0 1464 1430" aria-hidden="true">
<polygon
v-for="shape in mark"
:key="shape.points"
:points="shape.points"
:class="shape.className"
/>
</svg>
</template>
<template #footer>
<span
class="grid size-8 shrink-0 place-items-center rounded-full bg-primary-soft text-xs font-semibold text-ink"
>
SW
</span>
</template>
<div class="flex min-h-0 flex-1">
<div class="flex w-48 shrink-0 flex-col border-r border-line bg-surface">
<div
class="flex h-14 shrink-0 items-center justify-between border-b border-line px-4"
>
<p class="text-sm font-semibold text-ink">Components</p>
<span class="rounded-full bg-subtle px-2 py-0.5 text-xs text-muted">
61
</span>
</div>
<nav
aria-label="Components"
class="grid min-h-0 content-start gap-4 overflow-y-auto p-3 text-sm"
>
<div v-for="group in groups" :key="group.title" class="grid gap-0.5">
<p class="px-2 pb-1 text-xs font-medium text-faint">
{{ group.title }}
</p>
<a
v-for="item in group.links"
:key="item.label"
href="#"
:aria-current="item.active ? 'page' : undefined"
:class="link"
>
{{ item.label }}
<span class="text-xs text-faint">{{ item.count }}</span>
</a>
</div>
</nav>
</div>
<div class="flex min-w-0 flex-1 flex-col gap-3 p-4">
<div class="grid gap-1">
<p class="text-xs text-muted">Forms</p>
<p class="text-base font-semibold text-ink">Button</p>
<p class="text-xs leading-relaxed text-muted">
Six variants, three sizes, and a loading state.
</p>
</div>
<div
class="grid flex-1 place-content-center justify-items-center gap-2 rounded-xl border border-line bg-surface p-4"
>
<span
class="rounded-lg bg-primary px-3 py-1.5 text-xs font-medium text-on-primary"
>
Get started
</span>
<span
class="rounded-lg border border-line px-3 py-1.5 text-xs font-medium text-ink"
>
View docs
</span>
</div>
</div>
</div>
</Sidebar>
</template><script lang="ts">
import Sidebar from "$lib/components/markas/Sidebar.svelte";
const mark = [
{ points: "354,578 1256,138 1171,430 268,868", className: "fill-ink/15" },
{ points: "553,443 1455,3 1370,295 467,733", className: "fill-ink/55" },
{
points: "421,762 1325,318 1240,611 336,1050",
className: "fill-success/35",
},
{ points: "265,1073 1169,629 1084,922 180,1362", className: "fill-ink/25" },
{ points: "93,965 997,521 912,814 8,1253", className: "fill-ink/75" },
{
points: "347,1135 1251,691 1166,984 262,1424",
className: "fill-success",
},
];
const sections = [
{
items: [
{
label: "Home",
href: "/",
icon: "M3 10.5 12 3l9 7.5V20a1 1 0 0 1-1 1h-5v-6h-6v6H4a1 1 0 0 1-1-1z",
},
{
label: "Inbox",
href: "/inbox",
icon: "M3 13h5l1.5 3h5l1.5-3h5M5 5h14l2 8v6a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1v-6z",
badge: 2,
},
{
label: "Components",
href: "/components",
icon: "M4 4h6v6H4zm10 0h6v6h-6zM4 14h6v6H4zm10 0h6v6h-6z",
active: true,
},
{
label: "Templates",
href: "/templates",
icon: "M3 4h18v16H3zm0 5h18M9 9v11",
},
{
label: "Analytics",
href: "/analytics",
icon: "M3 3v18h18M7 15l4-4 3 3 5-6",
},
],
},
{
items: [
{
label: "Settings",
href: "/settings",
icon: "M4 6h9m4 0h3M4 12h3m4 0h9M4 18h11m4 0h1M15 4v4M9 10v4M17 16v4",
},
],
},
];
const groups = [
{
title: "Forms",
links: [
{ label: "Button", count: 6, active: true },
{ label: "Input", count: 4 },
{ label: "Select", count: 3 },
{ label: "Checkbox", count: 4 },
],
},
{
title: "Overlays",
links: [
{ label: "Modal", count: 3 },
{ label: "Drawer", count: 2 },
{ label: "Popover", count: 4 },
],
},
];
const link =
"flex h-8 items-center justify-between rounded-md px-2 text-muted transition-colors duration-150 ease-out hover:bg-subtle hover:text-ink focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary aria-[current=page]:bg-subtle aria-[current=page]:font-medium aria-[current=page]:text-ink motion-reduce:transition-none";
</script>
<Sidebar
{sections}
breakpoint="sm"
collapsed={true}
class="h-[480px] rounded-xl border border-line"
>{#snippet header()}
<svg class="size-7 shrink-0" viewBox="0 0 1464 1430" aria-hidden="true"
>{#each mark as shape (shape.points)}
<polygon points={shape.points} class={shape.className} />
{/each}</svg
>
{/snippet}
{#snippet footer()}
<span
class="grid size-8 shrink-0 place-items-center rounded-full bg-primary-soft text-xs font-semibold text-ink"
>
SW
</span>
{/snippet}
<div class="flex min-h-0 flex-1">
<div class="flex w-48 shrink-0 flex-col border-r border-line bg-surface">
<div
class="flex h-14 shrink-0 items-center justify-between border-b border-line px-4"
>
<p class="text-sm font-semibold text-ink">Components</p>
<span class="rounded-full bg-subtle px-2 py-0.5 text-xs text-muted">
61
</span>
</div>
<nav
aria-label="Components"
class="grid min-h-0 content-start gap-4 overflow-y-auto p-3 text-sm"
>
{#each groups as group (group.title)}
<div class="grid gap-0.5">
<p class="px-2 pb-1 text-xs font-medium text-faint">
{group.title}
</p>
{#each group.links as item (item.label)}
<!-- svelte-ignore a11y_invalid_attribute -->
<a
href="#"
aria-current={item.active ? "page" : undefined}
class={link}
>{item.label}
<span class="text-xs text-faint">{item.count}</span></a
>
{/each}
</div>
{/each}
</nav>
</div>
<div class="flex min-w-0 flex-1 flex-col gap-3 p-4">
<div class="grid gap-1">
<p class="text-xs text-muted">Forms</p>
<p class="text-base font-semibold text-ink">Button</p>
<p class="text-xs leading-relaxed text-muted">
Six variants, three sizes, and a loading state.
</p>
</div>
<div
class="grid flex-1 place-content-center justify-items-center gap-2 rounded-xl border border-line bg-surface p-4"
>
<span
class="rounded-lg bg-primary px-3 py-1.5 text-xs font-medium text-on-primary"
>
Get started
</span>
<span
class="rounded-lg border border-line px-3 py-1.5 text-xs font-medium text-ink"
>
View docs
</span>
</div>
</div>
</div></Sidebar
>---
import Sidebar from "@/components/markas/Sidebar.astro";
const mark = [
{ points: "354,578 1256,138 1171,430 268,868", className: "fill-ink/15" },
{ points: "553,443 1455,3 1370,295 467,733", className: "fill-ink/55" },
{
points: "421,762 1325,318 1240,611 336,1050",
className: "fill-success/35",
},
{ points: "265,1073 1169,629 1084,922 180,1362", className: "fill-ink/25" },
{ points: "93,965 997,521 912,814 8,1253", className: "fill-ink/75" },
{
points: "347,1135 1251,691 1166,984 262,1424",
className: "fill-success",
},
];
const sections = [
{
items: [
{
label: "Home",
href: "/",
icon: "M3 10.5 12 3l9 7.5V20a1 1 0 0 1-1 1h-5v-6h-6v6H4a1 1 0 0 1-1-1z",
},
{
label: "Inbox",
href: "/inbox",
icon: "M3 13h5l1.5 3h5l1.5-3h5M5 5h14l2 8v6a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1v-6z",
badge: 2,
},
{
label: "Components",
href: "/components",
icon: "M4 4h6v6H4zm10 0h6v6h-6zM4 14h6v6H4zm10 0h6v6h-6z",
active: true,
},
{
label: "Templates",
href: "/templates",
icon: "M3 4h18v16H3zm0 5h18M9 9v11",
},
{
label: "Analytics",
href: "/analytics",
icon: "M3 3v18h18M7 15l4-4 3 3 5-6",
},
],
},
{
items: [
{
label: "Settings",
href: "/settings",
icon: "M4 6h9m4 0h3M4 12h3m4 0h9M4 18h11m4 0h1M15 4v4M9 10v4M17 16v4",
},
],
},
];
const groups = [
{
title: "Forms",
links: [
{ label: "Button", count: 6, active: true },
{ label: "Input", count: 4 },
{ label: "Select", count: 3 },
{ label: "Checkbox", count: 4 },
],
},
{
title: "Overlays",
links: [
{ label: "Modal", count: 3 },
{ label: "Drawer", count: 2 },
{ label: "Popover", count: 4 },
],
},
];
const link =
"flex h-8 items-center justify-between rounded-md px-2 text-muted transition-colors duration-150 ease-out hover:bg-subtle hover:text-ink focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary aria-[current=page]:bg-subtle aria-[current=page]:font-medium aria-[current=page]:text-ink motion-reduce:transition-none";
---
<Sidebar
{sections}
breakpoint="sm"
collapsed={true}
class="h-[480px] rounded-xl border border-line"
><Fragment slot="header">
<svg class="size-7 shrink-0" viewBox="0 0 1464 1430" aria-hidden="true"
>{mark.map((shape) => (
<polygon points={shape.points} class={shape.className} />
))}</svg
>
</Fragment>
<Fragment slot="footer">
<span
class="grid size-8 shrink-0 place-items-center rounded-full bg-primary-soft text-xs font-semibold text-ink"
>
SW
</span>
</Fragment>
<div class="flex min-h-0 flex-1">
<div class="flex w-48 shrink-0 flex-col border-r border-line bg-surface">
<div
class="flex h-14 shrink-0 items-center justify-between border-b border-line px-4"
>
<p class="text-sm font-semibold text-ink">Components</p>
<span class="rounded-full bg-subtle px-2 py-0.5 text-xs text-muted">
61
</span>
</div>
<nav
aria-label="Components"
class="grid min-h-0 content-start gap-4 overflow-y-auto p-3 text-sm"
>
{groups.map((group) => (
<div class="grid gap-0.5">
<p class="px-2 pb-1 text-xs font-medium text-faint">
{group.title}
</p>
{group.links.map((item) => (
<a
href="#"
aria-current={item.active ? "page" : undefined}
class={link}
>{item.label}
<span class="text-xs text-faint">{item.count}</span></a
>
))}
</div>
))}
</nav>
</div>
<div class="flex min-w-0 flex-1 flex-col gap-3 p-4">
<div class="grid gap-1">
<p class="text-xs text-muted">Forms</p>
<p class="text-base font-semibold text-ink">Button</p>
<p class="text-xs leading-relaxed text-muted">
Six variants, three sizes, and a loading state.
</p>
</div>
<div
class="grid flex-1 place-content-center justify-items-center gap-2 rounded-xl border border-line bg-surface p-4"
>
<span
class="rounded-lg bg-primary px-3 py-1.5 text-xs font-medium text-on-primary"
>
Get started
</span>
<span
class="rounded-lg border border-line px-3 py-1.5 text-xs font-medium text-ink"
>
View docs
</span>
</div>
</div>
</div></Sidebar
>import { Component } from "@angular/core";
import { Sidebar } from "./markas/sidebar.component";
const mark = [
{ points: "354,578 1256,138 1171,430 268,868", className: "fill-ink/15" },
{ points: "553,443 1455,3 1370,295 467,733", className: "fill-ink/55" },
{
points: "421,762 1325,318 1240,611 336,1050",
className: "fill-success/35",
},
{ points: "265,1073 1169,629 1084,922 180,1362", className: "fill-ink/25" },
{ points: "93,965 997,521 912,814 8,1253", className: "fill-ink/75" },
{
points: "347,1135 1251,691 1166,984 262,1424",
className: "fill-success",
},
];
const sections = [
{
items: [
{
label: "Home",
href: "/",
icon: "M3 10.5 12 3l9 7.5V20a1 1 0 0 1-1 1h-5v-6h-6v6H4a1 1 0 0 1-1-1z",
},
{
label: "Inbox",
href: "/inbox",
icon: "M3 13h5l1.5 3h5l1.5-3h5M5 5h14l2 8v6a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1v-6z",
badge: 2,
},
{
label: "Components",
href: "/components",
icon: "M4 4h6v6H4zm10 0h6v6h-6zM4 14h6v6H4zm10 0h6v6h-6z",
active: true,
},
{
label: "Templates",
href: "/templates",
icon: "M3 4h18v16H3zm0 5h18M9 9v11",
},
{
label: "Analytics",
href: "/analytics",
icon: "M3 3v18h18M7 15l4-4 3 3 5-6",
},
],
},
{
items: [
{
label: "Settings",
href: "/settings",
icon: "M4 6h9m4 0h3M4 12h3m4 0h9M4 18h11m4 0h1M15 4v4M9 10v4M17 16v4",
},
],
},
];
const groups = [
{
title: "Forms",
links: [
{ label: "Button", count: 6, active: true },
{ label: "Input", count: 4 },
{ label: "Select", count: 3 },
{ label: "Checkbox", count: 4 },
],
},
{
title: "Overlays",
links: [
{ label: "Modal", count: 3 },
{ label: "Drawer", count: 2 },
{ label: "Popover", count: 4 },
],
},
];
const link =
"flex h-8 items-center justify-between rounded-md px-2 text-muted transition-colors duration-150 ease-out hover:bg-subtle hover:text-ink focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary aria-[current=page]:bg-subtle aria-[current=page]:font-medium aria-[current=page]:text-ink motion-reduce:transition-none";
@Component({
selector: "markas-example",
imports: [Sidebar],
template: `
<markas-sidebar
[sections]="sections"
breakpoint="sm"
collapsed
class="h-[480px] rounded-xl border border-line"
><ng-template #header>
<svg class="size-7 shrink-0" viewBox="0 0 1464 1430" aria-hidden="true">
@for (shape of mark; track shape.points) {
<polygon
[attr.points]="shape.points"
[class]="shape.className"
></polygon>
}
</svg>
</ng-template>
<ng-template #footer>
<span
class="grid size-8 shrink-0 place-items-center rounded-full bg-primary-soft text-xs font-semibold text-ink"
>
SW
</span>
</ng-template>
<div class="flex min-h-0 flex-1">
<div
class="flex w-48 shrink-0 flex-col border-r border-line bg-surface"
>
<div
class="flex h-14 shrink-0 items-center justify-between border-b border-line px-4"
>
<p class="text-sm font-semibold text-ink">Components</p>
<span class="rounded-full bg-subtle px-2 py-0.5 text-xs text-muted">
61
</span>
</div>
<nav
aria-label="Components"
class="grid min-h-0 content-start gap-4 overflow-y-auto p-3 text-sm"
>
@for (group of groups; track group.title) {
<div class="grid gap-0.5">
<p class="px-2 pb-1 text-xs font-medium text-faint">
{{ group.title }}
</p>
@for (item of group.links; track item.label) {
<a
href="#"
[attr.aria-current]="item.active ? 'page' : null"
class="flex h-8 items-center justify-between rounded-md px-2 text-muted transition-colors duration-150 ease-out hover:bg-subtle hover:text-ink focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary aria-[current=page]:bg-subtle aria-[current=page]:font-medium aria-[current=page]:text-ink motion-reduce:transition-none"
>{{ item.label }}
<span class="text-xs text-faint">{{ item.count }}</span></a
>
}
</div>
}
</nav>
</div>
<div class="flex min-w-0 flex-1 flex-col gap-3 p-4">
<div class="grid gap-1">
<p class="text-xs text-muted">Forms</p>
<p class="text-base font-semibold text-ink">Button</p>
<p class="text-xs leading-relaxed text-muted">
Six variants, three sizes, and a loading state.
</p>
</div>
<div
class="grid flex-1 place-content-center justify-items-center gap-2 rounded-xl border border-line bg-surface p-4"
>
<span
class="rounded-lg bg-primary px-3 py-1.5 text-xs font-medium text-on-primary"
>
Get started
</span>
<span
class="rounded-lg border border-line px-3 py-1.5 text-xs font-medium text-ink"
>
View docs
</span>
</div>
</div>
</div></markas-sidebar
>
`,
})
export default class SidebarDualExample {
protected readonly mark = mark;
protected readonly sections = sections;
protected readonly groups = groups;
protected readonly link = link;
}Pencarian dan grup
No results found.
Jump to anything
Search projects, reports, and actions without leaving the keyboard.
Jump to anything
Search projects, reports, and actions without leaving the keyboard.
Jump to anything
Search projects, reports, and actions without leaving the keyboard.
Jump to anything
Search projects, reports, and actions without leaving the keyboard.
No results found.
No results found.
Jump to anything
Search projects, reports, and actions without leaving the keyboard.
@php
$commands = [
['group' => 'Projects', 'label' => 'Website relaunch', 'value' => 'website'],
['group' => 'Projects', 'label' => 'Design system', 'value' => 'design-system'],
['group' => 'Reports', 'label' => 'Weekly summary', 'value' => 'weekly'],
['group' => 'Actions', 'label' => 'Create project', 'value' => 'create-project'],
['group' => 'Actions', 'label' => 'Invite teammate', 'value' => 'invite'],
];
@endphp
<x-markas.sidebar :sections="[
[
'items' => [
[
'label' => 'Home',
'href' => '/',
'icon' => 'M3 10.5 12 3l9 7.5V20a1 1 0 0 1-1 1h-5v-6h-6v6H4a1 1 0 0 1-1-1z',
],
[
'label' => 'Inbox',
'href' => '/inbox',
'icon' => 'M3 13h5l1.5 3h5l1.5-3h5M5 5h14l2 8v6a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1v-6z',
'badge' => 8,
],
],
],
[
'title' => 'Workspace',
'items' => [
[
'label' => 'Projects',
'icon' => 'M3 7a2 2 0 0 1 2-2h4l2 2h8a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z',
'children' => [
['label' => 'Website relaunch', 'href' => '/projects/website', 'active' => true],
['label' => 'Design system', 'href' => '/projects/design-system'],
['label' => 'Mobile app', 'href' => '/projects/mobile'],
],
],
[
'label' => 'Reports',
'icon' => 'M3 3v18h18M7 15l4-4 3 3 5-6',
'children' => [
['label' => 'Weekly summary', 'href' => '/reports/weekly'],
['label' => 'Revenue', 'href' => '/reports/revenue'],
['label' => 'Retention', 'href' => '/reports/retention'],
],
],
[
'label' => 'Team',
'icon' => 'M16 19v-1a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v1M9 10a3 3 0 1 0 0-6 3 3 0 0 0 0 6m13 9v-1a4 4 0 0 0-3-3.9M16 4.1a3 3 0 0 1 0 5.8',
'children' => [
['label' => 'Members', 'href' => '/team/members'],
['label' => 'Invitations', 'href' => '/team/invitations'],
],
],
],
],
[
'title' => 'Favorites',
'items' => [
[
'label' => 'Q4 roadmap',
'href' => '/docs/roadmap',
'icon' => 'm12 3 2.8 5.7 6.2.9-4.5 4.4 1 6.2-5.5-2.9-5.5 2.9 1-6.2L3 9.6l6.2-.9z',
],
],
],
]" breakpoint="sm" class="h-[560px] rounded-xl border border-line">
<x-slot:header>
<svg class="size-7 shrink-0" viewBox="0 0 1464 1430" aria-hidden="true"><polygon points="354,578 1256,138 1171,430 268,868" class="fill-ink/15" /><polygon points="553,443 1455,3 1370,295 467,733" class="fill-ink/55" /><polygon points="421,762 1325,318 1240,611 336,1050" class="fill-success/35" /><polygon points="265,1073 1169,629 1084,922 180,1362" class="fill-ink/25" /><polygon points="93,965 997,521 912,814 8,1253" class="fill-ink/75" /><polygon points="347,1135 1251,691 1166,984 262,1424" class="fill-success" /></svg>
<span class="font-semibold text-ink">MarkasUI</span>
<x-markas.command :items="$commands" placeholder-label="Search projects and actions...">
<x-slot:trigger>
<button type="button" class="ms-auto me-2 flex h-7 shrink-0 items-center gap-1.5 rounded-md border border-line bg-canvas px-2 text-xs text-muted transition-colors duration-150 ease-out hover:text-ink motion-reduce:transition-none"><svg class="size-3.5" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="11" cy="11" r="7" /><path d="m20 20-3.5-3.5" /></svg><span class="sr-only">Search</span><kbd class="font-sans">⌘K</kbd></button>
</x-slot:trigger>
</x-markas.command>
</x-slot:header>
<x-slot:footer>
<span class="grid size-8 shrink-0 place-items-center rounded-full bg-primary-soft text-xs font-semibold text-ink">PK</span>
<span class="grid min-w-0 leading-tight"><span class="truncate font-medium text-ink">Putri Kirana</span><span class="truncate text-xs text-muted">Admin</span></span>
</x-slot:footer>
{{-- Ctrl+K or Cmd+K opens the same palette from anywhere on the page. --}}
<x-markas.command hotkey :items="$commands" placeholder-label="Search projects and actions..." />
<div class="flex flex-1 flex-col items-center justify-center gap-3 p-6 text-center">
<div class="flex gap-1">
<kbd class="grid size-8 place-items-center rounded-lg border border-line bg-surface font-sans text-sm text-ink">⌘</kbd>
<kbd class="grid size-8 place-items-center rounded-lg border border-line bg-surface font-sans text-sm text-ink">K</kbd>
</div>
<p class="text-sm font-medium text-ink">Jump to anything</p>
<p class="max-w-48 text-xs leading-relaxed text-muted">Search projects, reports, and actions without leaving the keyboard.</p>
</div>
</x-markas.sidebar>import { Command } from "@/components/markas/Command";
import { Sidebar } from "@/components/markas/Sidebar";
const mark = [
{ points: "354,578 1256,138 1171,430 268,868", className: "fill-ink/15" },
{ points: "553,443 1455,3 1370,295 467,733", className: "fill-ink/55" },
{
points: "421,762 1325,318 1240,611 336,1050",
className: "fill-success/35",
},
{ points: "265,1073 1169,629 1084,922 180,1362", className: "fill-ink/25" },
{ points: "93,965 997,521 912,814 8,1253", className: "fill-ink/75" },
{
points: "347,1135 1251,691 1166,984 262,1424",
className: "fill-success",
},
];
const commands = [
{ group: "Projects", label: "Website relaunch", value: "website" },
{ group: "Projects", label: "Design system", value: "design-system" },
{ group: "Reports", label: "Weekly summary", value: "weekly" },
{ group: "Actions", label: "Create project", value: "create-project" },
{ group: "Actions", label: "Invite teammate", value: "invite" },
];
const sections = [
{
items: [
{
label: "Home",
href: "/",
icon: "M3 10.5 12 3l9 7.5V20a1 1 0 0 1-1 1h-5v-6h-6v6H4a1 1 0 0 1-1-1z",
},
{
label: "Inbox",
href: "/inbox",
icon: "M3 13h5l1.5 3h5l1.5-3h5M5 5h14l2 8v6a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1v-6z",
badge: 8,
},
],
},
{
title: "Workspace",
items: [
{
label: "Projects",
icon: "M3 7a2 2 0 0 1 2-2h4l2 2h8a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",
children: [
{
label: "Website relaunch",
href: "/projects/website",
active: true,
},
{ label: "Design system", href: "/projects/design-system" },
{ label: "Mobile app", href: "/projects/mobile" },
],
},
{
label: "Reports",
icon: "M3 3v18h18M7 15l4-4 3 3 5-6",
children: [
{ label: "Weekly summary", href: "/reports/weekly" },
{ label: "Revenue", href: "/reports/revenue" },
{ label: "Retention", href: "/reports/retention" },
],
},
{
label: "Team",
icon: "M16 19v-1a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v1M9 10a3 3 0 1 0 0-6 3 3 0 0 0 0 6m13 9v-1a4 4 0 0 0-3-3.9M16 4.1a3 3 0 0 1 0 5.8",
children: [
{ label: "Members", href: "/team/members" },
{ label: "Invitations", href: "/team/invitations" },
],
},
],
},
{
title: "Favorites",
items: [
{
label: "Q4 roadmap",
href: "/docs/roadmap",
icon: "m12 3 2.8 5.7 6.2.9-4.5 4.4 1 6.2-5.5-2.9-5.5 2.9 1-6.2L3 9.6l6.2-.9z",
},
],
},
];
export default function Example() {
return (
<Sidebar
sections={sections}
breakpoint="sm"
className="h-[560px] rounded-xl border border-line"
header={
<>
<svg
className="size-7 shrink-0"
viewBox="0 0 1464 1430"
aria-hidden="true"
>
{mark.map((shape) => (
<polygon
key={shape.points}
points={shape.points}
className={shape.className}
/>
))}
</svg>
<span className="font-semibold text-ink">MarkasUI</span>
<Command
items={commands}
placeholderLabel="Search projects and actions..."
trigger={
<button
type="button"
className="ms-auto me-2 flex h-7 shrink-0 items-center gap-1.5 rounded-md border border-line bg-canvas px-2 text-xs text-muted transition-colors duration-150 ease-out hover:text-ink motion-reduce:transition-none"
>
<svg
className="size-3.5"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
strokeWidth="1.5"
strokeLinecap="round"
strokeLinejoin="round"
aria-hidden="true"
>
<circle cx="11" cy="11" r="7" />
<path d="m20 20-3.5-3.5" />
</svg>
<span className="sr-only">Search</span>
<kbd className="font-sans">⌘K</kbd>
</button>
}
/>
</>
}
footer={
<>
<span className="grid size-8 shrink-0 place-items-center rounded-full bg-primary-soft text-xs font-semibold text-ink">
PK
</span>
<span className="grid min-w-0 leading-tight">
<span className="truncate font-medium text-ink">Putri Kirana</span>
<span className="truncate text-xs text-muted">Admin</span>
</span>
</>
}
>
{/* Ctrl+K or Cmd+K opens the same palette from anywhere on the page. */}
<Command
hotkey
items={commands}
placeholderLabel="Search projects and actions..."
/>
<div className="flex flex-1 flex-col items-center justify-center gap-3 p-6 text-center">
<div className="flex gap-1">
<kbd className="grid size-8 place-items-center rounded-lg border border-line bg-surface font-sans text-sm text-ink">
⌘
</kbd>
<kbd className="grid size-8 place-items-center rounded-lg border border-line bg-surface font-sans text-sm text-ink">
K
</kbd>
</div>
<p className="text-sm font-medium text-ink">Jump to anything</p>
<p className="max-w-48 text-xs leading-relaxed text-muted">
Search projects, reports, and actions without leaving the keyboard.
</p>
</div>
</Sidebar>
);
}<script setup lang="ts">
import Command from "@/components/markas/Command.vue";
import Sidebar from "@/components/markas/Sidebar.vue";
const mark = [
{ points: "354,578 1256,138 1171,430 268,868", className: "fill-ink/15" },
{ points: "553,443 1455,3 1370,295 467,733", className: "fill-ink/55" },
{
points: "421,762 1325,318 1240,611 336,1050",
className: "fill-success/35",
},
{ points: "265,1073 1169,629 1084,922 180,1362", className: "fill-ink/25" },
{ points: "93,965 997,521 912,814 8,1253", className: "fill-ink/75" },
{
points: "347,1135 1251,691 1166,984 262,1424",
className: "fill-success",
},
];
const commands = [
{ group: "Projects", label: "Website relaunch", value: "website" },
{ group: "Projects", label: "Design system", value: "design-system" },
{ group: "Reports", label: "Weekly summary", value: "weekly" },
{ group: "Actions", label: "Create project", value: "create-project" },
{ group: "Actions", label: "Invite teammate", value: "invite" },
];
const sections = [
{
items: [
{
label: "Home",
href: "/",
icon: "M3 10.5 12 3l9 7.5V20a1 1 0 0 1-1 1h-5v-6h-6v6H4a1 1 0 0 1-1-1z",
},
{
label: "Inbox",
href: "/inbox",
icon: "M3 13h5l1.5 3h5l1.5-3h5M5 5h14l2 8v6a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1v-6z",
badge: 8,
},
],
},
{
title: "Workspace",
items: [
{
label: "Projects",
icon: "M3 7a2 2 0 0 1 2-2h4l2 2h8a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",
children: [
{
label: "Website relaunch",
href: "/projects/website",
active: true,
},
{ label: "Design system", href: "/projects/design-system" },
{ label: "Mobile app", href: "/projects/mobile" },
],
},
{
label: "Reports",
icon: "M3 3v18h18M7 15l4-4 3 3 5-6",
children: [
{ label: "Weekly summary", href: "/reports/weekly" },
{ label: "Revenue", href: "/reports/revenue" },
{ label: "Retention", href: "/reports/retention" },
],
},
{
label: "Team",
icon: "M16 19v-1a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v1M9 10a3 3 0 1 0 0-6 3 3 0 0 0 0 6m13 9v-1a4 4 0 0 0-3-3.9M16 4.1a3 3 0 0 1 0 5.8",
children: [
{ label: "Members", href: "/team/members" },
{ label: "Invitations", href: "/team/invitations" },
],
},
],
},
{
title: "Favorites",
items: [
{
label: "Q4 roadmap",
href: "/docs/roadmap",
icon: "m12 3 2.8 5.7 6.2.9-4.5 4.4 1 6.2-5.5-2.9-5.5 2.9 1-6.2L3 9.6l6.2-.9z",
},
],
},
];
</script>
<template>
<Sidebar
:sections="sections"
breakpoint="sm"
class="h-[560px] rounded-xl border border-line"
>
<template #header>
<svg class="size-7 shrink-0" viewBox="0 0 1464 1430" aria-hidden="true">
<polygon
v-for="shape in mark"
:key="shape.points"
:points="shape.points"
:class="shape.className"
/>
</svg>
<span class="font-semibold text-ink">MarkasUI</span>
<Command
:items="commands"
placeholder-label="Search projects and actions..."
>
<template #trigger>
<button
type="button"
class="ms-auto me-2 flex h-7 shrink-0 items-center gap-1.5 rounded-md border border-line bg-canvas px-2 text-xs text-muted transition-colors duration-150 ease-out hover:text-ink motion-reduce:transition-none"
>
<svg
class="size-3.5"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
stroke-width="1.5"
stroke-linecap="round"
stroke-linejoin="round"
aria-hidden="true"
>
<circle cx="11" cy="11" r="7" />
<path d="m20 20-3.5-3.5" />
</svg>
<span class="sr-only">Search</span>
<kbd class="font-sans">⌘K</kbd>
</button>
</template>
</Command>
</template>
<template #footer>
<span
class="grid size-8 shrink-0 place-items-center rounded-full bg-primary-soft text-xs font-semibold text-ink"
>
PK
</span>
<span class="grid min-w-0 leading-tight">
<span class="truncate font-medium text-ink">Putri Kirana</span>
<span class="truncate text-xs text-muted">Admin</span>
</span>
</template>
<!-- Ctrl+K or Cmd+K opens the same palette from anywhere on the page. -->
<Command
hotkey
:items="commands"
placeholder-label="Search projects and actions..."
/>
<div
class="flex flex-1 flex-col items-center justify-center gap-3 p-6 text-center"
>
<div class="flex gap-1">
<kbd
class="grid size-8 place-items-center rounded-lg border border-line bg-surface font-sans text-sm text-ink"
>
⌘
</kbd>
<kbd
class="grid size-8 place-items-center rounded-lg border border-line bg-surface font-sans text-sm text-ink"
>
K
</kbd>
</div>
<p class="text-sm font-medium text-ink">Jump to anything</p>
<p class="max-w-48 text-xs leading-relaxed text-muted">
Search projects, reports, and actions without leaving the keyboard.
</p>
</div>
</Sidebar>
</template><script lang="ts">
import Command from "$lib/components/markas/Command.svelte";
import Sidebar from "$lib/components/markas/Sidebar.svelte";
const mark = [
{ points: "354,578 1256,138 1171,430 268,868", className: "fill-ink/15" },
{ points: "553,443 1455,3 1370,295 467,733", className: "fill-ink/55" },
{
points: "421,762 1325,318 1240,611 336,1050",
className: "fill-success/35",
},
{ points: "265,1073 1169,629 1084,922 180,1362", className: "fill-ink/25" },
{ points: "93,965 997,521 912,814 8,1253", className: "fill-ink/75" },
{
points: "347,1135 1251,691 1166,984 262,1424",
className: "fill-success",
},
];
const commands = [
{ group: "Projects", label: "Website relaunch", value: "website" },
{ group: "Projects", label: "Design system", value: "design-system" },
{ group: "Reports", label: "Weekly summary", value: "weekly" },
{ group: "Actions", label: "Create project", value: "create-project" },
{ group: "Actions", label: "Invite teammate", value: "invite" },
];
const sections = [
{
items: [
{
label: "Home",
href: "/",
icon: "M3 10.5 12 3l9 7.5V20a1 1 0 0 1-1 1h-5v-6h-6v6H4a1 1 0 0 1-1-1z",
},
{
label: "Inbox",
href: "/inbox",
icon: "M3 13h5l1.5 3h5l1.5-3h5M5 5h14l2 8v6a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1v-6z",
badge: 8,
},
],
},
{
title: "Workspace",
items: [
{
label: "Projects",
icon: "M3 7a2 2 0 0 1 2-2h4l2 2h8a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",
children: [
{
label: "Website relaunch",
href: "/projects/website",
active: true,
},
{ label: "Design system", href: "/projects/design-system" },
{ label: "Mobile app", href: "/projects/mobile" },
],
},
{
label: "Reports",
icon: "M3 3v18h18M7 15l4-4 3 3 5-6",
children: [
{ label: "Weekly summary", href: "/reports/weekly" },
{ label: "Revenue", href: "/reports/revenue" },
{ label: "Retention", href: "/reports/retention" },
],
},
{
label: "Team",
icon: "M16 19v-1a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v1M9 10a3 3 0 1 0 0-6 3 3 0 0 0 0 6m13 9v-1a4 4 0 0 0-3-3.9M16 4.1a3 3 0 0 1 0 5.8",
children: [
{ label: "Members", href: "/team/members" },
{ label: "Invitations", href: "/team/invitations" },
],
},
],
},
{
title: "Favorites",
items: [
{
label: "Q4 roadmap",
href: "/docs/roadmap",
icon: "m12 3 2.8 5.7 6.2.9-4.5 4.4 1 6.2-5.5-2.9-5.5 2.9 1-6.2L3 9.6l6.2-.9z",
},
],
},
];
</script>
<Sidebar
{sections}
breakpoint="sm"
class="h-[560px] rounded-xl border border-line"
>{#snippet header()}
<svg class="size-7 shrink-0" viewBox="0 0 1464 1430" aria-hidden="true"
>{#each mark as shape (shape.points)}
<polygon points={shape.points} class={shape.className} />
{/each}</svg
> <span class="font-semibold text-ink">MarkasUI</span>
<Command items={commands} placeholderLabel="Search projects and actions..."
>{#snippet trigger()}
<button
type="button"
class="ms-auto me-2 flex h-7 shrink-0 items-center gap-1.5 rounded-md border border-line bg-canvas px-2 text-xs text-muted transition-colors duration-150 ease-out hover:text-ink motion-reduce:transition-none"
><svg
class="size-3.5"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
stroke-width="1.5"
stroke-linecap="round"
stroke-linejoin="round"
aria-hidden="true"
><circle cx="11" cy="11" r="7" /> <path d="m20 20-3.5-3.5" /></svg
> <span class="sr-only">Search</span>
<kbd class="font-sans">⌘K</kbd></button
>
{/snippet}</Command
>
{/snippet}
{#snippet footer()}
<span
class="grid size-8 shrink-0 place-items-center rounded-full bg-primary-soft text-xs font-semibold text-ink"
>
PK
</span>
<span class="grid min-w-0 leading-tight"
><span class="truncate font-medium text-ink">Putri Kirana</span>
<span class="truncate text-xs text-muted">Admin</span></span
>
{/snippet}
<!-- Ctrl+K or Cmd+K opens the same palette from anywhere on the page. -->
<Command
hotkey
items={commands}
placeholderLabel="Search projects and actions..."
/>
<div
class="flex flex-1 flex-col items-center justify-center gap-3 p-6 text-center"
>
<div class="flex gap-1">
<kbd
class="grid size-8 place-items-center rounded-lg border border-line bg-surface font-sans text-sm text-ink"
>
⌘
</kbd>
<kbd
class="grid size-8 place-items-center rounded-lg border border-line bg-surface font-sans text-sm text-ink"
>
K
</kbd>
</div>
<p class="text-sm font-medium text-ink">Jump to anything</p>
<p class="max-w-48 text-xs leading-relaxed text-muted">
Search projects, reports, and actions without leaving the keyboard.
</p>
</div></Sidebar
>---
import Command from "@/components/markas/Command.astro";
import Sidebar from "@/components/markas/Sidebar.astro";
const mark = [
{ points: "354,578 1256,138 1171,430 268,868", className: "fill-ink/15" },
{ points: "553,443 1455,3 1370,295 467,733", className: "fill-ink/55" },
{
points: "421,762 1325,318 1240,611 336,1050",
className: "fill-success/35",
},
{ points: "265,1073 1169,629 1084,922 180,1362", className: "fill-ink/25" },
{ points: "93,965 997,521 912,814 8,1253", className: "fill-ink/75" },
{
points: "347,1135 1251,691 1166,984 262,1424",
className: "fill-success",
},
];
const commands = [
{ group: "Projects", label: "Website relaunch", value: "website" },
{ group: "Projects", label: "Design system", value: "design-system" },
{ group: "Reports", label: "Weekly summary", value: "weekly" },
{ group: "Actions", label: "Create project", value: "create-project" },
{ group: "Actions", label: "Invite teammate", value: "invite" },
];
const sections = [
{
items: [
{
label: "Home",
href: "/",
icon: "M3 10.5 12 3l9 7.5V20a1 1 0 0 1-1 1h-5v-6h-6v6H4a1 1 0 0 1-1-1z",
},
{
label: "Inbox",
href: "/inbox",
icon: "M3 13h5l1.5 3h5l1.5-3h5M5 5h14l2 8v6a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1v-6z",
badge: 8,
},
],
},
{
title: "Workspace",
items: [
{
label: "Projects",
icon: "M3 7a2 2 0 0 1 2-2h4l2 2h8a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",
children: [
{
label: "Website relaunch",
href: "/projects/website",
active: true,
},
{ label: "Design system", href: "/projects/design-system" },
{ label: "Mobile app", href: "/projects/mobile" },
],
},
{
label: "Reports",
icon: "M3 3v18h18M7 15l4-4 3 3 5-6",
children: [
{ label: "Weekly summary", href: "/reports/weekly" },
{ label: "Revenue", href: "/reports/revenue" },
{ label: "Retention", href: "/reports/retention" },
],
},
{
label: "Team",
icon: "M16 19v-1a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v1M9 10a3 3 0 1 0 0-6 3 3 0 0 0 0 6m13 9v-1a4 4 0 0 0-3-3.9M16 4.1a3 3 0 0 1 0 5.8",
children: [
{ label: "Members", href: "/team/members" },
{ label: "Invitations", href: "/team/invitations" },
],
},
],
},
{
title: "Favorites",
items: [
{
label: "Q4 roadmap",
href: "/docs/roadmap",
icon: "m12 3 2.8 5.7 6.2.9-4.5 4.4 1 6.2-5.5-2.9-5.5 2.9 1-6.2L3 9.6l6.2-.9z",
},
],
},
];
---
<Sidebar
{sections}
breakpoint="sm"
class="h-[560px] rounded-xl border border-line"
><Fragment slot="header">
<svg class="size-7 shrink-0" viewBox="0 0 1464 1430" aria-hidden="true"
>{mark.map((shape) => (
<polygon points={shape.points} class={shape.className} />
))}</svg
> <span class="font-semibold text-ink">MarkasUI</span>
<Command items={commands} placeholderLabel="Search projects and actions..."
><Fragment slot="trigger">
<button
type="button"
class="ms-auto me-2 flex h-7 shrink-0 items-center gap-1.5 rounded-md border border-line bg-canvas px-2 text-xs text-muted transition-colors duration-150 ease-out hover:text-ink motion-reduce:transition-none"
><svg
class="size-3.5"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
stroke-width="1.5"
stroke-linecap="round"
stroke-linejoin="round"
aria-hidden="true"
><circle cx="11" cy="11" r="7" /> <path d="m20 20-3.5-3.5" /></svg
> <span class="sr-only">Search</span>
<kbd class="font-sans">⌘K</kbd></button
>
</Fragment></Command
>
</Fragment>
<Fragment slot="footer">
<span
class="grid size-8 shrink-0 place-items-center rounded-full bg-primary-soft text-xs font-semibold text-ink"
>
PK
</span>
<span class="grid min-w-0 leading-tight"
><span class="truncate font-medium text-ink">Putri Kirana</span>
<span class="truncate text-xs text-muted">Admin</span></span
>
</Fragment>
<!-- Ctrl+K or Cmd+K opens the same palette from anywhere on the page. -->
<Command
hotkey
items={commands}
placeholderLabel="Search projects and actions..."
/>
<div
class="flex flex-1 flex-col items-center justify-center gap-3 p-6 text-center"
>
<div class="flex gap-1">
<kbd
class="grid size-8 place-items-center rounded-lg border border-line bg-surface font-sans text-sm text-ink"
>
⌘
</kbd>
<kbd
class="grid size-8 place-items-center rounded-lg border border-line bg-surface font-sans text-sm text-ink"
>
K
</kbd>
</div>
<p class="text-sm font-medium text-ink">Jump to anything</p>
<p class="max-w-48 text-xs leading-relaxed text-muted">
Search projects, reports, and actions without leaving the keyboard.
</p>
</div></Sidebar
>import { Component } from "@angular/core";
import { Command } from "./markas/command.component";
import { Sidebar } from "./markas/sidebar.component";
const mark = [
{ points: "354,578 1256,138 1171,430 268,868", className: "fill-ink/15" },
{ points: "553,443 1455,3 1370,295 467,733", className: "fill-ink/55" },
{
points: "421,762 1325,318 1240,611 336,1050",
className: "fill-success/35",
},
{ points: "265,1073 1169,629 1084,922 180,1362", className: "fill-ink/25" },
{ points: "93,965 997,521 912,814 8,1253", className: "fill-ink/75" },
{
points: "347,1135 1251,691 1166,984 262,1424",
className: "fill-success",
},
];
const commands = [
{ group: "Projects", label: "Website relaunch", value: "website" },
{ group: "Projects", label: "Design system", value: "design-system" },
{ group: "Reports", label: "Weekly summary", value: "weekly" },
{ group: "Actions", label: "Create project", value: "create-project" },
{ group: "Actions", label: "Invite teammate", value: "invite" },
];
const sections = [
{
items: [
{
label: "Home",
href: "/",
icon: "M3 10.5 12 3l9 7.5V20a1 1 0 0 1-1 1h-5v-6h-6v6H4a1 1 0 0 1-1-1z",
},
{
label: "Inbox",
href: "/inbox",
icon: "M3 13h5l1.5 3h5l1.5-3h5M5 5h14l2 8v6a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1v-6z",
badge: 8,
},
],
},
{
title: "Workspace",
items: [
{
label: "Projects",
icon: "M3 7a2 2 0 0 1 2-2h4l2 2h8a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",
children: [
{
label: "Website relaunch",
href: "/projects/website",
active: true,
},
{ label: "Design system", href: "/projects/design-system" },
{ label: "Mobile app", href: "/projects/mobile" },
],
},
{
label: "Reports",
icon: "M3 3v18h18M7 15l4-4 3 3 5-6",
children: [
{ label: "Weekly summary", href: "/reports/weekly" },
{ label: "Revenue", href: "/reports/revenue" },
{ label: "Retention", href: "/reports/retention" },
],
},
{
label: "Team",
icon: "M16 19v-1a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v1M9 10a3 3 0 1 0 0-6 3 3 0 0 0 0 6m13 9v-1a4 4 0 0 0-3-3.9M16 4.1a3 3 0 0 1 0 5.8",
children: [
{ label: "Members", href: "/team/members" },
{ label: "Invitations", href: "/team/invitations" },
],
},
],
},
{
title: "Favorites",
items: [
{
label: "Q4 roadmap",
href: "/docs/roadmap",
icon: "m12 3 2.8 5.7 6.2.9-4.5 4.4 1 6.2-5.5-2.9-5.5 2.9 1-6.2L3 9.6l6.2-.9z",
},
],
},
];
@Component({
selector: "markas-example",
imports: [Command, Sidebar],
template: `
<markas-sidebar
[sections]="sections"
breakpoint="sm"
class="h-[560px] rounded-xl border border-line"
><ng-template #header>
<svg class="size-7 shrink-0" viewBox="0 0 1464 1430" aria-hidden="true">
@for (shape of mark; track shape.points) {
<polygon
[attr.points]="shape.points"
[class]="shape.className"
></polygon>
}
</svg>
<span class="font-semibold text-ink">MarkasUI</span>
<markas-command
[items]="commands"
placeholderLabel="Search projects and actions..."
><ng-container trigger>
<button
type="button"
class="ms-auto me-2 flex h-7 shrink-0 items-center gap-1.5 rounded-md border border-line bg-canvas px-2 text-xs text-muted transition-colors duration-150 ease-out hover:text-ink motion-reduce:transition-none"
>
<svg
class="size-3.5"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
stroke-width="1.5"
stroke-linecap="round"
stroke-linejoin="round"
aria-hidden="true"
>
<circle cx="11" cy="11" r="7"></circle>
<path d="m20 20-3.5-3.5"></path>
</svg>
<span class="sr-only">Search</span>
<kbd class="font-sans">⌘K</kbd>
</button>
</ng-container></markas-command
>
</ng-template>
<ng-template #footer>
<span
class="grid size-8 shrink-0 place-items-center rounded-full bg-primary-soft text-xs font-semibold text-ink"
>
PK
</span>
<span class="grid min-w-0 leading-tight"
><span class="truncate font-medium text-ink">Putri Kirana</span>
<span class="truncate text-xs text-muted">Admin</span></span
>
</ng-template>
<!-- Ctrl+K or Cmd+K opens the same palette from anywhere on the page. -->
<markas-command
hotkey
[items]="commands"
placeholderLabel="Search projects and actions..."
></markas-command>
<div
class="flex flex-1 flex-col items-center justify-center gap-3 p-6 text-center"
>
<div class="flex gap-1">
<kbd
class="grid size-8 place-items-center rounded-lg border border-line bg-surface font-sans text-sm text-ink"
>
⌘
</kbd>
<kbd
class="grid size-8 place-items-center rounded-lg border border-line bg-surface font-sans text-sm text-ink"
>
K
</kbd>
</div>
<p class="text-sm font-medium text-ink">Jump to anything</p>
<p class="max-w-48 text-xs leading-relaxed text-muted">
Search projects, reports, and actions without leaving the keyboard.
</p>
</div></markas-sidebar
>
`,
})
export default class SidebarSearchExample {
protected readonly mark = mark;
protected readonly commands = commands;
protected readonly sections = sections;
}Gelap beraksen
Overview
markasui.com
Recent deployments
Overview
markasui.com
Recent deployments
Overview
markasui.com
Recent deployments
Overview
markasui.com
Recent deployments
Overview
markasui.com
Recent deployments
@php
// Tema gelap di kedua mode, indikator hijau dengan garis kiri, dan teks item aktif berwarna.
$shell = 'dark h-[520px] rounded-xl border border-line [&_nav>div>span]:rounded-l-none [&_nav>div>span]:border-l-2 [&_nav>div>span]:border-success [&_nav>div>span]:bg-success/10 [&_a[aria-current=page]]:text-success';
$deploys = [
['branch' => 'main', 'commit' => '8f3c2a1', 'time' => '2m ago', 'tone' => 'bg-success'],
['branch' => 'docs/tabs', 'commit' => '41be9d0', 'time' => '1h ago', 'tone' => 'bg-success'],
['branch' => 'fix/modal', 'commit' => 'c07a3e5', 'time' => '3h ago', 'tone' => 'bg-danger'],
];
@endphp
<x-markas.sidebar :sections="[
[
'items' => [
[
'label' => 'Overview',
'href' => '/',
'icon' => 'M4 4h6v8H4zm10 0h6v5h-6zM4 16h6v4H4zm10-3h6v7h-6z',
'active' => true,
],
[
'label' => 'Deployments',
'href' => '/deployments',
'icon' => 'M13 3 4 14h7l-1 7 9-11h-7z',
'badge' => 3,
],
[
'label' => 'Analytics',
'href' => '/analytics',
'icon' => 'M3 3v18h18M7 15l4-4 3 3 5-6',
],
[
'label' => 'Logs',
'href' => '/logs',
'icon' => 'M4 5h16v14H4zm4 5 2 2-2 2m5 0h3',
],
],
],
[
'title' => 'Project',
'items' => [
[
'label' => 'Domains',
'href' => '/domains',
'icon' => 'M12 21a9 9 0 1 0 0-18 9 9 0 0 0 0 18M3 12h18M12 3c2.5 2.5 3.5 5.5 3.5 9s-1 6.5-3.5 9c-2.5-2.5-3.5-5.5-3.5-9S9.5 5.5 12 3',
],
[
'label' => 'Environment',
'href' => '/environment',
'icon' => 'M15 7a4 4 0 1 1-3.9 5H9v2H7v2H4v-3l5.1-5.1A4 4 0 0 1 15 7m1 0h.01',
],
[
'label' => 'Settings',
'href' => '/settings',
'icon' => 'M4 6h9m4 0h3M4 12h3m4 0h9M4 18h11m4 0h1M15 4v4M9 10v4M17 16v4',
],
],
],
]" breakpoint="sm" :class="$shell">
<x-slot:header>
<svg class="size-7 shrink-0" viewBox="0 0 1464 1430" aria-hidden="true"><polygon points="354,578 1256,138 1171,430 268,868" class="fill-ink/15" /><polygon points="553,443 1455,3 1370,295 467,733" class="fill-ink/55" /><polygon points="421,762 1325,318 1240,611 336,1050" class="fill-success/35" /><polygon points="265,1073 1169,629 1084,922 180,1362" class="fill-ink/25" /><polygon points="93,965 997,521 912,814 8,1253" class="fill-ink/75" /><polygon points="347,1135 1251,691 1166,984 262,1424" class="fill-success" /></svg>
<div class="grid min-w-0 leading-tight"><span class="font-semibold text-ink">MarkasUI</span><span class="flex items-center gap-1.5 text-xs text-muted"><span aria-hidden="true" class="size-1.5 rounded-full bg-success"></span>Production</span></div>
</x-slot:header>
<x-slot:footer>
<span class="grid size-8 shrink-0 place-items-center rounded-full bg-success/15 text-xs font-semibold text-ink">BH</span>
<span class="grid min-w-0 leading-tight"><span class="truncate font-medium text-ink">Bayu Hartono</span><span class="truncate text-xs text-muted">Owner</span></span>
</x-slot:footer>
<div class="flex min-w-0 flex-1 flex-col gap-4 p-5">
<div class="grid gap-1">
<p class="text-xs text-muted">Overview</p>
<p class="text-lg font-semibold tracking-tight text-ink">markasui.com</p>
</div>
<div class="grid gap-3 rounded-xl border border-line bg-surface p-4">
<p class="text-xs font-medium text-faint">Recent deployments</p>
@foreach ($deploys as $deploy)
<div class="flex items-center gap-2.5">
<span aria-hidden="true" class="size-2 shrink-0 rounded-full {{ $deploy['tone'] }}"></span>
<span class="grid min-w-0 flex-1 leading-tight"><span class="truncate text-sm text-ink">{{ $deploy['branch'] }}</span><span class="font-mono text-xs text-muted">{{ $deploy['commit'] }}</span></span>
<span class="text-xs text-muted">{{ $deploy['time'] }}</span>
</div>
@endforeach
</div>
</div>
</x-markas.sidebar>import { Sidebar } from "@/components/markas/Sidebar";
const mark = [
{ points: "354,578 1256,138 1171,430 268,868", className: "fill-ink/15" },
{ points: "553,443 1455,3 1370,295 467,733", className: "fill-ink/55" },
{
points: "421,762 1325,318 1240,611 336,1050",
className: "fill-success/35",
},
{ points: "265,1073 1169,629 1084,922 180,1362", className: "fill-ink/25" },
{ points: "93,965 997,521 912,814 8,1253", className: "fill-ink/75" },
{
points: "347,1135 1251,691 1166,984 262,1424",
className: "fill-success",
},
];
/** Tema gelap di kedua mode, indikator hijau dengan garis kiri, dan teks item aktif berwarna. */
const shell =
"dark h-[520px] rounded-xl border border-line [&_nav>div>span]:rounded-l-none [&_nav>div>span]:border-l-2 [&_nav>div>span]:border-success [&_nav>div>span]:bg-success/10 [&_a[aria-current=page]]:text-success";
const sections = [
{
items: [
{
label: "Overview",
href: "/",
icon: "M4 4h6v8H4zm10 0h6v5h-6zM4 16h6v4H4zm10-3h6v7h-6z",
active: true,
},
{
label: "Deployments",
href: "/deployments",
icon: "M13 3 4 14h7l-1 7 9-11h-7z",
badge: 3,
},
{
label: "Analytics",
href: "/analytics",
icon: "M3 3v18h18M7 15l4-4 3 3 5-6",
},
{
label: "Logs",
href: "/logs",
icon: "M4 5h16v14H4zm4 5 2 2-2 2m5 0h3",
},
],
},
{
title: "Project",
items: [
{
label: "Domains",
href: "/domains",
icon: "M12 21a9 9 0 1 0 0-18 9 9 0 0 0 0 18M3 12h18M12 3c2.5 2.5 3.5 5.5 3.5 9s-1 6.5-3.5 9c-2.5-2.5-3.5-5.5-3.5-9S9.5 5.5 12 3",
},
{
label: "Environment",
href: "/environment",
icon: "M15 7a4 4 0 1 1-3.9 5H9v2H7v2H4v-3l5.1-5.1A4 4 0 0 1 15 7m1 0h.01",
},
{
label: "Settings",
href: "/settings",
icon: "M4 6h9m4 0h3M4 12h3m4 0h9M4 18h11m4 0h1M15 4v4M9 10v4M17 16v4",
},
],
},
];
const deploys = [
{ branch: "main", commit: "8f3c2a1", time: "2m ago", tone: "bg-success" },
{
branch: "docs/tabs",
commit: "41be9d0",
time: "1h ago",
tone: "bg-success",
},
{ branch: "fix/modal", commit: "c07a3e5", time: "3h ago", tone: "bg-danger" },
];
export default function Example() {
return (
<Sidebar
sections={sections}
breakpoint="sm"
className={shell}
header={
<>
<svg
className="size-7 shrink-0"
viewBox="0 0 1464 1430"
aria-hidden="true"
>
{mark.map((shape) => (
<polygon
key={shape.points}
points={shape.points}
className={shape.className}
/>
))}
</svg>
<div className="grid min-w-0 leading-tight">
<span className="font-semibold text-ink">MarkasUI</span>
<span className="flex items-center gap-1.5 text-xs text-muted">
<span
aria-hidden="true"
className="size-1.5 rounded-full bg-success"
></span>
Production
</span>
</div>
</>
}
footer={
<>
<span className="grid size-8 shrink-0 place-items-center rounded-full bg-success/15 text-xs font-semibold text-ink">
BH
</span>
<span className="grid min-w-0 leading-tight">
<span className="truncate font-medium text-ink">Bayu Hartono</span>
<span className="truncate text-xs text-muted">Owner</span>
</span>
</>
}
>
<div className="flex min-w-0 flex-1 flex-col gap-4 p-5">
<div className="grid gap-1">
<p className="text-xs text-muted">Overview</p>
<p className="text-lg font-semibold tracking-tight text-ink">
markasui.com
</p>
</div>
<div className="grid gap-3 rounded-xl border border-line bg-surface p-4">
<p className="text-xs font-medium text-faint">Recent deployments</p>
{deploys.map((deploy) => (
<div key={deploy.commit} className="flex items-center gap-2.5">
<span
aria-hidden="true"
className={`size-2 shrink-0 rounded-full ${deploy.tone}`}
></span>
<span className="grid min-w-0 flex-1 leading-tight">
<span className="truncate text-sm text-ink">
{deploy.branch}
</span>
<span className="font-mono text-xs text-muted">
{deploy.commit}
</span>
</span>
<span className="text-xs text-muted">{deploy.time}</span>
</div>
))}
</div>
</div>
</Sidebar>
);
}<script setup lang="ts">
import Sidebar from "@/components/markas/Sidebar.vue";
const mark = [
{ points: "354,578 1256,138 1171,430 268,868", className: "fill-ink/15" },
{ points: "553,443 1455,3 1370,295 467,733", className: "fill-ink/55" },
{
points: "421,762 1325,318 1240,611 336,1050",
className: "fill-success/35",
},
{ points: "265,1073 1169,629 1084,922 180,1362", className: "fill-ink/25" },
{ points: "93,965 997,521 912,814 8,1253", className: "fill-ink/75" },
{
points: "347,1135 1251,691 1166,984 262,1424",
className: "fill-success",
},
];
/** Tema gelap di kedua mode, indikator hijau dengan garis kiri, dan teks item aktif berwarna. */
const shell =
"dark h-[520px] rounded-xl border border-line [&_nav>div>span]:rounded-l-none [&_nav>div>span]:border-l-2 [&_nav>div>span]:border-success [&_nav>div>span]:bg-success/10 [&_a[aria-current=page]]:text-success";
const sections = [
{
items: [
{
label: "Overview",
href: "/",
icon: "M4 4h6v8H4zm10 0h6v5h-6zM4 16h6v4H4zm10-3h6v7h-6z",
active: true,
},
{
label: "Deployments",
href: "/deployments",
icon: "M13 3 4 14h7l-1 7 9-11h-7z",
badge: 3,
},
{
label: "Analytics",
href: "/analytics",
icon: "M3 3v18h18M7 15l4-4 3 3 5-6",
},
{
label: "Logs",
href: "/logs",
icon: "M4 5h16v14H4zm4 5 2 2-2 2m5 0h3",
},
],
},
{
title: "Project",
items: [
{
label: "Domains",
href: "/domains",
icon: "M12 21a9 9 0 1 0 0-18 9 9 0 0 0 0 18M3 12h18M12 3c2.5 2.5 3.5 5.5 3.5 9s-1 6.5-3.5 9c-2.5-2.5-3.5-5.5-3.5-9S9.5 5.5 12 3",
},
{
label: "Environment",
href: "/environment",
icon: "M15 7a4 4 0 1 1-3.9 5H9v2H7v2H4v-3l5.1-5.1A4 4 0 0 1 15 7m1 0h.01",
},
{
label: "Settings",
href: "/settings",
icon: "M4 6h9m4 0h3M4 12h3m4 0h9M4 18h11m4 0h1M15 4v4M9 10v4M17 16v4",
},
],
},
];
const deploys = [
{ branch: "main", commit: "8f3c2a1", time: "2m ago", tone: "bg-success" },
{
branch: "docs/tabs",
commit: "41be9d0",
time: "1h ago",
tone: "bg-success",
},
{ branch: "fix/modal", commit: "c07a3e5", time: "3h ago", tone: "bg-danger" },
];
</script>
<template>
<Sidebar :sections="sections" breakpoint="sm" :class="shell">
<template #header>
<svg class="size-7 shrink-0" viewBox="0 0 1464 1430" aria-hidden="true">
<polygon
v-for="shape in mark"
:key="shape.points"
:points="shape.points"
:class="shape.className"
/>
</svg>
<div class="grid min-w-0 leading-tight">
<span class="font-semibold text-ink">MarkasUI</span>
<span class="flex items-center gap-1.5 text-xs text-muted">
<span
aria-hidden="true"
class="size-1.5 rounded-full bg-success"
></span>
Production
</span>
</div>
</template>
<template #footer>
<span
class="grid size-8 shrink-0 place-items-center rounded-full bg-success/15 text-xs font-semibold text-ink"
>
BH
</span>
<span class="grid min-w-0 leading-tight">
<span class="truncate font-medium text-ink">Bayu Hartono</span>
<span class="truncate text-xs text-muted">Owner</span>
</span>
</template>
<div class="flex min-w-0 flex-1 flex-col gap-4 p-5">
<div class="grid gap-1">
<p class="text-xs text-muted">Overview</p>
<p class="text-lg font-semibold tracking-tight text-ink">
markasui.com
</p>
</div>
<div class="grid gap-3 rounded-xl border border-line bg-surface p-4">
<p class="text-xs font-medium text-faint">Recent deployments</p>
<div
v-for="deploy in deploys"
:key="deploy.commit"
class="flex items-center gap-2.5"
>
<span
aria-hidden="true"
:class="`size-2 shrink-0 rounded-full ${deploy.tone}`"
></span>
<span class="grid min-w-0 flex-1 leading-tight">
<span class="truncate text-sm text-ink">{{ deploy.branch }}</span>
<span class="font-mono text-xs text-muted">{{
deploy.commit
}}</span>
</span>
<span class="text-xs text-muted">{{ deploy.time }}</span>
</div>
</div>
</div>
</Sidebar>
</template><script lang="ts">
import Sidebar from "$lib/components/markas/Sidebar.svelte";
const mark = [
{ points: "354,578 1256,138 1171,430 268,868", className: "fill-ink/15" },
{ points: "553,443 1455,3 1370,295 467,733", className: "fill-ink/55" },
{
points: "421,762 1325,318 1240,611 336,1050",
className: "fill-success/35",
},
{ points: "265,1073 1169,629 1084,922 180,1362", className: "fill-ink/25" },
{ points: "93,965 997,521 912,814 8,1253", className: "fill-ink/75" },
{
points: "347,1135 1251,691 1166,984 262,1424",
className: "fill-success",
},
];
/** Tema gelap di kedua mode, indikator hijau dengan garis kiri, dan teks item aktif berwarna. */
const shell =
"dark h-[520px] rounded-xl border border-line [&_nav>div>span]:rounded-l-none [&_nav>div>span]:border-l-2 [&_nav>div>span]:border-success [&_nav>div>span]:bg-success/10 [&_a[aria-current=page]]:text-success";
const sections = [
{
items: [
{
label: "Overview",
href: "/",
icon: "M4 4h6v8H4zm10 0h6v5h-6zM4 16h6v4H4zm10-3h6v7h-6z",
active: true,
},
{
label: "Deployments",
href: "/deployments",
icon: "M13 3 4 14h7l-1 7 9-11h-7z",
badge: 3,
},
{
label: "Analytics",
href: "/analytics",
icon: "M3 3v18h18M7 15l4-4 3 3 5-6",
},
{
label: "Logs",
href: "/logs",
icon: "M4 5h16v14H4zm4 5 2 2-2 2m5 0h3",
},
],
},
{
title: "Project",
items: [
{
label: "Domains",
href: "/domains",
icon: "M12 21a9 9 0 1 0 0-18 9 9 0 0 0 0 18M3 12h18M12 3c2.5 2.5 3.5 5.5 3.5 9s-1 6.5-3.5 9c-2.5-2.5-3.5-5.5-3.5-9S9.5 5.5 12 3",
},
{
label: "Environment",
href: "/environment",
icon: "M15 7a4 4 0 1 1-3.9 5H9v2H7v2H4v-3l5.1-5.1A4 4 0 0 1 15 7m1 0h.01",
},
{
label: "Settings",
href: "/settings",
icon: "M4 6h9m4 0h3M4 12h3m4 0h9M4 18h11m4 0h1M15 4v4M9 10v4M17 16v4",
},
],
},
];
const deploys = [
{ branch: "main", commit: "8f3c2a1", time: "2m ago", tone: "bg-success" },
{
branch: "docs/tabs",
commit: "41be9d0",
time: "1h ago",
tone: "bg-success",
},
{
branch: "fix/modal",
commit: "c07a3e5",
time: "3h ago",
tone: "bg-danger",
},
];
</script>
<Sidebar {sections} breakpoint="sm" class={shell}
>{#snippet header()}
<svg class="size-7 shrink-0" viewBox="0 0 1464 1430" aria-hidden="true"
>{#each mark as shape (shape.points)}
<polygon points={shape.points} class={shape.className} />
{/each}</svg
>
<div class="grid min-w-0 leading-tight">
<span class="font-semibold text-ink">MarkasUI</span>
<span class="flex items-center gap-1.5 text-xs text-muted"
><span aria-hidden="true" class="size-1.5 rounded-full bg-success"
></span>
Production
</span>
</div>
{/snippet}
{#snippet footer()}
<span
class="grid size-8 shrink-0 place-items-center rounded-full bg-success/15 text-xs font-semibold text-ink"
>
BH
</span>
<span class="grid min-w-0 leading-tight"
><span class="truncate font-medium text-ink">Bayu Hartono</span>
<span class="truncate text-xs text-muted">Owner</span></span
>
{/snippet}
<div class="flex min-w-0 flex-1 flex-col gap-4 p-5">
<div class="grid gap-1">
<p class="text-xs text-muted">Overview</p>
<p class="text-lg font-semibold tracking-tight text-ink">markasui.com</p>
</div>
<div class="grid gap-3 rounded-xl border border-line bg-surface p-4">
<p class="text-xs font-medium text-faint">Recent deployments</p>
{#each deploys as deploy (deploy.commit)}
<div class="flex items-center gap-2.5">
<span
aria-hidden="true"
class={`size-2 shrink-0 rounded-full ${deploy.tone}`}
></span>
<span class="grid min-w-0 flex-1 leading-tight"
><span class="truncate text-sm text-ink">{deploy.branch}</span>
<span class="font-mono text-xs text-muted">{deploy.commit}</span
></span
> <span class="text-xs text-muted">{deploy.time}</span>
</div>
{/each}
</div>
</div></Sidebar
>---
import Sidebar from "@/components/markas/Sidebar.astro";
const mark = [
{ points: "354,578 1256,138 1171,430 268,868", className: "fill-ink/15" },
{ points: "553,443 1455,3 1370,295 467,733", className: "fill-ink/55" },
{
points: "421,762 1325,318 1240,611 336,1050",
className: "fill-success/35",
},
{ points: "265,1073 1169,629 1084,922 180,1362", className: "fill-ink/25" },
{ points: "93,965 997,521 912,814 8,1253", className: "fill-ink/75" },
{
points: "347,1135 1251,691 1166,984 262,1424",
className: "fill-success",
},
];
/** Tema gelap di kedua mode, indikator hijau dengan garis kiri, dan teks item aktif berwarna. */
const shell =
"dark h-[520px] rounded-xl border border-line [&_nav>div>span]:rounded-l-none [&_nav>div>span]:border-l-2 [&_nav>div>span]:border-success [&_nav>div>span]:bg-success/10 [&_a[aria-current=page]]:text-success";
const sections = [
{
items: [
{
label: "Overview",
href: "/",
icon: "M4 4h6v8H4zm10 0h6v5h-6zM4 16h6v4H4zm10-3h6v7h-6z",
active: true,
},
{
label: "Deployments",
href: "/deployments",
icon: "M13 3 4 14h7l-1 7 9-11h-7z",
badge: 3,
},
{
label: "Analytics",
href: "/analytics",
icon: "M3 3v18h18M7 15l4-4 3 3 5-6",
},
{
label: "Logs",
href: "/logs",
icon: "M4 5h16v14H4zm4 5 2 2-2 2m5 0h3",
},
],
},
{
title: "Project",
items: [
{
label: "Domains",
href: "/domains",
icon: "M12 21a9 9 0 1 0 0-18 9 9 0 0 0 0 18M3 12h18M12 3c2.5 2.5 3.5 5.5 3.5 9s-1 6.5-3.5 9c-2.5-2.5-3.5-5.5-3.5-9S9.5 5.5 12 3",
},
{
label: "Environment",
href: "/environment",
icon: "M15 7a4 4 0 1 1-3.9 5H9v2H7v2H4v-3l5.1-5.1A4 4 0 0 1 15 7m1 0h.01",
},
{
label: "Settings",
href: "/settings",
icon: "M4 6h9m4 0h3M4 12h3m4 0h9M4 18h11m4 0h1M15 4v4M9 10v4M17 16v4",
},
],
},
];
const deploys = [
{ branch: "main", commit: "8f3c2a1", time: "2m ago", tone: "bg-success" },
{
branch: "docs/tabs",
commit: "41be9d0",
time: "1h ago",
tone: "bg-success",
},
{
branch: "fix/modal",
commit: "c07a3e5",
time: "3h ago",
tone: "bg-danger",
},
];
---
<Sidebar {sections} breakpoint="sm" class={shell}
><Fragment slot="header">
<svg class="size-7 shrink-0" viewBox="0 0 1464 1430" aria-hidden="true"
>{mark.map((shape) => (
<polygon points={shape.points} class={shape.className} />
))}</svg
>
<div class="grid min-w-0 leading-tight">
<span class="font-semibold text-ink">MarkasUI</span>
<span class="flex items-center gap-1.5 text-xs text-muted"
><span aria-hidden="true" class="size-1.5 rounded-full bg-success"
></span>
Production
</span>
</div>
</Fragment>
<Fragment slot="footer">
<span
class="grid size-8 shrink-0 place-items-center rounded-full bg-success/15 text-xs font-semibold text-ink"
>
BH
</span>
<span class="grid min-w-0 leading-tight"
><span class="truncate font-medium text-ink">Bayu Hartono</span>
<span class="truncate text-xs text-muted">Owner</span></span
>
</Fragment>
<div class="flex min-w-0 flex-1 flex-col gap-4 p-5">
<div class="grid gap-1">
<p class="text-xs text-muted">Overview</p>
<p class="text-lg font-semibold tracking-tight text-ink">markasui.com</p>
</div>
<div class="grid gap-3 rounded-xl border border-line bg-surface p-4">
<p class="text-xs font-medium text-faint">Recent deployments</p>
{deploys.map((deploy) => (
<div class="flex items-center gap-2.5">
<span
aria-hidden="true"
class={`size-2 shrink-0 rounded-full ${deploy.tone}`}
></span>
<span class="grid min-w-0 flex-1 leading-tight"
><span class="truncate text-sm text-ink">{deploy.branch}</span>
<span class="font-mono text-xs text-muted">{deploy.commit}</span
></span
> <span class="text-xs text-muted">{deploy.time}</span>
</div>
))}
</div>
</div></Sidebar
>import { Component } from "@angular/core";
import { Sidebar } from "./markas/sidebar.component";
const mark = [
{ points: "354,578 1256,138 1171,430 268,868", className: "fill-ink/15" },
{ points: "553,443 1455,3 1370,295 467,733", className: "fill-ink/55" },
{
points: "421,762 1325,318 1240,611 336,1050",
className: "fill-success/35",
},
{ points: "265,1073 1169,629 1084,922 180,1362", className: "fill-ink/25" },
{ points: "93,965 997,521 912,814 8,1253", className: "fill-ink/75" },
{
points: "347,1135 1251,691 1166,984 262,1424",
className: "fill-success",
},
];
/** Tema gelap di kedua mode, indikator hijau dengan garis kiri, dan teks item aktif berwarna. */
const shell =
"dark h-[520px] rounded-xl border border-line [&_nav>div>span]:rounded-l-none [&_nav>div>span]:border-l-2 [&_nav>div>span]:border-success [&_nav>div>span]:bg-success/10 [&_a[aria-current=page]]:text-success";
const sections = [
{
items: [
{
label: "Overview",
href: "/",
icon: "M4 4h6v8H4zm10 0h6v5h-6zM4 16h6v4H4zm10-3h6v7h-6z",
active: true,
},
{
label: "Deployments",
href: "/deployments",
icon: "M13 3 4 14h7l-1 7 9-11h-7z",
badge: 3,
},
{
label: "Analytics",
href: "/analytics",
icon: "M3 3v18h18M7 15l4-4 3 3 5-6",
},
{
label: "Logs",
href: "/logs",
icon: "M4 5h16v14H4zm4 5 2 2-2 2m5 0h3",
},
],
},
{
title: "Project",
items: [
{
label: "Domains",
href: "/domains",
icon: "M12 21a9 9 0 1 0 0-18 9 9 0 0 0 0 18M3 12h18M12 3c2.5 2.5 3.5 5.5 3.5 9s-1 6.5-3.5 9c-2.5-2.5-3.5-5.5-3.5-9S9.5 5.5 12 3",
},
{
label: "Environment",
href: "/environment",
icon: "M15 7a4 4 0 1 1-3.9 5H9v2H7v2H4v-3l5.1-5.1A4 4 0 0 1 15 7m1 0h.01",
},
{
label: "Settings",
href: "/settings",
icon: "M4 6h9m4 0h3M4 12h3m4 0h9M4 18h11m4 0h1M15 4v4M9 10v4M17 16v4",
},
],
},
];
const deploys = [
{ branch: "main", commit: "8f3c2a1", time: "2m ago", tone: "bg-success" },
{
branch: "docs/tabs",
commit: "41be9d0",
time: "1h ago",
tone: "bg-success",
},
{ branch: "fix/modal", commit: "c07a3e5", time: "3h ago", tone: "bg-danger" },
];
@Component({
selector: "markas-example",
imports: [Sidebar],
template: `
<markas-sidebar
[sections]="sections"
breakpoint="sm"
class="dark h-[520px] rounded-xl border border-line [&_a[aria-current=page]]:text-success [&_nav>div>span]:rounded-l-none [&_nav>div>span]:border-l-2 [&_nav>div>span]:border-success [&_nav>div>span]:bg-success/10"
><ng-template #header>
<svg class="size-7 shrink-0" viewBox="0 0 1464 1430" aria-hidden="true">
@for (shape of mark; track shape.points) {
<polygon
[attr.points]="shape.points"
[class]="shape.className"
></polygon>
}
</svg>
<div class="grid min-w-0 leading-tight">
<span class="font-semibold text-ink">MarkasUI</span>
<span class="flex items-center gap-1.5 text-xs text-muted"
><span
aria-hidden="true"
class="size-1.5 rounded-full bg-success"
></span>
Production
</span>
</div>
</ng-template>
<ng-template #footer>
<span
class="grid size-8 shrink-0 place-items-center rounded-full bg-success/15 text-xs font-semibold text-ink"
>
BH
</span>
<span class="grid min-w-0 leading-tight"
><span class="truncate font-medium text-ink">Bayu Hartono</span>
<span class="truncate text-xs text-muted">Owner</span></span
>
</ng-template>
<div class="flex min-w-0 flex-1 flex-col gap-4 p-5">
<div class="grid gap-1">
<p class="text-xs text-muted">Overview</p>
<p class="text-lg font-semibold tracking-tight text-ink">
markasui.com
</p>
</div>
<div class="grid gap-3 rounded-xl border border-line bg-surface p-4">
<p class="text-xs font-medium text-faint">Recent deployments</p>
@for (deploy of deploys; track deploy.commit) {
<div class="flex items-center gap-2.5">
<span
aria-hidden="true"
[class]="\`size-2 shrink-0 rounded-full \${deploy.tone}\`"
></span>
<span class="grid min-w-0 flex-1 leading-tight"
><span class="truncate text-sm text-ink">{{
deploy.branch
}}</span>
<span class="font-mono text-xs text-muted">{{
deploy.commit
}}</span></span
>
<span class="text-xs text-muted">{{ deploy.time }}</span>
</div>
}
</div>
</div></markas-sidebar
>
`,
})
export default class SidebarContrastExample {
protected readonly mark = mark;
protected readonly shell = shell;
protected readonly sections = sections;
protected readonly deploys = deploys;
}Dokumentasi
Components / Forms
Select
A native select with a custom chevron, three sizes, and an error state.
On this page
Usage
Sizes
Error state
Components / Forms
Select
A native select with a custom chevron, three sizes, and an error state.
On this page
Usage
Sizes
Error state
Components / Forms
Select
A native select with a custom chevron, three sizes, and an error state.
On this page
Usage
Sizes
Error state
Components / Forms
Select
A native select with a custom chevron, three sizes, and an error state.
On this page
Usage
Sizes
Error state
Components / Forms
Select
A native select with a custom chevron, three sizes, and an error state.
On this page
Usage
Sizes
Error state
<x-markas.sidebar :sections="[
[
'title' => 'Getting started',
'items' => [
[
'label' => 'Introduction',
'href' => '/docs',
'icon' => 'M4 5a2 2 0 0 1 2-2h13v16H6a2 2 0 0 0-2 2zm0 16V5m4 2h7',
],
[
'label' => 'Installation',
'href' => '/docs/installation',
'icon' => 'M12 4v11m-4-4 4 4 4-4M5 20h14',
],
[
'label' => 'Theming',
'href' => '/docs/theming',
'icon' => 'M12 3a9 9 0 1 0 0 18c1 0 1.5-.8 1.5-1.5 0-1.2-1-1.5-1-2.5 0-.8.7-1.5 1.5-1.5H17a4 4 0 0 0 4-4c0-4.4-4-8.5-9-8.5M7.5 12h.01M10 7.5h.01M15 7.5h.01',
'badge' => 'New',
],
],
],
[
'title' => 'Components',
'items' => [
[
'label' => 'Forms',
'icon' => 'M4 4h6v6H4zm10 0h6v6h-6zM4 14h6v6H4zm10 0h6v6h-6z',
'children' => [
['label' => 'Button', 'href' => '/docs/button'],
['label' => 'Input', 'href' => '/docs/input'],
['label' => 'Select', 'href' => '/docs/select', 'active' => true],
['label' => 'Combobox', 'href' => '/docs/combobox'],
],
],
[
'label' => 'Overlays',
'icon' => 'M8 8V5a1 1 0 0 1 1-1h10a1 1 0 0 1 1 1v10a1 1 0 0 1-1 1h-3M4 9a1 1 0 0 1 1-1h10a1 1 0 0 1 1 1v10a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1z',
'children' => [
['label' => 'Modal', 'href' => '/docs/modal'],
['label' => 'Drawer', 'href' => '/docs/drawer'],
['label' => 'Popover', 'href' => '/docs/popover'],
],
],
[
'label' => 'Motion',
'icon' => 'M12 3v4m0 10v4M3 12h4m10 0h4M6 6l2.5 2.5m7 7L18 18M6 18l2.5-2.5m7-7L18 6',
'badge' => 'New',
'children' => [
['label' => 'Marquee', 'href' => '/docs/marquee'],
['label' => 'Text scramble', 'href' => '/docs/text-scramble'],
],
],
],
],
[
'title' => 'Resources',
'items' => [
[
'label' => 'Templates',
'href' => '/templates',
'icon' => 'M3 4h18v16H3zm0 5h18M9 9v11',
],
[
'label' => 'Changelog',
'href' => '/changelog',
'icon' => 'M20 12a8 8 0 1 1-2.3-5.7M20 4v5h-5',
],
],
],
]" breakpoint="sm" class="h-[560px] rounded-xl border border-line">
<x-slot:header>
<svg class="size-7 shrink-0" viewBox="0 0 1464 1430" aria-hidden="true"><polygon points="354,578 1256,138 1171,430 268,868" class="fill-ink/15" /><polygon points="553,443 1455,3 1370,295 467,733" class="fill-ink/55" /><polygon points="421,762 1325,318 1240,611 336,1050" class="fill-success/35" /><polygon points="265,1073 1169,629 1084,922 180,1362" class="fill-ink/25" /><polygon points="93,965 997,521 912,814 8,1253" class="fill-ink/75" /><polygon points="347,1135 1251,691 1166,984 262,1424" class="fill-success" /></svg>
<span class="font-semibold text-ink">MarkasUI</span>
<span class="ms-auto me-2 rounded-full border border-line px-2 py-0.5 text-xs text-muted">v1.4</span>
</x-slot:header>
<x-slot:footer>
<a href="/changelog" class="flex w-full items-center gap-2 rounded-md text-xs text-muted transition-colors duration-150 ease-out hover:text-ink motion-reduce:transition-none"><span class="rounded-full bg-success/15 px-1.5 py-0.5 font-medium text-ink">1.4</span>Release notes<svg class="ms-auto size-4 shrink-0" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M5 12h14m-6-6 6 6-6 6" /></svg></a>
</x-slot:footer>
<div class="flex min-w-0 flex-1 flex-col gap-4 p-5">
<div class="grid gap-1.5">
<p class="text-xs text-muted">Components / Forms</p>
<p class="text-xl font-semibold tracking-tight text-ink">Select</p>
<p class="text-xs leading-relaxed text-muted">A native select with a custom chevron, three sizes, and an error state.</p>
</div>
<div class="grid flex-1 place-items-center rounded-xl border border-line bg-surface p-4">
<span class="flex h-9 w-full items-center justify-between rounded-lg border border-line bg-canvas px-3 text-sm text-ink">Bandung<svg class="size-4 text-muted" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="m6 9 6 6 6-6" /></svg></span>
</div>
<div class="grid gap-1.5 border-l border-line pl-3 text-xs">
<p class="font-medium text-ink">On this page</p>
<p class="text-muted">Usage</p>
<p class="text-muted">Sizes</p>
<p class="text-muted">Error state</p>
</div>
</div>
</x-markas.sidebar>import { Sidebar } from "@/components/markas/Sidebar";
const mark = [
{ points: "354,578 1256,138 1171,430 268,868", className: "fill-ink/15" },
{ points: "553,443 1455,3 1370,295 467,733", className: "fill-ink/55" },
{
points: "421,762 1325,318 1240,611 336,1050",
className: "fill-success/35",
},
{ points: "265,1073 1169,629 1084,922 180,1362", className: "fill-ink/25" },
{ points: "93,965 997,521 912,814 8,1253", className: "fill-ink/75" },
{
points: "347,1135 1251,691 1166,984 262,1424",
className: "fill-success",
},
];
const sections = [
{
title: "Getting started",
items: [
{
label: "Introduction",
href: "/docs",
icon: "M4 5a2 2 0 0 1 2-2h13v16H6a2 2 0 0 0-2 2zm0 16V5m4 2h7",
},
{
label: "Installation",
href: "/docs/installation",
icon: "M12 4v11m-4-4 4 4 4-4M5 20h14",
},
{
label: "Theming",
href: "/docs/theming",
icon: "M12 3a9 9 0 1 0 0 18c1 0 1.5-.8 1.5-1.5 0-1.2-1-1.5-1-2.5 0-.8.7-1.5 1.5-1.5H17a4 4 0 0 0 4-4c0-4.4-4-8.5-9-8.5M7.5 12h.01M10 7.5h.01M15 7.5h.01",
badge: "New",
},
],
},
{
title: "Components",
items: [
{
label: "Forms",
icon: "M4 4h6v6H4zm10 0h6v6h-6zM4 14h6v6H4zm10 0h6v6h-6z",
children: [
{ label: "Button", href: "/docs/button" },
{ label: "Input", href: "/docs/input" },
{ label: "Select", href: "/docs/select", active: true },
{ label: "Combobox", href: "/docs/combobox" },
],
},
{
label: "Overlays",
icon: "M8 8V5a1 1 0 0 1 1-1h10a1 1 0 0 1 1 1v10a1 1 0 0 1-1 1h-3M4 9a1 1 0 0 1 1-1h10a1 1 0 0 1 1 1v10a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1z",
children: [
{ label: "Modal", href: "/docs/modal" },
{ label: "Drawer", href: "/docs/drawer" },
{ label: "Popover", href: "/docs/popover" },
],
},
{
label: "Motion",
icon: "M12 3v4m0 10v4M3 12h4m10 0h4M6 6l2.5 2.5m7 7L18 18M6 18l2.5-2.5m7-7L18 6",
badge: "New",
children: [
{ label: "Marquee", href: "/docs/marquee" },
{ label: "Text scramble", href: "/docs/text-scramble" },
],
},
],
},
{
title: "Resources",
items: [
{
label: "Templates",
href: "/templates",
icon: "M3 4h18v16H3zm0 5h18M9 9v11",
},
{
label: "Changelog",
href: "/changelog",
icon: "M20 12a8 8 0 1 1-2.3-5.7M20 4v5h-5",
},
],
},
];
export default function Example() {
return (
<Sidebar
sections={sections}
breakpoint="sm"
className="h-[560px] rounded-xl border border-line"
header={
<>
<svg
className="size-7 shrink-0"
viewBox="0 0 1464 1430"
aria-hidden="true"
>
{mark.map((shape) => (
<polygon
key={shape.points}
points={shape.points}
className={shape.className}
/>
))}
</svg>
<span className="font-semibold text-ink">MarkasUI</span>
<span className="ms-auto me-2 rounded-full border border-line px-2 py-0.5 text-xs text-muted">
v1.4
</span>
</>
}
footer={
<a
href="/changelog"
className="flex w-full items-center gap-2 rounded-md text-xs text-muted transition-colors duration-150 ease-out hover:text-ink motion-reduce:transition-none"
>
<span className="rounded-full bg-success/15 px-1.5 py-0.5 font-medium text-ink">
1.4
</span>
Release notes
<svg
className="ms-auto size-4 shrink-0"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
strokeWidth="1.5"
strokeLinecap="round"
strokeLinejoin="round"
aria-hidden="true"
>
<path d="M5 12h14m-6-6 6 6-6 6" />
</svg>
</a>
}
>
<div className="flex min-w-0 flex-1 flex-col gap-4 p-5">
<div className="grid gap-1.5">
<p className="text-xs text-muted">Components / Forms</p>
<p className="text-xl font-semibold tracking-tight text-ink">
Select
</p>
<p className="text-xs leading-relaxed text-muted">
A native select with a custom chevron, three sizes, and an error
state.
</p>
</div>
<div className="grid flex-1 place-items-center rounded-xl border border-line bg-surface p-4">
<span className="flex h-9 w-full items-center justify-between rounded-lg border border-line bg-canvas px-3 text-sm text-ink">
Bandung
<svg
className="size-4 text-muted"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
strokeWidth="1.5"
strokeLinecap="round"
strokeLinejoin="round"
aria-hidden="true"
>
<path d="m6 9 6 6 6-6" />
</svg>
</span>
</div>
<div className="grid gap-1.5 border-l border-line pl-3 text-xs">
<p className="font-medium text-ink">On this page</p>
<p className="text-muted">Usage</p>
<p className="text-muted">Sizes</p>
<p className="text-muted">Error state</p>
</div>
</div>
</Sidebar>
);
}<script setup lang="ts">
import Sidebar from "@/components/markas/Sidebar.vue";
const mark = [
{ points: "354,578 1256,138 1171,430 268,868", className: "fill-ink/15" },
{ points: "553,443 1455,3 1370,295 467,733", className: "fill-ink/55" },
{
points: "421,762 1325,318 1240,611 336,1050",
className: "fill-success/35",
},
{ points: "265,1073 1169,629 1084,922 180,1362", className: "fill-ink/25" },
{ points: "93,965 997,521 912,814 8,1253", className: "fill-ink/75" },
{
points: "347,1135 1251,691 1166,984 262,1424",
className: "fill-success",
},
];
const sections = [
{
title: "Getting started",
items: [
{
label: "Introduction",
href: "/docs",
icon: "M4 5a2 2 0 0 1 2-2h13v16H6a2 2 0 0 0-2 2zm0 16V5m4 2h7",
},
{
label: "Installation",
href: "/docs/installation",
icon: "M12 4v11m-4-4 4 4 4-4M5 20h14",
},
{
label: "Theming",
href: "/docs/theming",
icon: "M12 3a9 9 0 1 0 0 18c1 0 1.5-.8 1.5-1.5 0-1.2-1-1.5-1-2.5 0-.8.7-1.5 1.5-1.5H17a4 4 0 0 0 4-4c0-4.4-4-8.5-9-8.5M7.5 12h.01M10 7.5h.01M15 7.5h.01",
badge: "New",
},
],
},
{
title: "Components",
items: [
{
label: "Forms",
icon: "M4 4h6v6H4zm10 0h6v6h-6zM4 14h6v6H4zm10 0h6v6h-6z",
children: [
{ label: "Button", href: "/docs/button" },
{ label: "Input", href: "/docs/input" },
{ label: "Select", href: "/docs/select", active: true },
{ label: "Combobox", href: "/docs/combobox" },
],
},
{
label: "Overlays",
icon: "M8 8V5a1 1 0 0 1 1-1h10a1 1 0 0 1 1 1v10a1 1 0 0 1-1 1h-3M4 9a1 1 0 0 1 1-1h10a1 1 0 0 1 1 1v10a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1z",
children: [
{ label: "Modal", href: "/docs/modal" },
{ label: "Drawer", href: "/docs/drawer" },
{ label: "Popover", href: "/docs/popover" },
],
},
{
label: "Motion",
icon: "M12 3v4m0 10v4M3 12h4m10 0h4M6 6l2.5 2.5m7 7L18 18M6 18l2.5-2.5m7-7L18 6",
badge: "New",
children: [
{ label: "Marquee", href: "/docs/marquee" },
{ label: "Text scramble", href: "/docs/text-scramble" },
],
},
],
},
{
title: "Resources",
items: [
{
label: "Templates",
href: "/templates",
icon: "M3 4h18v16H3zm0 5h18M9 9v11",
},
{
label: "Changelog",
href: "/changelog",
icon: "M20 12a8 8 0 1 1-2.3-5.7M20 4v5h-5",
},
],
},
];
</script>
<template>
<Sidebar
:sections="sections"
breakpoint="sm"
class="h-[560px] rounded-xl border border-line"
>
<template #header>
<svg class="size-7 shrink-0" viewBox="0 0 1464 1430" aria-hidden="true">
<polygon
v-for="shape in mark"
:key="shape.points"
:points="shape.points"
:class="shape.className"
/>
</svg>
<span class="font-semibold text-ink">MarkasUI</span>
<span
class="ms-auto me-2 rounded-full border border-line px-2 py-0.5 text-xs text-muted"
>
v1.4
</span>
</template>
<template #footer>
<a
href="/changelog"
class="flex w-full items-center gap-2 rounded-md text-xs text-muted transition-colors duration-150 ease-out hover:text-ink motion-reduce:transition-none"
>
<span
class="rounded-full bg-success/15 px-1.5 py-0.5 font-medium text-ink"
>
1.4
</span>
Release notes
<svg
class="ms-auto size-4 shrink-0"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
stroke-width="1.5"
stroke-linecap="round"
stroke-linejoin="round"
aria-hidden="true"
>
<path d="M5 12h14m-6-6 6 6-6 6" />
</svg>
</a>
</template>
<div class="flex min-w-0 flex-1 flex-col gap-4 p-5">
<div class="grid gap-1.5">
<p class="text-xs text-muted">Components / Forms</p>
<p class="text-xl font-semibold tracking-tight text-ink">Select</p>
<p class="text-xs leading-relaxed text-muted">
A native select with a custom chevron, three sizes, and an error
state.
</p>
</div>
<div
class="grid flex-1 place-items-center rounded-xl border border-line bg-surface p-4"
>
<span
class="flex h-9 w-full items-center justify-between rounded-lg border border-line bg-canvas px-3 text-sm text-ink"
>
Bandung
<svg
class="size-4 text-muted"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
stroke-width="1.5"
stroke-linecap="round"
stroke-linejoin="round"
aria-hidden="true"
>
<path d="m6 9 6 6 6-6" />
</svg>
</span>
</div>
<div class="grid gap-1.5 border-l border-line pl-3 text-xs">
<p class="font-medium text-ink">On this page</p>
<p class="text-muted">Usage</p>
<p class="text-muted">Sizes</p>
<p class="text-muted">Error state</p>
</div>
</div>
</Sidebar>
</template><script lang="ts">
import Sidebar from "$lib/components/markas/Sidebar.svelte";
const mark = [
{ points: "354,578 1256,138 1171,430 268,868", className: "fill-ink/15" },
{ points: "553,443 1455,3 1370,295 467,733", className: "fill-ink/55" },
{
points: "421,762 1325,318 1240,611 336,1050",
className: "fill-success/35",
},
{ points: "265,1073 1169,629 1084,922 180,1362", className: "fill-ink/25" },
{ points: "93,965 997,521 912,814 8,1253", className: "fill-ink/75" },
{
points: "347,1135 1251,691 1166,984 262,1424",
className: "fill-success",
},
];
const sections = [
{
title: "Getting started",
items: [
{
label: "Introduction",
href: "/docs",
icon: "M4 5a2 2 0 0 1 2-2h13v16H6a2 2 0 0 0-2 2zm0 16V5m4 2h7",
},
{
label: "Installation",
href: "/docs/installation",
icon: "M12 4v11m-4-4 4 4 4-4M5 20h14",
},
{
label: "Theming",
href: "/docs/theming",
icon: "M12 3a9 9 0 1 0 0 18c1 0 1.5-.8 1.5-1.5 0-1.2-1-1.5-1-2.5 0-.8.7-1.5 1.5-1.5H17a4 4 0 0 0 4-4c0-4.4-4-8.5-9-8.5M7.5 12h.01M10 7.5h.01M15 7.5h.01",
badge: "New",
},
],
},
{
title: "Components",
items: [
{
label: "Forms",
icon: "M4 4h6v6H4zm10 0h6v6h-6zM4 14h6v6H4zm10 0h6v6h-6z",
children: [
{ label: "Button", href: "/docs/button" },
{ label: "Input", href: "/docs/input" },
{ label: "Select", href: "/docs/select", active: true },
{ label: "Combobox", href: "/docs/combobox" },
],
},
{
label: "Overlays",
icon: "M8 8V5a1 1 0 0 1 1-1h10a1 1 0 0 1 1 1v10a1 1 0 0 1-1 1h-3M4 9a1 1 0 0 1 1-1h10a1 1 0 0 1 1 1v10a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1z",
children: [
{ label: "Modal", href: "/docs/modal" },
{ label: "Drawer", href: "/docs/drawer" },
{ label: "Popover", href: "/docs/popover" },
],
},
{
label: "Motion",
icon: "M12 3v4m0 10v4M3 12h4m10 0h4M6 6l2.5 2.5m7 7L18 18M6 18l2.5-2.5m7-7L18 6",
badge: "New",
children: [
{ label: "Marquee", href: "/docs/marquee" },
{ label: "Text scramble", href: "/docs/text-scramble" },
],
},
],
},
{
title: "Resources",
items: [
{
label: "Templates",
href: "/templates",
icon: "M3 4h18v16H3zm0 5h18M9 9v11",
},
{
label: "Changelog",
href: "/changelog",
icon: "M20 12a8 8 0 1 1-2.3-5.7M20 4v5h-5",
},
],
},
];
</script>
<Sidebar
{sections}
breakpoint="sm"
class="h-[560px] rounded-xl border border-line"
>{#snippet header()}
<svg class="size-7 shrink-0" viewBox="0 0 1464 1430" aria-hidden="true"
>{#each mark as shape (shape.points)}
<polygon points={shape.points} class={shape.className} />
{/each}</svg
> <span class="font-semibold text-ink">MarkasUI</span>
<span
class="ms-auto me-2 rounded-full border border-line px-2 py-0.5 text-xs text-muted"
>
v1.4
</span>
{/snippet}
{#snippet footer()}
<a
href="/changelog"
class="flex w-full items-center gap-2 rounded-md text-xs text-muted transition-colors duration-150 ease-out hover:text-ink motion-reduce:transition-none"
><span
class="rounded-full bg-success/15 px-1.5 py-0.5 font-medium text-ink"
>
1.4
</span>
Release notes
<svg
class="ms-auto size-4 shrink-0"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
stroke-width="1.5"
stroke-linecap="round"
stroke-linejoin="round"
aria-hidden="true"><path d="M5 12h14m-6-6 6 6-6 6" /></svg
></a
>
{/snippet}
<div class="flex min-w-0 flex-1 flex-col gap-4 p-5">
<div class="grid gap-1.5">
<p class="text-xs text-muted">Components / Forms</p>
<p class="text-xl font-semibold tracking-tight text-ink">Select</p>
<p class="text-xs leading-relaxed text-muted">
A native select with a custom chevron, three sizes, and an error state.
</p>
</div>
<div
class="grid flex-1 place-items-center rounded-xl border border-line bg-surface p-4"
>
<span
class="flex h-9 w-full items-center justify-between rounded-lg border border-line bg-canvas px-3 text-sm text-ink"
>
Bandung
<svg
class="size-4 text-muted"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
stroke-width="1.5"
stroke-linecap="round"
stroke-linejoin="round"
aria-hidden="true"><path d="m6 9 6 6 6-6" /></svg
></span
>
</div>
<div class="grid gap-1.5 border-l border-line pl-3 text-xs">
<p class="font-medium text-ink">On this page</p>
<p class="text-muted">Usage</p>
<p class="text-muted">Sizes</p>
<p class="text-muted">Error state</p>
</div>
</div></Sidebar
>---
import Sidebar from "@/components/markas/Sidebar.astro";
const mark = [
{ points: "354,578 1256,138 1171,430 268,868", className: "fill-ink/15" },
{ points: "553,443 1455,3 1370,295 467,733", className: "fill-ink/55" },
{
points: "421,762 1325,318 1240,611 336,1050",
className: "fill-success/35",
},
{ points: "265,1073 1169,629 1084,922 180,1362", className: "fill-ink/25" },
{ points: "93,965 997,521 912,814 8,1253", className: "fill-ink/75" },
{
points: "347,1135 1251,691 1166,984 262,1424",
className: "fill-success",
},
];
const sections = [
{
title: "Getting started",
items: [
{
label: "Introduction",
href: "/docs",
icon: "M4 5a2 2 0 0 1 2-2h13v16H6a2 2 0 0 0-2 2zm0 16V5m4 2h7",
},
{
label: "Installation",
href: "/docs/installation",
icon: "M12 4v11m-4-4 4 4 4-4M5 20h14",
},
{
label: "Theming",
href: "/docs/theming",
icon: "M12 3a9 9 0 1 0 0 18c1 0 1.5-.8 1.5-1.5 0-1.2-1-1.5-1-2.5 0-.8.7-1.5 1.5-1.5H17a4 4 0 0 0 4-4c0-4.4-4-8.5-9-8.5M7.5 12h.01M10 7.5h.01M15 7.5h.01",
badge: "New",
},
],
},
{
title: "Components",
items: [
{
label: "Forms",
icon: "M4 4h6v6H4zm10 0h6v6h-6zM4 14h6v6H4zm10 0h6v6h-6z",
children: [
{ label: "Button", href: "/docs/button" },
{ label: "Input", href: "/docs/input" },
{ label: "Select", href: "/docs/select", active: true },
{ label: "Combobox", href: "/docs/combobox" },
],
},
{
label: "Overlays",
icon: "M8 8V5a1 1 0 0 1 1-1h10a1 1 0 0 1 1 1v10a1 1 0 0 1-1 1h-3M4 9a1 1 0 0 1 1-1h10a1 1 0 0 1 1 1v10a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1z",
children: [
{ label: "Modal", href: "/docs/modal" },
{ label: "Drawer", href: "/docs/drawer" },
{ label: "Popover", href: "/docs/popover" },
],
},
{
label: "Motion",
icon: "M12 3v4m0 10v4M3 12h4m10 0h4M6 6l2.5 2.5m7 7L18 18M6 18l2.5-2.5m7-7L18 6",
badge: "New",
children: [
{ label: "Marquee", href: "/docs/marquee" },
{ label: "Text scramble", href: "/docs/text-scramble" },
],
},
],
},
{
title: "Resources",
items: [
{
label: "Templates",
href: "/templates",
icon: "M3 4h18v16H3zm0 5h18M9 9v11",
},
{
label: "Changelog",
href: "/changelog",
icon: "M20 12a8 8 0 1 1-2.3-5.7M20 4v5h-5",
},
],
},
];
---
<Sidebar
{sections}
breakpoint="sm"
class="h-[560px] rounded-xl border border-line"
><Fragment slot="header">
<svg class="size-7 shrink-0" viewBox="0 0 1464 1430" aria-hidden="true"
>{mark.map((shape) => (
<polygon points={shape.points} class={shape.className} />
))}</svg
> <span class="font-semibold text-ink">MarkasUI</span>
<span
class="ms-auto me-2 rounded-full border border-line px-2 py-0.5 text-xs text-muted"
>
v1.4
</span>
</Fragment>
<Fragment slot="footer">
<a
href="/changelog"
class="flex w-full items-center gap-2 rounded-md text-xs text-muted transition-colors duration-150 ease-out hover:text-ink motion-reduce:transition-none"
><span
class="rounded-full bg-success/15 px-1.5 py-0.5 font-medium text-ink"
>
1.4
</span>
Release notes
<svg
class="ms-auto size-4 shrink-0"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
stroke-width="1.5"
stroke-linecap="round"
stroke-linejoin="round"
aria-hidden="true"><path d="M5 12h14m-6-6 6 6-6 6" /></svg
></a
>
</Fragment>
<div class="flex min-w-0 flex-1 flex-col gap-4 p-5">
<div class="grid gap-1.5">
<p class="text-xs text-muted">Components / Forms</p>
<p class="text-xl font-semibold tracking-tight text-ink">Select</p>
<p class="text-xs leading-relaxed text-muted">
A native select with a custom chevron, three sizes, and an error state.
</p>
</div>
<div
class="grid flex-1 place-items-center rounded-xl border border-line bg-surface p-4"
>
<span
class="flex h-9 w-full items-center justify-between rounded-lg border border-line bg-canvas px-3 text-sm text-ink"
>
Bandung
<svg
class="size-4 text-muted"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
stroke-width="1.5"
stroke-linecap="round"
stroke-linejoin="round"
aria-hidden="true"><path d="m6 9 6 6 6-6" /></svg
></span
>
</div>
<div class="grid gap-1.5 border-l border-line pl-3 text-xs">
<p class="font-medium text-ink">On this page</p>
<p class="text-muted">Usage</p>
<p class="text-muted">Sizes</p>
<p class="text-muted">Error state</p>
</div>
</div></Sidebar
>import { Component } from "@angular/core";
import { Sidebar } from "./markas/sidebar.component";
const mark = [
{ points: "354,578 1256,138 1171,430 268,868", className: "fill-ink/15" },
{ points: "553,443 1455,3 1370,295 467,733", className: "fill-ink/55" },
{
points: "421,762 1325,318 1240,611 336,1050",
className: "fill-success/35",
},
{ points: "265,1073 1169,629 1084,922 180,1362", className: "fill-ink/25" },
{ points: "93,965 997,521 912,814 8,1253", className: "fill-ink/75" },
{
points: "347,1135 1251,691 1166,984 262,1424",
className: "fill-success",
},
];
const sections = [
{
title: "Getting started",
items: [
{
label: "Introduction",
href: "/docs",
icon: "M4 5a2 2 0 0 1 2-2h13v16H6a2 2 0 0 0-2 2zm0 16V5m4 2h7",
},
{
label: "Installation",
href: "/docs/installation",
icon: "M12 4v11m-4-4 4 4 4-4M5 20h14",
},
{
label: "Theming",
href: "/docs/theming",
icon: "M12 3a9 9 0 1 0 0 18c1 0 1.5-.8 1.5-1.5 0-1.2-1-1.5-1-2.5 0-.8.7-1.5 1.5-1.5H17a4 4 0 0 0 4-4c0-4.4-4-8.5-9-8.5M7.5 12h.01M10 7.5h.01M15 7.5h.01",
badge: "New",
},
],
},
{
title: "Components",
items: [
{
label: "Forms",
icon: "M4 4h6v6H4zm10 0h6v6h-6zM4 14h6v6H4zm10 0h6v6h-6z",
children: [
{ label: "Button", href: "/docs/button" },
{ label: "Input", href: "/docs/input" },
{ label: "Select", href: "/docs/select", active: true },
{ label: "Combobox", href: "/docs/combobox" },
],
},
{
label: "Overlays",
icon: "M8 8V5a1 1 0 0 1 1-1h10a1 1 0 0 1 1 1v10a1 1 0 0 1-1 1h-3M4 9a1 1 0 0 1 1-1h10a1 1 0 0 1 1 1v10a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1z",
children: [
{ label: "Modal", href: "/docs/modal" },
{ label: "Drawer", href: "/docs/drawer" },
{ label: "Popover", href: "/docs/popover" },
],
},
{
label: "Motion",
icon: "M12 3v4m0 10v4M3 12h4m10 0h4M6 6l2.5 2.5m7 7L18 18M6 18l2.5-2.5m7-7L18 6",
badge: "New",
children: [
{ label: "Marquee", href: "/docs/marquee" },
{ label: "Text scramble", href: "/docs/text-scramble" },
],
},
],
},
{
title: "Resources",
items: [
{
label: "Templates",
href: "/templates",
icon: "M3 4h18v16H3zm0 5h18M9 9v11",
},
{
label: "Changelog",
href: "/changelog",
icon: "M20 12a8 8 0 1 1-2.3-5.7M20 4v5h-5",
},
],
},
];
@Component({
selector: "markas-example",
imports: [Sidebar],
template: `
<markas-sidebar
[sections]="sections"
breakpoint="sm"
class="h-[560px] rounded-xl border border-line"
><ng-template #header>
<svg class="size-7 shrink-0" viewBox="0 0 1464 1430" aria-hidden="true">
@for (shape of mark; track shape.points) {
<polygon
[attr.points]="shape.points"
[class]="shape.className"
></polygon>
}
</svg>
<span class="font-semibold text-ink">MarkasUI</span>
<span
class="ms-auto me-2 rounded-full border border-line px-2 py-0.5 text-xs text-muted"
>
v1.4
</span>
</ng-template>
<ng-template #footer>
<a
href="/changelog"
class="flex w-full items-center gap-2 rounded-md text-xs text-muted transition-colors duration-150 ease-out hover:text-ink motion-reduce:transition-none"
><span
class="rounded-full bg-success/15 px-1.5 py-0.5 font-medium text-ink"
>
1.4
</span>
Release notes
<svg
class="ms-auto size-4 shrink-0"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
stroke-width="1.5"
stroke-linecap="round"
stroke-linejoin="round"
aria-hidden="true"
>
<path d="M5 12h14m-6-6 6 6-6 6"></path></svg
></a>
</ng-template>
<div class="flex min-w-0 flex-1 flex-col gap-4 p-5">
<div class="grid gap-1.5">
<p class="text-xs text-muted">Components / Forms</p>
<p class="text-xl font-semibold tracking-tight text-ink">Select</p>
<p class="text-xs leading-relaxed text-muted">
A native select with a custom chevron, three sizes, and an error
state.
</p>
</div>
<div
class="grid flex-1 place-items-center rounded-xl border border-line bg-surface p-4"
>
<span
class="flex h-9 w-full items-center justify-between rounded-lg border border-line bg-canvas px-3 text-sm text-ink"
>
Bandung
<svg
class="size-4 text-muted"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
stroke-width="1.5"
stroke-linecap="round"
stroke-linejoin="round"
aria-hidden="true"
>
<path d="m6 9 6 6 6-6"></path></svg
></span>
</div>
<div class="grid gap-1.5 border-l border-line pl-3 text-xs">
<p class="font-medium text-ink">On this page</p>
<p class="text-muted">Usage</p>
<p class="text-muted">Sizes</p>
<p class="text-muted">Error state</p>
</div>
</div></markas-sidebar
>
`,
})
export default class SidebarDocsExample {
protected readonly mark = mark;
protected readonly sections = sections;
}Mengambang
Weekly visitors
12,480
Weekly visitors
12,480
Weekly visitors
12,480
Weekly visitors
12,480
Weekly visitors
12,480
<x-markas.sidebar :sections="[
[
'items' => [
[
'label' => 'Home',
'href' => '/',
'icon' => 'M3 10.5 12 3l9 7.5V20a1 1 0 0 1-1 1h-5v-6h-6v6H4a1 1 0 0 1-1-1z',
],
[
'label' => 'Inbox',
'href' => '/inbox',
'icon' => 'M3 13h5l1.5 3h5l1.5-3h5M5 5h14l2 8v6a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1v-6z',
'badge' => 4,
],
[
'label' => 'Analytics',
'href' => '/analytics',
'icon' => 'M3 3v18h18M7 15l4-4 3 3 5-6',
'active' => true,
],
],
],
[
'title' => 'Team',
'items' => [
[
'label' => 'Members',
'href' => '/members',
'icon' => 'M16 19v-1a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v1M9 10a3 3 0 1 0 0-6 3 3 0 0 0 0 6m13 9v-1a4 4 0 0 0-3-3.9M16 4.1a3 3 0 0 1 0 5.8',
],
[
'label' => 'Billing',
'href' => '/billing',
'icon' => 'M3 6h18v12H3zM3 10h18M7 15h3',
],
],
],
]" breakpoint="sm" variant="floating" class="h-[440px] rounded-xl border border-line [&>aside]:shadow-overlay">
<x-slot:header>
<svg class="size-7 shrink-0" viewBox="0 0 1464 1430" aria-hidden="true"><polygon points="354,578 1256,138 1171,430 268,868" class="fill-ink/15" /><polygon points="553,443 1455,3 1370,295 467,733" class="fill-ink/55" /><polygon points="421,762 1325,318 1240,611 336,1050" class="fill-success/35" /><polygon points="265,1073 1169,629 1084,922 180,1362" class="fill-ink/25" /><polygon points="93,965 997,521 912,814 8,1253" class="fill-ink/75" /><polygon points="347,1135 1251,691 1166,984 262,1424" class="fill-success" /></svg>
<div class="grid min-w-0 leading-tight"><span class="font-semibold text-ink">MarkasUI</span><span class="text-xs text-muted">Team plan</span></div>
</x-slot:header>
<x-slot:footer>
<span class="grid size-8 shrink-0 place-items-center rounded-full bg-primary-soft text-xs font-semibold text-ink">RS</span>
<span class="grid min-w-0 leading-tight"><span class="truncate font-medium text-ink">Rina Saputra</span><span class="truncate text-xs text-muted">rina@markasui.com</span></span>
</x-slot:footer>
<div class="flex min-w-0 flex-1 flex-col gap-3 py-4 pr-4 pl-2">
<div class="flex items-start justify-between">
<div class="grid gap-1"><p class="text-xs text-muted">Weekly visitors</p><p class="text-xl font-semibold tracking-tight text-ink">12,480</p></div>
<span class="rounded-full bg-success/15 px-2 py-0.5 text-xs font-medium text-ink">+18%</span>
</div>
<div class="flex flex-1 items-end gap-1.5 rounded-xl border border-line bg-surface p-3">
@foreach (['h-[40%] bg-primary/15', 'h-[62%] bg-primary/15', 'h-[48%] bg-primary/15', 'h-[78%] bg-primary/15', 'h-[58%] bg-primary/15', 'h-[70%] bg-primary/15', 'h-[92%] bg-success'] as $bar)
<span class="flex-1 rounded-sm {{ $bar }}"></span>
@endforeach
</div>
</div>
</x-markas.sidebar>import { Sidebar } from "@/components/markas/Sidebar";
const mark = [
{ points: "354,578 1256,138 1171,430 268,868", className: "fill-ink/15" },
{ points: "553,443 1455,3 1370,295 467,733", className: "fill-ink/55" },
{
points: "421,762 1325,318 1240,611 336,1050",
className: "fill-success/35",
},
{ points: "265,1073 1169,629 1084,922 180,1362", className: "fill-ink/25" },
{ points: "93,965 997,521 912,814 8,1253", className: "fill-ink/75" },
{
points: "347,1135 1251,691 1166,984 262,1424",
className: "fill-success",
},
];
const bars = [
"h-[40%] bg-primary/15",
"h-[62%] bg-primary/15",
"h-[48%] bg-primary/15",
"h-[78%] bg-primary/15",
"h-[58%] bg-primary/15",
"h-[70%] bg-primary/15",
"h-[92%] bg-success",
];
const sections = [
{
items: [
{
label: "Home",
href: "/",
icon: "M3 10.5 12 3l9 7.5V20a1 1 0 0 1-1 1h-5v-6h-6v6H4a1 1 0 0 1-1-1z",
},
{
label: "Inbox",
href: "/inbox",
icon: "M3 13h5l1.5 3h5l1.5-3h5M5 5h14l2 8v6a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1v-6z",
badge: 4,
},
{
label: "Analytics",
href: "/analytics",
icon: "M3 3v18h18M7 15l4-4 3 3 5-6",
active: true,
},
],
},
{
title: "Team",
items: [
{
label: "Members",
href: "/members",
icon: "M16 19v-1a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v1M9 10a3 3 0 1 0 0-6 3 3 0 0 0 0 6m13 9v-1a4 4 0 0 0-3-3.9M16 4.1a3 3 0 0 1 0 5.8",
},
{
label: "Billing",
href: "/billing",
icon: "M3 6h18v12H3zM3 10h18M7 15h3",
},
],
},
];
export default function Example() {
return (
<Sidebar
sections={sections}
breakpoint="sm"
variant="floating"
className="h-[440px] rounded-xl border border-line [&>aside]:shadow-overlay"
header={
<>
<svg
className="size-7 shrink-0"
viewBox="0 0 1464 1430"
aria-hidden="true"
>
{mark.map((shape) => (
<polygon
key={shape.points}
points={shape.points}
className={shape.className}
/>
))}
</svg>
<div className="grid min-w-0 leading-tight">
<span className="font-semibold text-ink">MarkasUI</span>
<span className="text-xs text-muted">Team plan</span>
</div>
</>
}
footer={
<>
<span className="grid size-8 shrink-0 place-items-center rounded-full bg-primary-soft text-xs font-semibold text-ink">
RS
</span>
<span className="grid min-w-0 leading-tight">
<span className="truncate font-medium text-ink">Rina Saputra</span>
<span className="truncate text-xs text-muted">
rina@markasui.com
</span>
</span>
</>
}
>
<div className="flex min-w-0 flex-1 flex-col gap-3 py-4 pr-4 pl-2">
<div className="flex items-start justify-between">
<div className="grid gap-1">
<p className="text-xs text-muted">Weekly visitors</p>
<p className="text-xl font-semibold tracking-tight text-ink">
12,480
</p>
</div>
<span className="rounded-full bg-success/15 px-2 py-0.5 text-xs font-medium text-ink">
+18%
</span>
</div>
<div className="flex flex-1 items-end gap-1.5 rounded-xl border border-line bg-surface p-3">
{bars.map((bar) => (
<span key={bar} className={`flex-1 rounded-sm ${bar}`}></span>
))}
</div>
</div>
</Sidebar>
);
}<script setup lang="ts">
import Sidebar from "@/components/markas/Sidebar.vue";
const mark = [
{ points: "354,578 1256,138 1171,430 268,868", className: "fill-ink/15" },
{ points: "553,443 1455,3 1370,295 467,733", className: "fill-ink/55" },
{
points: "421,762 1325,318 1240,611 336,1050",
className: "fill-success/35",
},
{ points: "265,1073 1169,629 1084,922 180,1362", className: "fill-ink/25" },
{ points: "93,965 997,521 912,814 8,1253", className: "fill-ink/75" },
{
points: "347,1135 1251,691 1166,984 262,1424",
className: "fill-success",
},
];
const bars = [
"h-[40%] bg-primary/15",
"h-[62%] bg-primary/15",
"h-[48%] bg-primary/15",
"h-[78%] bg-primary/15",
"h-[58%] bg-primary/15",
"h-[70%] bg-primary/15",
"h-[92%] bg-success",
];
const sections = [
{
items: [
{
label: "Home",
href: "/",
icon: "M3 10.5 12 3l9 7.5V20a1 1 0 0 1-1 1h-5v-6h-6v6H4a1 1 0 0 1-1-1z",
},
{
label: "Inbox",
href: "/inbox",
icon: "M3 13h5l1.5 3h5l1.5-3h5M5 5h14l2 8v6a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1v-6z",
badge: 4,
},
{
label: "Analytics",
href: "/analytics",
icon: "M3 3v18h18M7 15l4-4 3 3 5-6",
active: true,
},
],
},
{
title: "Team",
items: [
{
label: "Members",
href: "/members",
icon: "M16 19v-1a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v1M9 10a3 3 0 1 0 0-6 3 3 0 0 0 0 6m13 9v-1a4 4 0 0 0-3-3.9M16 4.1a3 3 0 0 1 0 5.8",
},
{
label: "Billing",
href: "/billing",
icon: "M3 6h18v12H3zM3 10h18M7 15h3",
},
],
},
];
</script>
<template>
<Sidebar
:sections="sections"
breakpoint="sm"
variant="floating"
class="h-[440px] rounded-xl border border-line [&>aside]:shadow-overlay"
>
<template #header>
<svg class="size-7 shrink-0" viewBox="0 0 1464 1430" aria-hidden="true">
<polygon
v-for="shape in mark"
:key="shape.points"
:points="shape.points"
:class="shape.className"
/>
</svg>
<div class="grid min-w-0 leading-tight">
<span class="font-semibold text-ink">MarkasUI</span>
<span class="text-xs text-muted">Team plan</span>
</div>
</template>
<template #footer>
<span
class="grid size-8 shrink-0 place-items-center rounded-full bg-primary-soft text-xs font-semibold text-ink"
>
RS
</span>
<span class="grid min-w-0 leading-tight">
<span class="truncate font-medium text-ink">Rina Saputra</span>
<span class="truncate text-xs text-muted">rina@markasui.com</span>
</span>
</template>
<div class="flex min-w-0 flex-1 flex-col gap-3 py-4 pr-4 pl-2">
<div class="flex items-start justify-between">
<div class="grid gap-1">
<p class="text-xs text-muted">Weekly visitors</p>
<p class="text-xl font-semibold tracking-tight text-ink">12,480</p>
</div>
<span
class="rounded-full bg-success/15 px-2 py-0.5 text-xs font-medium text-ink"
>
+18%
</span>
</div>
<div
class="flex flex-1 items-end gap-1.5 rounded-xl border border-line bg-surface p-3"
>
<span
v-for="bar in bars"
:key="bar"
:class="`flex-1 rounded-sm ${bar}`"
></span>
</div>
</div>
</Sidebar>
</template><script lang="ts">
import Sidebar from "$lib/components/markas/Sidebar.svelte";
const mark = [
{ points: "354,578 1256,138 1171,430 268,868", className: "fill-ink/15" },
{ points: "553,443 1455,3 1370,295 467,733", className: "fill-ink/55" },
{
points: "421,762 1325,318 1240,611 336,1050",
className: "fill-success/35",
},
{ points: "265,1073 1169,629 1084,922 180,1362", className: "fill-ink/25" },
{ points: "93,965 997,521 912,814 8,1253", className: "fill-ink/75" },
{
points: "347,1135 1251,691 1166,984 262,1424",
className: "fill-success",
},
];
const bars = [
"h-[40%] bg-primary/15",
"h-[62%] bg-primary/15",
"h-[48%] bg-primary/15",
"h-[78%] bg-primary/15",
"h-[58%] bg-primary/15",
"h-[70%] bg-primary/15",
"h-[92%] bg-success",
];
const sections = [
{
items: [
{
label: "Home",
href: "/",
icon: "M3 10.5 12 3l9 7.5V20a1 1 0 0 1-1 1h-5v-6h-6v6H4a1 1 0 0 1-1-1z",
},
{
label: "Inbox",
href: "/inbox",
icon: "M3 13h5l1.5 3h5l1.5-3h5M5 5h14l2 8v6a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1v-6z",
badge: 4,
},
{
label: "Analytics",
href: "/analytics",
icon: "M3 3v18h18M7 15l4-4 3 3 5-6",
active: true,
},
],
},
{
title: "Team",
items: [
{
label: "Members",
href: "/members",
icon: "M16 19v-1a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v1M9 10a3 3 0 1 0 0-6 3 3 0 0 0 0 6m13 9v-1a4 4 0 0 0-3-3.9M16 4.1a3 3 0 0 1 0 5.8",
},
{
label: "Billing",
href: "/billing",
icon: "M3 6h18v12H3zM3 10h18M7 15h3",
},
],
},
];
</script>
<Sidebar
{sections}
breakpoint="sm"
variant="floating"
class="h-[440px] rounded-xl border border-line [&>aside]:shadow-overlay"
>{#snippet header()}
<svg class="size-7 shrink-0" viewBox="0 0 1464 1430" aria-hidden="true"
>{#each mark as shape (shape.points)}
<polygon points={shape.points} class={shape.className} />
{/each}</svg
>
<div class="grid min-w-0 leading-tight">
<span class="font-semibold text-ink">MarkasUI</span>
<span class="text-xs text-muted">Team plan</span>
</div>
{/snippet}
{#snippet footer()}
<span
class="grid size-8 shrink-0 place-items-center rounded-full bg-primary-soft text-xs font-semibold text-ink"
>
RS
</span>
<span class="grid min-w-0 leading-tight"
><span class="truncate font-medium text-ink">Rina Saputra</span>
<span class="truncate text-xs text-muted">rina@markasui.com</span></span
>
{/snippet}
<div class="flex min-w-0 flex-1 flex-col gap-3 py-4 pr-4 pl-2">
<div class="flex items-start justify-between">
<div class="grid gap-1">
<p class="text-xs text-muted">Weekly visitors</p>
<p class="text-xl font-semibold tracking-tight text-ink">12,480</p>
</div>
<span
class="rounded-full bg-success/15 px-2 py-0.5 text-xs font-medium text-ink"
>
+18%
</span>
</div>
<div
class="flex flex-1 items-end gap-1.5 rounded-xl border border-line bg-surface p-3"
>
{#each bars as bar (bar)}
<span class={`flex-1 rounded-sm ${bar}`}></span>
{/each}
</div>
</div></Sidebar
>---
import Sidebar from "@/components/markas/Sidebar.astro";
const mark = [
{ points: "354,578 1256,138 1171,430 268,868", className: "fill-ink/15" },
{ points: "553,443 1455,3 1370,295 467,733", className: "fill-ink/55" },
{
points: "421,762 1325,318 1240,611 336,1050",
className: "fill-success/35",
},
{ points: "265,1073 1169,629 1084,922 180,1362", className: "fill-ink/25" },
{ points: "93,965 997,521 912,814 8,1253", className: "fill-ink/75" },
{
points: "347,1135 1251,691 1166,984 262,1424",
className: "fill-success",
},
];
const bars = [
"h-[40%] bg-primary/15",
"h-[62%] bg-primary/15",
"h-[48%] bg-primary/15",
"h-[78%] bg-primary/15",
"h-[58%] bg-primary/15",
"h-[70%] bg-primary/15",
"h-[92%] bg-success",
];
const sections = [
{
items: [
{
label: "Home",
href: "/",
icon: "M3 10.5 12 3l9 7.5V20a1 1 0 0 1-1 1h-5v-6h-6v6H4a1 1 0 0 1-1-1z",
},
{
label: "Inbox",
href: "/inbox",
icon: "M3 13h5l1.5 3h5l1.5-3h5M5 5h14l2 8v6a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1v-6z",
badge: 4,
},
{
label: "Analytics",
href: "/analytics",
icon: "M3 3v18h18M7 15l4-4 3 3 5-6",
active: true,
},
],
},
{
title: "Team",
items: [
{
label: "Members",
href: "/members",
icon: "M16 19v-1a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v1M9 10a3 3 0 1 0 0-6 3 3 0 0 0 0 6m13 9v-1a4 4 0 0 0-3-3.9M16 4.1a3 3 0 0 1 0 5.8",
},
{
label: "Billing",
href: "/billing",
icon: "M3 6h18v12H3zM3 10h18M7 15h3",
},
],
},
];
---
<Sidebar
{sections}
breakpoint="sm"
variant="floating"
class="h-[440px] rounded-xl border border-line [&>aside]:shadow-overlay"
><Fragment slot="header">
<svg class="size-7 shrink-0" viewBox="0 0 1464 1430" aria-hidden="true"
>{mark.map((shape) => (
<polygon points={shape.points} class={shape.className} />
))}</svg
>
<div class="grid min-w-0 leading-tight">
<span class="font-semibold text-ink">MarkasUI</span>
<span class="text-xs text-muted">Team plan</span>
</div>
</Fragment>
<Fragment slot="footer">
<span
class="grid size-8 shrink-0 place-items-center rounded-full bg-primary-soft text-xs font-semibold text-ink"
>
RS
</span>
<span class="grid min-w-0 leading-tight"
><span class="truncate font-medium text-ink">Rina Saputra</span>
<span class="truncate text-xs text-muted">rina@markasui.com</span></span
>
</Fragment>
<div class="flex min-w-0 flex-1 flex-col gap-3 py-4 pr-4 pl-2">
<div class="flex items-start justify-between">
<div class="grid gap-1">
<p class="text-xs text-muted">Weekly visitors</p>
<p class="text-xl font-semibold tracking-tight text-ink">12,480</p>
</div>
<span
class="rounded-full bg-success/15 px-2 py-0.5 text-xs font-medium text-ink"
>
+18%
</span>
</div>
<div
class="flex flex-1 items-end gap-1.5 rounded-xl border border-line bg-surface p-3"
>
{bars.map((bar) => (
<span class={`flex-1 rounded-sm ${bar}`}></span>
))}
</div>
</div></Sidebar
>import { Component } from "@angular/core";
import { Sidebar } from "./markas/sidebar.component";
const mark = [
{ points: "354,578 1256,138 1171,430 268,868", className: "fill-ink/15" },
{ points: "553,443 1455,3 1370,295 467,733", className: "fill-ink/55" },
{
points: "421,762 1325,318 1240,611 336,1050",
className: "fill-success/35",
},
{ points: "265,1073 1169,629 1084,922 180,1362", className: "fill-ink/25" },
{ points: "93,965 997,521 912,814 8,1253", className: "fill-ink/75" },
{
points: "347,1135 1251,691 1166,984 262,1424",
className: "fill-success",
},
];
const bars = [
"h-[40%] bg-primary/15",
"h-[62%] bg-primary/15",
"h-[48%] bg-primary/15",
"h-[78%] bg-primary/15",
"h-[58%] bg-primary/15",
"h-[70%] bg-primary/15",
"h-[92%] bg-success",
];
const sections = [
{
items: [
{
label: "Home",
href: "/",
icon: "M3 10.5 12 3l9 7.5V20a1 1 0 0 1-1 1h-5v-6h-6v6H4a1 1 0 0 1-1-1z",
},
{
label: "Inbox",
href: "/inbox",
icon: "M3 13h5l1.5 3h5l1.5-3h5M5 5h14l2 8v6a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1v-6z",
badge: 4,
},
{
label: "Analytics",
href: "/analytics",
icon: "M3 3v18h18M7 15l4-4 3 3 5-6",
active: true,
},
],
},
{
title: "Team",
items: [
{
label: "Members",
href: "/members",
icon: "M16 19v-1a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v1M9 10a3 3 0 1 0 0-6 3 3 0 0 0 0 6m13 9v-1a4 4 0 0 0-3-3.9M16 4.1a3 3 0 0 1 0 5.8",
},
{
label: "Billing",
href: "/billing",
icon: "M3 6h18v12H3zM3 10h18M7 15h3",
},
],
},
];
@Component({
selector: "markas-example",
imports: [Sidebar],
template: `
<markas-sidebar
[sections]="sections"
breakpoint="sm"
variant="floating"
class="h-[440px] rounded-xl border border-line [&>aside]:shadow-overlay"
><ng-template #header>
<svg class="size-7 shrink-0" viewBox="0 0 1464 1430" aria-hidden="true">
@for (shape of mark; track shape.points) {
<polygon
[attr.points]="shape.points"
[class]="shape.className"
></polygon>
}
</svg>
<div class="grid min-w-0 leading-tight">
<span class="font-semibold text-ink">MarkasUI</span>
<span class="text-xs text-muted">Team plan</span>
</div>
</ng-template>
<ng-template #footer>
<span
class="grid size-8 shrink-0 place-items-center rounded-full bg-primary-soft text-xs font-semibold text-ink"
>
RS
</span>
<span class="grid min-w-0 leading-tight"
><span class="truncate font-medium text-ink">Rina Saputra</span>
<span class="truncate text-xs text-muted"
>rina@markasui.com</span
></span
>
</ng-template>
<div class="flex min-w-0 flex-1 flex-col gap-3 py-4 pr-4 pl-2">
<div class="flex items-start justify-between">
<div class="grid gap-1">
<p class="text-xs text-muted">Weekly visitors</p>
<p class="text-xl font-semibold tracking-tight text-ink">12,480</p>
</div>
<span
class="rounded-full bg-success/15 px-2 py-0.5 text-xs font-medium text-ink"
>
+18%
</span>
</div>
<div
class="flex flex-1 items-end gap-1.5 rounded-xl border border-line bg-surface p-3"
>
@for (bar of bars; track bar) {
<span [class]="\`flex-1 rounded-sm \${bar}\`"></span>
}
</div></div
></markas-sidebar>
`,
})
export default class SidebarFloatingExample {
protected readonly mark = mark;
protected readonly bars = bars;
protected readonly sections = sections;
}Instalasi
npx markasui@latest add sidebarpnpm dlx markasui@latest add sidebaryarn dlx markasui@latest add sidebarbunx --bun markasui@latest add sidebar- 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/sidebar.blade.php.
@props([
'sections' => [],
'variant' => 'default',
'breakpoint' => 'md',
'collapsed' => false,
'navLabel' => 'Sidebar',
'collapseLabel' => 'Collapse sidebar',
'expandLabel' => 'Expand sidebar',
'openLabel' => 'Open sidebar',
'closeLabel' => 'Close sidebar',
])
@php
$root = '@container flex overflow-hidden bg-canvas';
$aside = 'relative hidden w-56 shrink-0 flex-col bg-surface text-sm transition-[width] duration-200 ease-out data-[state=collapsed]:w-16 motion-reduce:transition-none **:focus-visible:outline-2 **:focus-visible:outline-offset-2 **:focus-visible:outline-primary motion-reduce:**:transition-none';
$variants = [
'default' => 'border-r border-line',
'floating' => 'm-2 rounded-xl border border-line',
];
$showAside = ['sm' => '@sm:flex', 'md' => '@2xl:flex', 'lg' => '@4xl:flex'];
$hideBar = ['sm' => '@sm:hidden', 'md' => '@2xl:hidden', 'lg' => '@4xl:hidden'];
$headerClass = 'flex h-14 shrink-0 items-center border-b border-line px-4';
// Isi header dan footer dipotong di tepi konten agar rail hanya menampilkan 32px pertama.
$slotClass = 'flex min-w-0 flex-1 items-center gap-2 overflow-hidden whitespace-nowrap';
$footerClass = 'shrink-0 border-t border-line px-4 py-3';
$collapseButton = 'absolute top-4 -right-3 z-10 grid size-6 place-items-center rounded-full border border-line bg-surface text-muted transition-colors duration-150 ease-out hover:text-ink';
$collapseIcon = 'size-3.5 transition-transform duration-200 ease-out in-data-[state=collapsed]:rotate-180';
$navClass = 'min-h-0 flex-1 overflow-y-auto p-3 in-data-[state=collapsed]:overflow-visible';
$listWrap = 'relative grid gap-3 [anchor-scope:--active,--hover]';
$indicator = 'absolute inset-[anchor(--hover_top,anchor(--active_top))_anchor(--hover_right,anchor(--active_right))_anchor(--hover_bottom,anchor(--active_bottom))_anchor(--hover_left,anchor(--active_left))] rounded-md bg-subtle transition-[inset] duration-200 ease-out';
$sectionClass = 'grid gap-0.5 border-t border-line pt-3 first-of-type:border-t-0 first-of-type:pt-0';
$titleClass = 'px-2.5 pb-1 text-xs font-medium text-faint in-data-[state=collapsed]:sr-only';
$listClass = 'grid gap-0.5';
$item = 'group/item relative flex h-9 w-full items-center gap-3 rounded-md px-2.5 text-left text-muted transition-colors duration-150 ease-out hover:text-ink aria-disabled:pointer-events-none aria-disabled:opacity-50 aria-[current=page]:font-medium aria-[current=page]:text-ink hover:[anchor-name:--hover] focus-visible:[anchor-name:--hover] aria-[current=page]:[anchor-name:--active] [&:has(+div_[aria-current=page])]:[anchor-name:--active]';
$iconClass = 'size-5 shrink-0';
$labelClass = 'min-w-0 flex-1 truncate in-data-[state=collapsed]:sr-only';
$badgeClass = 'rounded-full bg-primary-soft px-1.5 py-0.5 text-xs leading-none font-medium text-primary in-data-[state=collapsed]:sr-only';
$dot = 'absolute top-1.5 right-1.5 hidden size-2 rounded-full bg-primary in-data-[state=collapsed]:block';
$chevron = 'size-4 shrink-0 text-faint transition-transform duration-200 ease-out group-aria-expanded/item:rotate-90 in-data-[state=collapsed]:hidden';
$tip = 'absolute top-1/2 left-full ml-3 hidden -translate-y-1/2 rounded-md bg-ink px-2 py-1 text-xs whitespace-nowrap text-canvas shadow-overlay in-data-[state=collapsed]:group-hover/item:block in-data-[state=collapsed]:group-focus-visible/item:block';
$region = 'invisible grid grid-rows-[0fr] transition-[grid-template-rows,visibility] duration-200 ease-out data-[state=open]:visible data-[state=open]:grid-rows-[1fr] in-data-[state=collapsed]:hidden';
$regionInner = 'min-h-0 overflow-hidden';
$subList = 'ml-5 grid gap-0.5 border-l border-line py-1 pr-1 pl-2';
$subItem = 'relative flex h-8 w-full items-center rounded-md px-2.5 text-muted transition-colors duration-150 ease-out hover:text-ink aria-disabled:pointer-events-none aria-disabled:opacity-50 aria-[current=page]:font-medium aria-[current=page]:text-ink hover:[anchor-name:--hover] focus-visible:[anchor-name:--hover] aria-[current=page]:[anchor-name:--active] in-data-[state=closed]:[anchor-name:none]!';
$content = 'flex min-w-0 flex-1 flex-col';
$mobileBar = 'flex h-14 shrink-0 items-center border-b border-line px-3';
$iconButton = 'grid size-9 shrink-0 place-items-center rounded-md text-ink transition-colors duration-150 ease-out hover:bg-subtle focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary motion-reduce:transition-none';
$dialogClass = 'right-auto left-0 m-0 h-dvh max-h-dvh w-72 flex-col border-r border-line bg-surface p-0 text-sm text-ink shadow-overlay transition-transform duration-200 ease-out backdrop:bg-ink/40 open:flex starting:open:-translate-x-full motion-reduce:transition-none **:focus-visible:outline-2 **:focus-visible:outline-offset-2 **:focus-visible:outline-primary motion-reduce:**:transition-none';
// Href berskema selain http, https, mailto, dan tel (misalnya javascript:) diganti "#". Spasi dan karakter kontrol diabaikan seperti di browser.
$safeHref = fn (string $href): string => preg_match('/^(?!https?:|mailto:|tel:)[a-z][\w+.\-]*:/i', preg_replace('/[\x00-\x20]/', '', $href)) === 1 ? '#' : $href;
$svg = 'viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"';
$hasBadge = fn (array $entry): bool => isset($entry['badge']) && $entry['badge'] !== '';
// Header dan footer dicetak dua kali (aside dan dialog seluler). Id di salinan dialog diberi akhiran -m agar komponen di dalamnya (dropdown, command) tidak bentrok.
$mobileCopy = fn ($html): string => preg_replace_callback(
'/(?<=\s)(id|for|popovertarget|aria-(?:controls|labelledby|describedby|owns))="([^"]*)"/',
fn (array $m): string => $m[1].'="'.implode(' ', array_map(fn (string $ref): string => $ref.'-m', preg_split('/\s+/', trim($m[2])))).'"',
(string) $html,
);
// Same id on every render, so Livewire's morph (which matches elements by id) keeps the element. Pass `id` to set it.
$idKey = 'markas-sidebar|'.(isset($this) && $this instanceof \Livewire\Component ? $this->getId() : '').'|'.($attributes->get('wire:key') ?? $attributes->whereStartsWith('wire:model')->first() ?? $attributes->get('name')).'|';
for ($idIndex = 0; $__env->hasRenderedOnce($idKey.$idIndex); $idIndex++);
$__env->markAsRenderedOnce($idKey.$idIndex);
$id = $attributes->get('id') ?? 'markas-sidebar-'.hash('xxh32', $idKey.$idIndex);
$asideId = $id.'-aside';
$dialogId = $id.'-dialog';
// Grup sub-item terbuka di awal bila open diisi atau ada sub-item aktif.
$groups = [];
foreach ($sections as $s => $section) {
foreach ($section['items'] ?? [] as $i => $entry) {
$childActive = collect($entry['children'] ?? [])->contains(fn ($child) => ! empty($child['active']));
$groups[$s.'-'.$i] = (bool) ($entry['open'] ?? $childActive);
}
}
@endphp
<div
x-data="{
collapsed: @js((bool) $collapsed),
groups: @js((object) $groups),
setCollapsed(value) {
this.collapsed = value;
this.$dispatch('markas-collapsed-change', value);
},
{{-- Di rail, tombol induk membentangkan sidebar dan membuka grupnya. --}}
toggleGroup(key, rail) {
if (rail) this.setCollapsed(false);
this.groups[key] = rail || ! this.groups[key];
},
}"
{{ $attributes->merge(['id' => $id])->class([$root]) }}
>
@foreach (['d', 'm'] as $copy)
@php
$prefix = $id.'-'.$copy;
$rail = $copy === 'd' ? 'collapsed' : 'false';
@endphp
@if ($copy === 'd')
<aside
id="{{ $asideId }}"
data-state="{{ $collapsed ? 'collapsed' : 'expanded' }}"
:data-state="collapsed ? 'collapsed' : 'expanded'"
class="{{ $aside }} {{ $variants[$variant] }} {{ $showAside[$breakpoint] }}"
>
@isset($header)
<div class="{{ $headerClass }}"><div class="{{ $slotClass }}">{{ $header }}</div></div>
@endisset
@else
<dialog
wire:ignore.self
x-ref="dialog"
id="{{ $dialogId }}"
aria-label="{{ $navLabel }}"
@click="if ($event.target === $el || $event.target.closest('a[href]')) $el.close()"
class="{{ $dialogClass }}"
>
<div class="{{ $headerClass }}">
<div class="{{ $slotClass }}">{!! $mobileCopy($header ?? '') !!}</div>
<form method="dialog">
<button type="submit" aria-label="{{ $closeLabel }}" class="{{ $iconButton }}">
<svg class="{{ $iconClass }}" {!! $svg !!}><path d="M18 6 6 18M6 6l12 12" /></svg>
</button>
</form>
</div>
@endif
<nav aria-label="{{ $navLabel }}" class="{{ $navClass }}">
<div class="{{ $listWrap }}">
<span aria-hidden="true" class="{{ $indicator }}"></span>
@foreach ($sections as $s => $section)
<div class="{{ $sectionClass }}">
@if (! empty($section['title']))
<p aria-hidden="true" class="{{ $titleClass }}">{{ $section['title'] }}</p>
@endif
<ul @if (! empty($section['title'])) aria-label="{{ $section['title'] }}" @endif class="{{ $listClass }}">
@foreach ($section['items'] ?? [] as $i => $entry)
@php
$key = $s.'-'.$i;
$open = $groups[$key];
$regionId = $prefix.'-g'.$key;
@endphp
<li>
@if (! empty($entry['children']))
<button
type="button"
aria-expanded="{{ $open ? 'true' : 'false' }}"
aria-controls="{{ $regionId }}"
:aria-expanded="groups['{{ $key }}'] ? 'true' : 'false'"
@click="toggleGroup('{{ $key }}', {{ $rail }})"
class="{{ $item }}"
>
@if (! empty($entry['icon']))
<svg class="{{ $iconClass }}" {!! $svg !!}><path d="{{ $entry['icon'] }}" /></svg>
@endif
<span class="{{ $labelClass }}">{{ $entry['label'] }}</span>
@if ($hasBadge($entry))
<span class="{{ $badgeClass }}">{{ $entry['badge'] }}</span>
<span aria-hidden="true" class="{{ $dot }}"></span>
@endif
<svg class="{{ $chevron }}" {!! $svg !!}><path d="m9 6 6 6-6 6" /></svg>
<span aria-hidden="true" class="{{ $tip }}">{{ $entry['label'] }}</span>
</button>
<div
id="{{ $regionId }}"
data-state="{{ $open ? 'open' : 'closed' }}"
:data-state="groups['{{ $key }}'] ? 'open' : 'closed'"
class="{{ $region }}"
>
<div class="{{ $regionInner }}">
<ul class="{{ $subList }}">
@foreach ($entry['children'] as $child)
<li>
@if (! empty($child['disabled']))
<a role="link" aria-disabled="true" class="{{ $subItem }}">{{ $child['label'] }}</a>
@else
<a
href="{{ $safeHref((string) ($child['href'] ?? '#')) }}"
@if (! empty($child['active'])) aria-current="page" @endif
class="{{ $subItem }}"
>{{ $child['label'] }}</a>
@endif
</li>
@endforeach
</ul>
</div>
</div>
@else
<a
@if (! empty($entry['disabled']))
role="link" aria-disabled="true"
@else
href="{{ $safeHref((string) ($entry['href'] ?? '#')) }}"
@if (! empty($entry['active'])) aria-current="page" @endif
@endif
class="{{ $item }}"
>
@if (! empty($entry['icon']))
<svg class="{{ $iconClass }}" {!! $svg !!}><path d="{{ $entry['icon'] }}" /></svg>
@endif
<span class="{{ $labelClass }}">{{ $entry['label'] }}</span>
@if ($hasBadge($entry))
<span class="{{ $badgeClass }}">{{ $entry['badge'] }}</span>
<span aria-hidden="true" class="{{ $dot }}"></span>
@endif
<span aria-hidden="true" class="{{ $tip }}">{{ $entry['label'] }}</span>
</a>
@endif
</li>
@endforeach
</ul>
</div>
@endforeach
</div>
</nav>
@isset($footer)
<div class="{{ $footerClass }}"><div class="{{ $slotClass }}">{!! $copy === 'd' ? $footer : $mobileCopy($footer) !!}</div></div>
@endisset
@if ($copy === 'd')
<button
type="button"
aria-label="{{ $collapsed ? $expandLabel : $collapseLabel }}"
aria-expanded="{{ $collapsed ? 'false' : 'true' }}"
aria-controls="{{ $asideId }}"
:aria-label="collapsed ? @js($expandLabel) : @js($collapseLabel)"
:aria-expanded="collapsed ? 'false' : 'true'"
@click="setCollapsed(! collapsed)"
class="{{ $collapseButton }}"
>
<svg class="{{ $collapseIcon }}" {!! $svg !!}><path d="m15 6-6 6 6 6" /></svg>
</button>
</aside>
@else
</dialog>
@endif
@endforeach
<div class="{{ $content }}">
<div class="{{ $mobileBar }} {{ $hideBar[$breakpoint] }}">
<button
type="button"
aria-label="{{ $openLabel }}"
aria-haspopup="dialog"
aria-controls="{{ $dialogId }}"
@click="$refs.dialog.showModal()"
class="{{ $iconButton }}"
>
<svg class="{{ $iconClass }}" {!! $svg !!}><path d="M4 6h16M4 12h16M4 18h16" /></svg>
</button>
</div>
{{ $slot }}
</div>
</div>- Pastikan Tailwind CSS v4 dan markas.css sudah terpasang. Lihat Instalasi.
- Salin source komponen di bawah ini ke
src/components/markas/Sidebar.tsx.
"use client";
import {
useId,
useRef,
useState,
type ComponentProps,
type MouseEvent,
type ReactNode,
} from "react";
const root = "@container flex overflow-hidden bg-canvas";
const aside =
"relative hidden w-56 shrink-0 flex-col bg-surface text-sm transition-[width] duration-200 ease-out data-[state=collapsed]:w-16 motion-reduce:transition-none **:focus-visible:outline-2 **:focus-visible:outline-offset-2 **:focus-visible:outline-primary motion-reduce:**:transition-none";
const variants = {
default: "border-r border-line",
floating: "m-2 rounded-xl border border-line",
};
const showAside = { sm: "@sm:flex", md: "@2xl:flex", lg: "@4xl:flex" };
const hideBar = { sm: "@sm:hidden", md: "@2xl:hidden", lg: "@4xl:hidden" };
const headerClass = "flex h-14 shrink-0 items-center border-b border-line px-4";
/** Isi header dan footer dipotong di tepi konten agar rail hanya menampilkan 32px pertama. */
const slotClass =
"flex min-w-0 flex-1 items-center gap-2 overflow-hidden whitespace-nowrap";
const footerClass = "shrink-0 border-t border-line px-4 py-3";
const collapseButton =
"absolute top-4 -right-3 z-10 grid size-6 place-items-center rounded-full border border-line bg-surface text-muted transition-colors duration-150 ease-out hover:text-ink";
const collapseIcon =
"size-3.5 transition-transform duration-200 ease-out in-data-[state=collapsed]:rotate-180";
const navClass =
"min-h-0 flex-1 overflow-y-auto p-3 in-data-[state=collapsed]:overflow-visible";
const listWrap = "relative grid gap-3 [anchor-scope:--active,--hover]";
const indicator =
"absolute inset-[anchor(--hover_top,anchor(--active_top))_anchor(--hover_right,anchor(--active_right))_anchor(--hover_bottom,anchor(--active_bottom))_anchor(--hover_left,anchor(--active_left))] rounded-md bg-subtle transition-[inset] duration-200 ease-out";
const sectionClass =
"grid gap-0.5 border-t border-line pt-3 first-of-type:border-t-0 first-of-type:pt-0";
const titleClass =
"px-2.5 pb-1 text-xs font-medium text-faint in-data-[state=collapsed]:sr-only";
const listClass = "grid gap-0.5";
const item =
"group/item relative flex h-9 w-full items-center gap-3 rounded-md px-2.5 text-left text-muted transition-colors duration-150 ease-out hover:text-ink aria-disabled:pointer-events-none aria-disabled:opacity-50 aria-[current=page]:font-medium aria-[current=page]:text-ink hover:[anchor-name:--hover] focus-visible:[anchor-name:--hover] aria-[current=page]:[anchor-name:--active] [&:has(+div_[aria-current=page])]:[anchor-name:--active]";
const iconClass = "size-5 shrink-0";
const labelClass = "min-w-0 flex-1 truncate in-data-[state=collapsed]:sr-only";
const badgeClass =
"rounded-full bg-primary-soft px-1.5 py-0.5 text-xs leading-none font-medium text-primary in-data-[state=collapsed]:sr-only";
const dot =
"absolute top-1.5 right-1.5 hidden size-2 rounded-full bg-primary in-data-[state=collapsed]:block";
const chevron =
"size-4 shrink-0 text-faint transition-transform duration-200 ease-out group-aria-expanded/item:rotate-90 in-data-[state=collapsed]:hidden";
const tip =
"absolute top-1/2 left-full ml-3 hidden -translate-y-1/2 rounded-md bg-ink px-2 py-1 text-xs whitespace-nowrap text-canvas shadow-overlay in-data-[state=collapsed]:group-hover/item:block in-data-[state=collapsed]:group-focus-visible/item:block";
const region =
"invisible grid grid-rows-[0fr] transition-[grid-template-rows,visibility] duration-200 ease-out data-[state=open]:visible data-[state=open]:grid-rows-[1fr] in-data-[state=collapsed]:hidden";
const regionInner = "min-h-0 overflow-hidden";
const subList = "ml-5 grid gap-0.5 border-l border-line py-1 pr-1 pl-2";
const subItem =
"relative flex h-8 w-full items-center rounded-md px-2.5 text-muted transition-colors duration-150 ease-out hover:text-ink aria-disabled:pointer-events-none aria-disabled:opacity-50 aria-[current=page]:font-medium aria-[current=page]:text-ink hover:[anchor-name:--hover] focus-visible:[anchor-name:--hover] aria-[current=page]:[anchor-name:--active] in-data-[state=closed]:[anchor-name:none]!";
const content = "flex min-w-0 flex-1 flex-col";
const mobileBar = "flex h-14 shrink-0 items-center border-b border-line px-3";
const iconButton =
"grid size-9 shrink-0 place-items-center rounded-md text-ink transition-colors duration-150 ease-out hover:bg-subtle focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary motion-reduce:transition-none";
const dialogClass =
"right-auto left-0 m-0 h-dvh max-h-dvh w-72 flex-col border-r border-line bg-surface p-0 text-sm text-ink shadow-overlay transition-transform duration-200 ease-out backdrop:bg-ink/40 open:flex starting:open:-translate-x-full motion-reduce:transition-none **:focus-visible:outline-2 **:focus-visible:outline-offset-2 **:focus-visible:outline-primary motion-reduce:**:transition-none";
const cx = (...c: (string | false | null | undefined)[]) =>
c.filter(Boolean).join(" ");
/** Href berskema selain http, https, mailto, dan tel (misalnya javascript:) diganti "#". Spasi dan karakter kontrol diabaikan seperti di browser. */
const safeHref = (href: string) =>
/^(?!https?:|mailto:|tel:)[a-z][\w+.-]*:/i.test(href.replace(/[\0- ]/g, ""))
? "#"
: href;
export type SidebarItem = {
label: string;
/** Tujuan link. Diabaikan bila item punya children. */
href?: string;
/** Data path SVG (atribut d) untuk ikon 24x24 bergaris. */
icon?: string;
badge?: string | number;
/** Tandai halaman yang sedang dibuka. */
active?: boolean;
disabled?: boolean;
/** Sub-item. Item induk menjadi tombol buka/tutup. */
children?: SidebarItem[];
/** Sub-item terbuka di awal. Default: terbuka bila ada sub-item aktif. */
open?: boolean;
};
export type SidebarSection = { title?: string; items: SidebarItem[] };
export type SidebarProps = ComponentProps<"div"> & {
sections?: SidebarSection[];
/** Brand atau workspace di atas sidebar. */
header?: ReactNode;
/** Profil pengguna di bawah sidebar. */
footer?: ReactNode;
variant?: keyof typeof variants;
/** Lebar kontainer minimum agar sidebar tampil di samping konten: sm 24rem, md 42rem, lg 56rem. */
breakpoint?: keyof typeof showAside;
/** Mode rail ikon (terkontrol). */
collapsed?: boolean;
defaultCollapsed?: boolean;
onCollapsedChange?: (collapsed: boolean) => void;
navLabel?: string;
collapseLabel?: string;
expandLabel?: string;
openLabel?: string;
closeLabel?: string;
};
const linkProps = (entry: SidebarItem) =>
entry.disabled
? { role: "link", "aria-disabled": true }
: {
href: safeHref(entry.href ?? "#"),
"aria-current": entry.active ? ("page" as const) : undefined,
};
function Icon({ d, className }: { d: string; className: string }) {
return (
<svg
className={className}
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
strokeWidth="1.5"
strokeLinecap="round"
strokeLinejoin="round"
aria-hidden="true"
>
<path d={d} />
</svg>
);
}
export function Sidebar({
sections = [],
header,
footer,
variant = "default",
breakpoint = "md",
collapsed,
defaultCollapsed = false,
onCollapsedChange,
navLabel = "Sidebar",
collapseLabel = "Collapse sidebar",
expandLabel = "Expand sidebar",
openLabel = "Open sidebar",
closeLabel = "Close sidebar",
id,
className,
children,
...props
}: SidebarProps) {
const generatedId = useId();
const rootId = id ?? generatedId;
const asideId = `${rootId}-aside`;
const dialogId = `${rootId}-dialog`;
const dialogRef = useRef<HTMLDialogElement>(null);
const [localCollapsed, setLocalCollapsed] = useState(defaultCollapsed);
const [groups, setGroups] = useState(() =>
Object.fromEntries(
sections.flatMap((section, s) =>
section.items.map((entry, i) => [
`${s}-${i}`,
entry.open ?? !!entry.children?.some((child) => child.active),
]),
),
),
);
const isCollapsed = collapsed ?? localCollapsed;
const setCollapsed = (next: boolean) => {
setLocalCollapsed(next);
onCollapsedChange?.(next);
};
const toggleGroup = (key: string, rail: boolean) => {
if (rail) setCollapsed(false);
setGroups((current) => ({ ...current, [key]: rail || !current[key] }));
};
const showMobile = () => dialogRef.current?.showModal();
const onDialogClick = (event: MouseEvent<HTMLDialogElement>) => {
const target = event.target as Element;
if (target === event.currentTarget || target.closest("a[href]"))
event.currentTarget.close();
};
/** Nav yang sama dipakai di sidebar desktop (prefix d) dan dialog seluler (prefix m). */
const nav = (prefix: string, rail: boolean) => (
<nav aria-label={navLabel} className={navClass}>
<div className={listWrap}>
<span aria-hidden="true" className={indicator} />
{sections.map((section, s) => (
<div key={s} className={sectionClass}>
{section.title && (
<p aria-hidden="true" className={titleClass}>
{section.title}
</p>
)}
<ul aria-label={section.title} className={listClass}>
{section.items.map((entry, i) => {
const key = `${s}-${i}`;
const regionId = `${rootId}-${prefix}-g${key}`;
const hasBadge = entry.badge != null && entry.badge !== "";
const body = (
<>
{entry.icon && (
<Icon d={entry.icon} className={iconClass} />
)}
<span className={labelClass}>{entry.label}</span>
{hasBadge && (
<span className={badgeClass}>{entry.badge}</span>
)}
{hasBadge && <span aria-hidden="true" className={dot} />}
{!!entry.children?.length && (
<Icon d="m9 6 6 6-6 6" className={chevron} />
)}
<span aria-hidden="true" className={tip}>
{entry.label}
</span>
</>
);
return (
<li key={i}>
{entry.children?.length ? (
<>
<button
type="button"
aria-expanded={!!groups[key]}
aria-controls={regionId}
className={item}
onClick={() => toggleGroup(key, rail)}
>
{body}
</button>
<div
id={regionId}
data-state={groups[key] ? "open" : "closed"}
className={region}
>
<div className={regionInner}>
<ul className={subList}>
{entry.children.map((child, c) => (
<li key={c}>
<a {...linkProps(child)} className={subItem}>
{child.label}
</a>
</li>
))}
</ul>
</div>
</div>
</>
) : (
<a {...linkProps(entry)} className={item}>
{body}
</a>
)}
</li>
);
})}
</ul>
</div>
))}
</div>
</nav>
);
return (
<div id={rootId} className={cx(root, className)} {...props}>
<aside
id={asideId}
data-state={isCollapsed ? "collapsed" : "expanded"}
className={cx(aside, variants[variant], showAside[breakpoint])}
>
{header && (
<div className={headerClass}>
<div className={slotClass}>{header}</div>
</div>
)}
{nav("d", isCollapsed)}
{footer && (
<div className={footerClass}>
<div className={slotClass}>{footer}</div>
</div>
)}
<button
type="button"
aria-label={isCollapsed ? expandLabel : collapseLabel}
aria-expanded={!isCollapsed}
aria-controls={asideId}
className={collapseButton}
onClick={() => setCollapsed(!isCollapsed)}
>
<Icon d="m15 6-6 6 6 6" className={collapseIcon} />
</button>
</aside>
<dialog
ref={dialogRef}
id={dialogId}
aria-label={navLabel}
className={dialogClass}
onClick={onDialogClick}
>
<div className={headerClass}>
<div className={slotClass}>{header}</div>
<form method="dialog">
<button
type="submit"
aria-label={closeLabel}
className={iconButton}
>
<Icon d="M18 6 6 18M6 6l12 12" className={iconClass} />
</button>
</form>
</div>
{nav("m", false)}
{footer && (
<div className={footerClass}>
<div className={slotClass}>{footer}</div>
</div>
)}
</dialog>
<div className={content}>
<div className={cx(mobileBar, hideBar[breakpoint])}>
<button
type="button"
aria-label={openLabel}
aria-haspopup="dialog"
aria-controls={dialogId}
className={iconButton}
onClick={showMobile}
>
<Icon d="M4 6h16M4 12h16M4 18h16" className={iconClass} />
</button>
</div>
{children}
</div>
</div>
);
}- Pastikan Tailwind CSS v4 dan markas.css sudah terpasang. Lihat Instalasi.
- Salin source komponen di bawah ini ke
src/components/markas/Sidebar.vue.
<script setup lang="ts">
import { computed, h, ref, useAttrs, useId, useSlots } from "vue";
export type SidebarItem = {
label: string;
/** Tujuan link. Diabaikan bila item punya children. */
href?: string;
/** Data path SVG (atribut d) untuk ikon 24x24 bergaris. */
icon?: string;
badge?: string | number;
/** Tandai halaman yang sedang dibuka. */
active?: boolean;
disabled?: boolean;
/** Sub-item. Item induk menjadi tombol buka/tutup. */
children?: SidebarItem[];
/** Sub-item terbuka di awal. Default: terbuka bila ada sub-item aktif. */
open?: boolean;
};
export type SidebarSection = { title?: string; items: SidebarItem[] };
const root = "@container flex overflow-hidden bg-canvas";
const aside =
"relative hidden w-56 shrink-0 flex-col bg-surface text-sm transition-[width] duration-200 ease-out data-[state=collapsed]:w-16 motion-reduce:transition-none **:focus-visible:outline-2 **:focus-visible:outline-offset-2 **:focus-visible:outline-primary motion-reduce:**:transition-none";
const variants = {
default: "border-r border-line",
floating: "m-2 rounded-xl border border-line",
};
const showAside = { sm: "@sm:flex", md: "@2xl:flex", lg: "@4xl:flex" };
const hideBar = { sm: "@sm:hidden", md: "@2xl:hidden", lg: "@4xl:hidden" };
const headerClass = "flex h-14 shrink-0 items-center border-b border-line px-4";
/** Isi header dan footer dipotong di tepi konten agar rail hanya menampilkan 32px pertama. */
const slotClass =
"flex min-w-0 flex-1 items-center gap-2 overflow-hidden whitespace-nowrap";
const footerClass = "shrink-0 border-t border-line px-4 py-3";
const collapseButton =
"absolute top-4 -right-3 z-10 grid size-6 place-items-center rounded-full border border-line bg-surface text-muted transition-colors duration-150 ease-out hover:text-ink";
const collapseIcon =
"size-3.5 transition-transform duration-200 ease-out in-data-[state=collapsed]:rotate-180";
const navClass =
"min-h-0 flex-1 overflow-y-auto p-3 in-data-[state=collapsed]:overflow-visible";
const listWrap = "relative grid gap-3 [anchor-scope:--active,--hover]";
const indicator =
"absolute inset-[anchor(--hover_top,anchor(--active_top))_anchor(--hover_right,anchor(--active_right))_anchor(--hover_bottom,anchor(--active_bottom))_anchor(--hover_left,anchor(--active_left))] rounded-md bg-subtle transition-[inset] duration-200 ease-out";
const sectionClass =
"grid gap-0.5 border-t border-line pt-3 first-of-type:border-t-0 first-of-type:pt-0";
const titleClass =
"px-2.5 pb-1 text-xs font-medium text-faint in-data-[state=collapsed]:sr-only";
const listClass = "grid gap-0.5";
const item =
"group/item relative flex h-9 w-full items-center gap-3 rounded-md px-2.5 text-left text-muted transition-colors duration-150 ease-out hover:text-ink aria-disabled:pointer-events-none aria-disabled:opacity-50 aria-[current=page]:font-medium aria-[current=page]:text-ink hover:[anchor-name:--hover] focus-visible:[anchor-name:--hover] aria-[current=page]:[anchor-name:--active] [&:has(+div_[aria-current=page])]:[anchor-name:--active]";
const iconClass = "size-5 shrink-0";
const labelClass = "min-w-0 flex-1 truncate in-data-[state=collapsed]:sr-only";
const badgeClass =
"rounded-full bg-primary-soft px-1.5 py-0.5 text-xs leading-none font-medium text-primary in-data-[state=collapsed]:sr-only";
const dot =
"absolute top-1.5 right-1.5 hidden size-2 rounded-full bg-primary in-data-[state=collapsed]:block";
const chevron =
"size-4 shrink-0 text-faint transition-transform duration-200 ease-out group-aria-expanded/item:rotate-90 in-data-[state=collapsed]:hidden";
const tip =
"absolute top-1/2 left-full ml-3 hidden -translate-y-1/2 rounded-md bg-ink px-2 py-1 text-xs whitespace-nowrap text-canvas shadow-overlay in-data-[state=collapsed]:group-hover/item:block in-data-[state=collapsed]:group-focus-visible/item:block";
const region =
"invisible grid grid-rows-[0fr] transition-[grid-template-rows,visibility] duration-200 ease-out data-[state=open]:visible data-[state=open]:grid-rows-[1fr] in-data-[state=collapsed]:hidden";
const regionInner = "min-h-0 overflow-hidden";
const subList = "ml-5 grid gap-0.5 border-l border-line py-1 pr-1 pl-2";
const subItem =
"relative flex h-8 w-full items-center rounded-md px-2.5 text-muted transition-colors duration-150 ease-out hover:text-ink aria-disabled:pointer-events-none aria-disabled:opacity-50 aria-[current=page]:font-medium aria-[current=page]:text-ink hover:[anchor-name:--hover] focus-visible:[anchor-name:--hover] aria-[current=page]:[anchor-name:--active] in-data-[state=closed]:[anchor-name:none]!";
const content = "flex min-w-0 flex-1 flex-col";
const mobileBar = "flex h-14 shrink-0 items-center border-b border-line px-3";
const iconButton =
"grid size-9 shrink-0 place-items-center rounded-md text-ink transition-colors duration-150 ease-out hover:bg-subtle focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary motion-reduce:transition-none";
const dialogClass =
"right-auto left-0 m-0 h-dvh max-h-dvh w-72 flex-col border-r border-line bg-surface p-0 text-sm text-ink shadow-overlay transition-transform duration-200 ease-out backdrop:bg-ink/40 open:flex starting:open:-translate-x-full motion-reduce:transition-none **:focus-visible:outline-2 **:focus-visible:outline-offset-2 **:focus-visible:outline-primary motion-reduce:**:transition-none";
defineOptions({ inheritAttrs: false });
const props = withDefaults(
defineProps<{
sections?: SidebarSection[];
variant?: keyof typeof variants;
/** Lebar kontainer minimum agar sidebar tampil di samping konten: sm 24rem, md 42rem, lg 56rem. */
breakpoint?: keyof typeof showAside;
id?: string;
navLabel?: string;
collapseLabel?: string;
expandLabel?: string;
openLabel?: string;
closeLabel?: string;
}>(),
{
sections: () => [],
variant: "default",
breakpoint: "md",
id: undefined,
navLabel: "Sidebar",
collapseLabel: "Collapse sidebar",
expandLabel: "Expand sidebar",
openLabel: "Open sidebar",
closeLabel: "Close sidebar",
},
);
/** Mode rail ikon. Tanpa v-model state-nya lokal dengan nilai awal dari prop collapsed. */
const collapsed = defineModel<boolean>("collapsed", { default: false });
/** Href berskema selain http, https, mailto, dan tel (misalnya javascript:) diganti "#". Spasi dan karakter kontrol diabaikan seperti di browser. */
const safeHref = (href: string) =>
/^(?!https?:|mailto:|tel:)[a-z][\w+.-]*:/i.test(href.replace(/[\0- ]/g, ""))
? "#"
: href;
const linkProps = (entry: SidebarItem) =>
entry.disabled
? { role: "link", "aria-disabled": "true" }
: {
href: safeHref(entry.href ?? "#"),
"aria-current": entry.active ? "page" : undefined,
};
/** Ikon garis 24px dari satu path SVG. */
const Icon = (props: { d: string }) =>
h(
"svg",
{
viewBox: "0 0 24 24",
fill: "none",
stroke: "currentColor",
"stroke-width": "1.5",
"stroke-linecap": "round",
"stroke-linejoin": "round",
"aria-hidden": "true",
},
h("path", { d: props.d }),
);
const generatedId = useId();
const rootId = computed(() => props.id ?? generatedId);
const dialog = ref<HTMLDialogElement>();
const attrs = useAttrs();
const slots = useSlots();
const groups = ref<Record<string, boolean>>(
Object.fromEntries(
props.sections.flatMap((section, s) =>
section.items.map((entry, i) => [
`${s}-${i}`,
entry.open ?? !!entry.children?.some((child) => child.active),
]),
),
),
);
/** Di rail, tombol induk membentangkan sidebar dan membuka grupnya. */
function toggleGroup(key: string, rail: boolean) {
if (rail) collapsed.value = false;
groups.value = { ...groups.value, [key]: rail || !groups.value[key] };
}
function onDialogClick(event: MouseEvent) {
const target = event.target as Element;
if (target === dialog.value || target.closest("a[href]"))
dialog.value?.close();
}
/** Nav yang sama dipakai di sidebar desktop (prefix d) dan dialog seluler (prefix m). */
const nav = (prefix: string, rail: boolean) =>
h(
"nav",
{ "aria-label": props.navLabel, class: navClass },
h("div", { class: listWrap }, [
h("span", { "aria-hidden": "true", class: indicator }),
...props.sections.map((section, s) =>
h("div", { class: sectionClass }, [
section.title &&
h("p", { "aria-hidden": "true", class: titleClass }, section.title),
h(
"ul",
{ "aria-label": section.title, class: listClass },
section.items.map((entry, i) => {
const key = `${s}-${i}`;
const regionId = `${prefix}-g${key}`;
const badge = entry.badge != null && entry.badge !== "";
const body = [
entry.icon && h(Icon, { d: entry.icon, class: iconClass }),
h("span", { class: labelClass }, entry.label),
badge && h("span", { class: badgeClass }, entry.badge),
badge && h("span", { "aria-hidden": "true", class: dot }),
!!entry.children?.length &&
h(Icon, { d: "m9 6 6 6-6 6", class: chevron }),
h("span", { "aria-hidden": "true", class: tip }, entry.label),
];
if (!entry.children?.length)
return h(
"li",
h("a", { ...linkProps(entry), class: item }, body),
);
return h("li", [
h(
"button",
{
type: "button",
"aria-expanded": !!groups.value[key],
"aria-controls": regionId,
class: item,
onClick: () => toggleGroup(key, rail),
},
body,
),
h(
"div",
{
id: regionId,
"data-state": groups.value[key] ? "open" : "closed",
class: region,
},
h(
"div",
{ class: regionInner },
h(
"ul",
{ class: subList },
entry.children.map((child) =>
h(
"li",
h(
"a",
{ ...linkProps(child), class: subItem },
child.label,
),
),
),
),
),
),
]);
}),
),
]),
),
]),
);
/** Header atau footer dari slot, dipotong di tepi konten (lihat slotClass). */
const slotBox = (className: string, name: "header" | "footer") =>
slots[name] &&
h("div", { class: className }, h("div", { class: slotClass }, slots[name]()));
/**
* Seluruh markup dirender dengan h(), bukan template, agar bundel tetap di bawah 3 KB gzip.
* Atribut user (class, data-*, aria-*) jatuh ke elemen root.
*/
const Root = () => {
const id = rootId.value;
return h("div", { ...attrs, id, class: [root, attrs.class] }, [
h(
"aside",
{
id: `${id}-aside`,
"data-state": collapsed.value ? "collapsed" : "expanded",
class: [aside, variants[props.variant], showAside[props.breakpoint]],
},
[
slotBox(headerClass, "header"),
nav(`${id}-d`, collapsed.value),
slotBox(footerClass, "footer"),
h(
"button",
{
type: "button",
"aria-label": collapsed.value
? props.expandLabel
: props.collapseLabel,
"aria-expanded": !collapsed.value,
"aria-controls": `${id}-aside`,
class: collapseButton,
onClick: () => (collapsed.value = !collapsed.value),
},
h(Icon, { d: "m15 6-6 6 6 6", class: collapseIcon }),
),
],
),
h(
"dialog",
{
id: `${id}-dialog`,
ref: dialog,
"aria-label": props.navLabel,
class: dialogClass,
onClick: onDialogClick,
},
[
h("div", { class: headerClass }, [
h("div", { class: slotClass }, slots.header?.()),
h(
"form",
{ method: "dialog" },
h(
"button",
{
type: "submit",
"aria-label": props.closeLabel,
class: iconButton,
},
h(Icon, { d: "M18 6 6 18M6 6l12 12", class: iconClass }),
),
),
]),
nav(`${id}-m`, false),
slotBox(footerClass, "footer"),
],
),
h("div", { class: content }, [
h(
"div",
{ class: [mobileBar, hideBar[props.breakpoint]] },
h(
"button",
{
type: "button",
"aria-label": props.openLabel,
"aria-haspopup": "dialog",
"aria-controls": `${id}-dialog`,
class: iconButton,
onClick: () => dialog.value?.showModal(),
},
h(Icon, { d: "M4 6h16M4 12h16M4 18h16", class: iconClass }),
),
),
slots.default?.(),
]),
]);
};
</script>
<template>
<Root />
</template>- Pastikan Tailwind CSS v4 dan markas.css sudah terpasang. Lihat Instalasi.
- Salin source komponen di bawah ini ke
src/lib/components/markas/Sidebar.svelte.
<script lang="ts" module>
export type SidebarItem = {
label: string;
/** Link target. Ignored when the item has children. */
href?: string;
/** SVG path data (d attribute) for a 24x24 stroke icon. */
icon?: string;
badge?: string | number;
/** Marks the current page. */
active?: boolean;
disabled?: boolean;
/** Sub-items. The parent item becomes an open/close button. */
children?: SidebarItem[];
/** Sub-items start open. Default: open when a sub-item is active. */
open?: boolean;
};
export type SidebarSection = { title?: string; items: SidebarItem[] };
</script>
<script lang="ts">
import type { Snippet } from "svelte";
import type { HTMLAttributes } from "svelte/elements";
const root = "@container flex overflow-hidden bg-canvas";
const aside =
"relative hidden w-56 shrink-0 flex-col bg-surface text-sm transition-[width] duration-200 ease-out data-[state=collapsed]:w-16 motion-reduce:transition-none **:focus-visible:outline-2 **:focus-visible:outline-offset-2 **:focus-visible:outline-primary motion-reduce:**:transition-none";
const variants = {
default: "border-r border-line",
floating: "m-2 rounded-xl border border-line",
};
const showAside = { sm: "@sm:flex", md: "@2xl:flex", lg: "@4xl:flex" };
const hideBar = { sm: "@sm:hidden", md: "@2xl:hidden", lg: "@4xl:hidden" };
const headerClass =
"flex h-14 shrink-0 items-center border-b border-line px-4";
/** Header and footer content is clipped at the content edge so the rail shows only the first 32px. */
const slotClass =
"flex min-w-0 flex-1 items-center gap-2 overflow-hidden whitespace-nowrap";
const footerClass = "shrink-0 border-t border-line px-4 py-3";
const collapseButton =
"absolute top-4 -right-3 z-10 grid size-6 place-items-center rounded-full border border-line bg-surface text-muted transition-colors duration-150 ease-out hover:text-ink";
const collapseIcon =
"size-3.5 transition-transform duration-200 ease-out in-data-[state=collapsed]:rotate-180";
const navClass =
"min-h-0 flex-1 overflow-y-auto p-3 in-data-[state=collapsed]:overflow-visible";
const listWrap = "relative grid gap-3 [anchor-scope:--active,--hover]";
const indicator =
"absolute inset-[anchor(--hover_top,anchor(--active_top))_anchor(--hover_right,anchor(--active_right))_anchor(--hover_bottom,anchor(--active_bottom))_anchor(--hover_left,anchor(--active_left))] rounded-md bg-subtle transition-[inset] duration-200 ease-out";
const sectionClass =
"grid gap-0.5 border-t border-line pt-3 first-of-type:border-t-0 first-of-type:pt-0";
const titleClass =
"px-2.5 pb-1 text-xs font-medium text-faint in-data-[state=collapsed]:sr-only";
const listClass = "grid gap-0.5";
const item =
"group/item relative flex h-9 w-full items-center gap-3 rounded-md px-2.5 text-left text-muted transition-colors duration-150 ease-out hover:text-ink aria-disabled:pointer-events-none aria-disabled:opacity-50 aria-[current=page]:font-medium aria-[current=page]:text-ink hover:[anchor-name:--hover] focus-visible:[anchor-name:--hover] aria-[current=page]:[anchor-name:--active] [&:has(+div_[aria-current=page])]:[anchor-name:--active]";
const iconClass = "size-5 shrink-0";
const labelClass =
"min-w-0 flex-1 truncate in-data-[state=collapsed]:sr-only";
const badgeClass =
"rounded-full bg-primary-soft px-1.5 py-0.5 text-xs leading-none font-medium text-primary in-data-[state=collapsed]:sr-only";
const dot =
"absolute top-1.5 right-1.5 hidden size-2 rounded-full bg-primary in-data-[state=collapsed]:block";
const chevron =
"size-4 shrink-0 text-faint transition-transform duration-200 ease-out group-aria-expanded/item:rotate-90 in-data-[state=collapsed]:hidden";
const tip =
"absolute top-1/2 left-full ml-3 hidden -translate-y-1/2 rounded-md bg-ink px-2 py-1 text-xs whitespace-nowrap text-canvas shadow-overlay in-data-[state=collapsed]:group-hover/item:block in-data-[state=collapsed]:group-focus-visible/item:block";
const region =
"invisible grid grid-rows-[0fr] transition-[grid-template-rows,visibility] duration-200 ease-out data-[state=open]:visible data-[state=open]:grid-rows-[1fr] in-data-[state=collapsed]:hidden";
const regionInner = "min-h-0 overflow-hidden";
const subList = "ml-5 grid gap-0.5 border-l border-line py-1 pr-1 pl-2";
const subItem =
"relative flex h-8 w-full items-center rounded-md px-2.5 text-muted transition-colors duration-150 ease-out hover:text-ink aria-disabled:pointer-events-none aria-disabled:opacity-50 aria-[current=page]:font-medium aria-[current=page]:text-ink hover:[anchor-name:--hover] focus-visible:[anchor-name:--hover] aria-[current=page]:[anchor-name:--active] in-data-[state=closed]:[anchor-name:none]!";
const content = "flex min-w-0 flex-1 flex-col";
const mobileBar = "flex h-14 shrink-0 items-center border-b border-line px-3";
const iconButton =
"grid size-9 shrink-0 place-items-center rounded-md text-ink transition-colors duration-150 ease-out hover:bg-subtle focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary motion-reduce:transition-none";
const dialogClass =
"right-auto left-0 m-0 h-dvh max-h-dvh w-72 flex-col border-r border-line bg-surface p-0 text-sm text-ink shadow-overlay transition-transform duration-200 ease-out backdrop:bg-ink/40 open:flex starting:open:-translate-x-full motion-reduce:transition-none **:focus-visible:outline-2 **:focus-visible:outline-offset-2 **:focus-visible:outline-primary motion-reduce:**:transition-none";
/** Hrefs with a scheme other than http, https, mailto, and tel (javascript: for example) become "#". Whitespace and control characters are ignored as in browsers. */
const safeHref = (href: string) =>
/^(?!https?:|mailto:|tel:)[a-z][\w+.-]*:/i.test(href.replace(/[\0- ]/g, ""))
? "#"
: href;
const linkProps = (entry: SidebarItem) =>
entry.disabled
? { role: "link", "aria-disabled": "true" as const }
: {
href: safeHref(entry.href ?? "#"),
"aria-current": entry.active ? ("page" as const) : undefined,
};
type Props = Omit<HTMLAttributes<HTMLDivElement>, "children"> & {
sections?: SidebarSection[];
/** Brand or workspace at the top. Rendered twice: in the sidebar and in the mobile dialog. */
header?: Snippet;
/** User profile at the bottom. Rendered twice like header. */
footer?: Snippet;
children?: Snippet;
variant?: keyof typeof variants;
/** Minimum container width for the sidebar to sit next to the content: sm 24rem, md 42rem, lg 56rem. */
breakpoint?: keyof typeof showAside;
/** Icon rail mode. Works with bind:collapsed. */
collapsed?: boolean;
navLabel?: string;
collapseLabel?: string;
expandLabel?: string;
openLabel?: string;
closeLabel?: string;
};
let {
sections = [],
header,
footer,
children,
variant = "default",
breakpoint = "md",
collapsed = $bindable(false),
navLabel = "Sidebar",
collapseLabel = "Collapse sidebar",
expandLabel = "Expand sidebar",
openLabel = "Open sidebar",
closeLabel = "Close sidebar",
id,
class: className,
...rest
}: Props = $props();
const generatedId = $props.id();
const rootId = $derived(id ?? generatedId);
let dialog = $state<HTMLDialogElement>();
/** Sub-item groups start open when open is set or a sub-item is active. */
const initialGroups = () =>
Object.fromEntries(
sections.flatMap((section, s) =>
section.items.map((entry, i) => [
`${s}-${i}`,
entry.open ?? !!entry.children?.some((child) => child.active),
]),
),
) as Record<string, boolean>;
let groups = $state(initialGroups());
/** In the rail, a parent item expands the sidebar and opens its group. */
function toggleGroup(key: string, rail: boolean) {
if (rail) collapsed = false;
groups = { ...groups, [key]: rail || !groups[key] };
}
function onDialogClick(
event: MouseEvent & { currentTarget: HTMLDialogElement },
) {
const target = event.target as Element;
if (target === event.currentTarget || target.closest("a[href]"))
event.currentTarget.close();
}
</script>
{#snippet icon(d: string, iconClassName: string)}
<svg
class={iconClassName}
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
stroke-width="1.5"
stroke-linecap="round"
stroke-linejoin="round"
aria-hidden="true"
>
<path {d} />
</svg>
{/snippet}
<!-- Header or footer box, clipped at the content edge (see slotClass). -->
{#snippet box(boxClass: string, content: Snippet | undefined)}
<div class={boxClass}>
<div class={slotClass}>{@render content?.()}</div>
</div>
{/snippet}
<!-- The same nav serves the desktop sidebar (prefix d) and the mobile dialog (prefix m). -->
{#snippet nav(prefix: string, rail: boolean)}
<nav aria-label={navLabel} class={navClass}>
<div class={listWrap}>
<span aria-hidden="true" class={indicator}></span>
{#each sections as section, s}
<div class={sectionClass}>
{#if section.title}
<p aria-hidden="true" class={titleClass}>{section.title}</p>
{/if}
<ul aria-label={section.title} class={listClass}>
{#each section.items as entry, i}
{@const key = `${s}-${i}`}
{@const regionId = `${rootId}-${prefix}-g${key}`}
<li>
<svelte:element
this={entry.children?.length ? "button" : "a"}
{...entry.children?.length
? {
type: "button",
"aria-expanded": !!groups[key],
"aria-controls": regionId,
onclick: () => toggleGroup(key, rail),
}
: linkProps(entry)}
class={item}
>
{#if entry.icon}{@render icon(entry.icon, iconClass)}{/if}
<span class={labelClass}>{entry.label}</span>
{#if entry.badge != null && entry.badge !== ""}
<span class={badgeClass}>{entry.badge}</span>
<span aria-hidden="true" class={dot}></span>
{/if}
{#if entry.children?.length}
{@render icon("m9 6 6 6-6 6", chevron)}
{/if}
<span aria-hidden="true" class={tip}>{entry.label}</span>
</svelte:element>
{#if entry.children?.length}
<div
id={regionId}
data-state={groups[key] ? "open" : "closed"}
class={region}
>
<div class={regionInner}>
<ul class={subList}>
{#each entry.children as child}
<li>
<a {...linkProps(child)} class={subItem}
>{child.label}</a
>
</li>
{/each}
</ul>
</div>
</div>
{/if}
</li>
{/each}
</ul>
</div>
{/each}
</div>
</nav>
{/snippet}
<div id={rootId} class={[root, className]} {...rest}>
<aside
id={`${rootId}-aside`}
data-state={collapsed ? "collapsed" : "expanded"}
class={[aside, variants[variant], showAside[breakpoint]]}
>
{#if header}{@render box(headerClass, header)}{/if}
{@render nav("d", collapsed)}
{#if footer}{@render box(footerClass, footer)}{/if}
<button
type="button"
aria-label={collapsed ? expandLabel : collapseLabel}
aria-expanded={!collapsed}
aria-controls={`${rootId}-aside`}
class={collapseButton}
onclick={() => (collapsed = !collapsed)}
>
{@render icon("m15 6-6 6 6 6", collapseIcon)}
</button>
</aside>
<dialog
bind:this={dialog}
id={`${rootId}-dialog`}
aria-label={navLabel}
class={dialogClass}
onclick={onDialogClick}
>
<div class={headerClass}>
<div class={slotClass}>{@render header?.()}</div>
<form method="dialog">
<button type="submit" aria-label={closeLabel} class={iconButton}>
{@render icon("M18 6 6 18M6 6l12 12", iconClass)}
</button>
</form>
</div>
{@render nav("m", false)}
{#if footer}{@render box(footerClass, footer)}{/if}
</dialog>
<div class={content}>
<div class={[mobileBar, hideBar[breakpoint]]}>
<button
type="button"
aria-label={openLabel}
aria-haspopup="dialog"
aria-controls={`${rootId}-dialog`}
class={iconButton}
onclick={() => dialog?.showModal()}
>
{@render icon("M4 6h16M4 12h16M4 18h16", iconClass)}
</button>
</div>
{@render children?.()}
</div>
</div>- Pastikan Tailwind CSS v4 dan markas.css sudah terpasang. Lihat Instalasi.
- Salin source komponen di bawah ini ke
src/components/markas/Sidebar.astro.
---
import type { HTMLAttributes } from "astro/types";
export type SidebarItem = {
label: string;
/** Link target. Ignored when the item has children. */
href?: string;
/** SVG path data (d attribute) for a 24x24 stroke icon. */
icon?: string;
badge?: string | number;
/** Marks the current page. */
active?: boolean;
disabled?: boolean;
/** Sub-items. The parent item becomes an open/close button. */
children?: SidebarItem[];
/** Sub-items start open. Default: open when a sub-item is active. */
open?: boolean;
};
export type SidebarSection = { title?: string; items: SidebarItem[] };
const root = "@container flex overflow-hidden bg-canvas";
const aside =
"relative hidden w-56 shrink-0 flex-col bg-surface text-sm transition-[width] duration-200 ease-out data-[state=collapsed]:w-16 motion-reduce:transition-none **:focus-visible:outline-2 **:focus-visible:outline-offset-2 **:focus-visible:outline-primary motion-reduce:**:transition-none";
const variants = {
default: "border-r border-line",
floating: "m-2 rounded-xl border border-line",
};
const showAside = { sm: "@sm:flex", md: "@2xl:flex", lg: "@4xl:flex" };
const hideBar = { sm: "@sm:hidden", md: "@2xl:hidden", lg: "@4xl:hidden" };
const headerClass = "flex h-14 shrink-0 items-center border-b border-line px-4";
/** Header and footer content is clipped at the content edge so the rail shows only the first 32px. */
const slotClass =
"flex min-w-0 flex-1 items-center gap-2 overflow-hidden whitespace-nowrap";
const footerClass = "shrink-0 border-t border-line px-4 py-3";
const collapseButton =
"absolute top-4 -right-3 z-10 grid size-6 place-items-center rounded-full border border-line bg-surface text-muted transition-colors duration-150 ease-out hover:text-ink";
const collapseIcon =
"size-3.5 transition-transform duration-200 ease-out in-data-[state=collapsed]:rotate-180";
const navClass =
"min-h-0 flex-1 overflow-y-auto p-3 in-data-[state=collapsed]:overflow-visible";
const listWrap = "relative grid gap-3 [anchor-scope:--active,--hover]";
const indicator =
"absolute inset-[anchor(--hover_top,anchor(--active_top))_anchor(--hover_right,anchor(--active_right))_anchor(--hover_bottom,anchor(--active_bottom))_anchor(--hover_left,anchor(--active_left))] rounded-md bg-subtle transition-[inset] duration-200 ease-out";
const sectionClass =
"grid gap-0.5 border-t border-line pt-3 first-of-type:border-t-0 first-of-type:pt-0";
const titleClass =
"px-2.5 pb-1 text-xs font-medium text-faint in-data-[state=collapsed]:sr-only";
const listClass = "grid gap-0.5";
const item =
"group/item relative flex h-9 w-full items-center gap-3 rounded-md px-2.5 text-left text-muted transition-colors duration-150 ease-out hover:text-ink aria-disabled:pointer-events-none aria-disabled:opacity-50 aria-[current=page]:font-medium aria-[current=page]:text-ink hover:[anchor-name:--hover] focus-visible:[anchor-name:--hover] aria-[current=page]:[anchor-name:--active] [&:has(+div_[aria-current=page])]:[anchor-name:--active]";
const iconClass = "size-5 shrink-0";
const labelClass = "min-w-0 flex-1 truncate in-data-[state=collapsed]:sr-only";
const badgeClass =
"rounded-full bg-primary-soft px-1.5 py-0.5 text-xs leading-none font-medium text-primary in-data-[state=collapsed]:sr-only";
const dot =
"absolute top-1.5 right-1.5 hidden size-2 rounded-full bg-primary in-data-[state=collapsed]:block";
const chevron =
"size-4 shrink-0 text-faint transition-transform duration-200 ease-out group-aria-expanded/item:rotate-90 in-data-[state=collapsed]:hidden";
const tip =
"absolute top-1/2 left-full ml-3 hidden -translate-y-1/2 rounded-md bg-ink px-2 py-1 text-xs whitespace-nowrap text-canvas shadow-overlay in-data-[state=collapsed]:group-hover/item:block in-data-[state=collapsed]:group-focus-visible/item:block";
const region =
"invisible grid grid-rows-[0fr] transition-[grid-template-rows,visibility] duration-200 ease-out data-[state=open]:visible data-[state=open]:grid-rows-[1fr] in-data-[state=collapsed]:hidden";
const regionInner = "min-h-0 overflow-hidden";
const subList = "ml-5 grid gap-0.5 border-l border-line py-1 pr-1 pl-2";
const subItem =
"relative flex h-8 w-full items-center rounded-md px-2.5 text-muted transition-colors duration-150 ease-out hover:text-ink aria-disabled:pointer-events-none aria-disabled:opacity-50 aria-[current=page]:font-medium aria-[current=page]:text-ink hover:[anchor-name:--hover] focus-visible:[anchor-name:--hover] aria-[current=page]:[anchor-name:--active] in-data-[state=closed]:[anchor-name:none]!";
const content = "flex min-w-0 flex-1 flex-col";
const mobileBar = "flex h-14 shrink-0 items-center border-b border-line px-3";
const iconButton =
"grid size-9 shrink-0 place-items-center rounded-md text-ink transition-colors duration-150 ease-out hover:bg-subtle focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary motion-reduce:transition-none";
const dialogClass =
"right-auto left-0 m-0 h-dvh max-h-dvh w-72 flex-col border-r border-line bg-surface p-0 text-sm text-ink shadow-overlay transition-transform duration-200 ease-out backdrop:bg-ink/40 open:flex starting:open:-translate-x-full motion-reduce:transition-none **:focus-visible:outline-2 **:focus-visible:outline-offset-2 **:focus-visible:outline-primary motion-reduce:**:transition-none";
/** Hrefs with a scheme other than http, https, mailto, and tel (javascript: for example) become "#". Whitespace and control characters are ignored as in browsers. */
const safeHref = (href: string) =>
/^(?!https?:|mailto:|tel:)[a-z][\w+.-]*:/i.test(href.replace(/[\0- ]/g, ""))
? "#"
: href;
const linkProps = (entry: SidebarItem) =>
entry.disabled
? { role: "link" as const, "aria-disabled": "true" as const }
: {
href: safeHref(entry.href ?? "#"),
"aria-current": entry.active ? ("page" as const) : undefined,
};
/**
* Header and footer render twice. Ids in the dialog copy get an m- prefix so components inside
* (dropdown, command) stay unique and ids they derive at runtime (`${id}-trigger`) still match.
*/
const mobileCopy = (html: string) =>
html.replace(
/(?<=\s)(id|for|popovertarget|aria-(?:controls|labelledby|describedby|owns))="([^"]*)"/g,
(_, name: string, refs: string) =>
`${name}="${refs
.trim()
.split(/\s+/)
.map((ref) => `m-${ref}`)
.join(" ")}"`,
);
type Props = HTMLAttributes<"div"> & {
sections?: SidebarSection[];
variant?: keyof typeof variants;
/** Minimum container width for the sidebar to sit next to the content: sm 24rem, md 42rem, lg 56rem. */
breakpoint?: keyof typeof showAside;
/** Initial icon rail mode. Changes dispatch markas-collapsed-change. */
collapsed?: boolean;
navLabel?: string;
collapseLabel?: string;
expandLabel?: string;
openLabel?: string;
closeLabel?: string;
};
const {
sections = [],
variant = "default",
breakpoint = "md",
collapsed = false,
navLabel = "Sidebar",
collapseLabel = "Collapse sidebar",
expandLabel = "Expand sidebar",
openLabel = "Open sidebar",
closeLabel = "Close sidebar",
id,
class: className,
...rest
} = Astro.props;
const rootId = id ?? `markas-sidebar-${crypto.randomUUID().slice(0, 8)}`;
const header = Astro.slots.has("header")
? await Astro.slots.render("header")
: undefined;
const footer = Astro.slots.has("footer")
? await Astro.slots.render("footer")
: undefined;
const hasBadge = (entry: SidebarItem) =>
entry.badge != null && entry.badge !== "";
/** Sub-item groups start open when open is set or a sub-item is active. */
const isOpen = (entry: SidebarItem) =>
entry.open ?? !!entry.children?.some((child) => child.active);
const svg = {
viewBox: "0 0 24 24",
fill: "none",
stroke: "currentColor",
"stroke-width": "1.5",
"stroke-linecap": "round",
"stroke-linejoin": "round",
"aria-hidden": "true",
} as const;
/** The desktop sidebar (copy d) and the mobile dialog (copy m) share the same markup. */
const copies = [
{
prefix: "d",
Tag: "aside",
attrs: {
id: `${rootId}-aside`,
"data-state": collapsed ? "collapsed" : "expanded",
class: [aside, variants[variant], showAside[breakpoint]].join(" "),
},
header,
footer,
},
{
prefix: "m",
Tag: "dialog",
attrs: {
id: `${rootId}-dialog`,
"aria-label": navLabel,
"data-markas-sidebar-dialog": true,
class: dialogClass,
},
header: mobileCopy(header ?? ""),
footer: footer && mobileCopy(footer),
},
] as const;
---
<div id={rootId} data-markas-sidebar class:list={[root, className]} {...rest}>
{
copies.map(({ prefix, Tag, attrs, header: top, footer: bottom }) => (
<Tag {...attrs}>
{prefix === "d" ? (
top && (
<div class={headerClass}>
<div class={slotClass}>
<Fragment set:html={top} />
</div>
</div>
)
) : (
<div class={headerClass}>
<div class={slotClass}>
<Fragment set:html={top} />
</div>
<form method="dialog">
<button type="submit" aria-label={closeLabel} class={iconButton}>
<svg class={iconClass} {...svg}>
<path d="M18 6 6 18M6 6l12 12" />
</svg>
</button>
</form>
</div>
)}
<nav aria-label={navLabel} class={navClass}>
<div class={listWrap}>
<span aria-hidden="true" class={indicator} />
{sections.map((section, s) => (
<div class={sectionClass}>
{section.title && (
<p aria-hidden="true" class={titleClass}>
{section.title}
</p>
)}
<ul aria-label={section.title} class={listClass}>
{section.items.map((entry, i) => {
const key = `${s}-${i}`;
const regionId = `${rootId}-${prefix}-g${key}`;
const body = (
<Fragment>
{entry.icon && (
<svg class={iconClass} {...svg}>
<path d={entry.icon} />
</svg>
)}
<span class={labelClass}>{entry.label}</span>
{hasBadge(entry) && (
<span class={badgeClass}>{entry.badge}</span>
)}
{hasBadge(entry) && (
<span aria-hidden="true" class={dot} />
)}
{!!entry.children?.length && (
<svg class={chevron} {...svg}>
<path d="m9 6 6 6-6 6" />
</svg>
)}
<span aria-hidden="true" class={tip}>
{entry.label}
</span>
</Fragment>
);
return (
<li>
{entry.children?.length ? (
<Fragment>
<button
type="button"
aria-expanded={isOpen(entry) ? "true" : "false"}
aria-controls={regionId}
data-markas-sidebar-group={key}
class={item}
>
{body}
</button>
<div
id={regionId}
data-state={isOpen(entry) ? "open" : "closed"}
class={region}
>
<div class={regionInner}>
<ul class={subList}>
{entry.children.map((child) => (
<li>
<a {...linkProps(child)} class={subItem}>
{child.label}
</a>
</li>
))}
</ul>
</div>
</div>
</Fragment>
) : (
<a {...linkProps(entry)} class={item}>
{body}
</a>
)}
</li>
);
})}
</ul>
</div>
))}
</div>
</nav>
{bottom && (
<div class={footerClass}>
<div class={slotClass}>
<Fragment set:html={bottom} />
</div>
</div>
)}
{prefix === "d" && (
<button
type="button"
aria-label={collapsed ? expandLabel : collapseLabel}
aria-expanded={collapsed ? "false" : "true"}
aria-controls={`${rootId}-aside`}
data-markas-sidebar-toggle
data-collapse-label={collapseLabel}
data-expand-label={expandLabel}
class={collapseButton}
>
<svg class={collapseIcon} {...svg}>
<path d="m15 6-6 6 6 6" />
</svg>
</button>
)}
</Tag>
))
}
<div class={content}>
<div class:list={[mobileBar, hideBar[breakpoint]]}>
<button
type="button"
aria-label={openLabel}
aria-haspopup="dialog"
aria-controls={`${rootId}-dialog`}
data-markas-sidebar-open
class={iconButton}
>
<svg class={iconClass} {...svg}>
<path d="M4 6h16M4 12h16M4 18h16" />
</svg>
</button>
</div>
<slot />
</div>
</div>
<script>
// One listener per page serves every sidebar, including markup added later and pages
// reached through view transitions.
document.addEventListener("click", (event) => {
const target = event.target as Element;
const dialog = target.closest<HTMLDialogElement>(
"[data-markas-sidebar-dialog]",
);
if (dialog && (target === dialog || target.closest("a[href]"))) {
dialog.close();
return;
}
const button = target.closest<HTMLElement>(
"[data-markas-sidebar-toggle],[data-markas-sidebar-group],[data-markas-sidebar-open]",
);
const root = button?.closest<HTMLElement>("[data-markas-sidebar]");
if (!button || !root) return;
const byId = (id: string | null) => document.getElementById(id ?? "");
const controlled = byId(button.getAttribute("aria-controls"));
if (button.hasAttribute("data-markas-sidebar-open")) {
(controlled as HTMLDialogElement).showModal();
return;
}
const aside = byId(`${root.id}-aside`)!;
const setCollapsed = (value: boolean) => {
const toggle = aside.querySelector<HTMLElement>(
":scope > [data-markas-sidebar-toggle]",
)!;
aside.dataset.state = value ? "collapsed" : "expanded";
toggle.ariaExpanded = String(!value);
toggle.ariaLabel = value
? toggle.dataset.expandLabel!
: toggle.dataset.collapseLabel!;
root.dispatchEvent(
new CustomEvent("markas-collapsed-change", {
detail: value,
bubbles: true,
}),
);
};
if (button.hasAttribute("data-markas-sidebar-toggle")) {
setCollapsed(aside.dataset.state !== "collapsed");
return;
}
// In the rail, a parent item expands the sidebar and opens its group. Both copies stay in sync.
const rail = button.closest("aside")?.dataset.state === "collapsed";
if (rail) setCollapsed(false);
const open = rail || button.ariaExpanded !== "true";
root
.querySelectorAll<HTMLElement>(
`[data-markas-sidebar-group="${button.dataset.markasSidebarGroup}"]`,
)
.forEach((group) => {
group.ariaExpanded = String(open);
byId(group.getAttribute("aria-controls"))!.dataset.state = open
? "open"
: "closed";
});
});
</script>- Pastikan Tailwind CSS v4 dan markas.css sudah terpasang. Lihat Instalasi.
- Salin source komponen di bawah ini ke
src/app/markas/sidebar.component.ts.
import { NgTemplateOutlet } from "@angular/common";
import {
booleanAttribute,
ChangeDetectionStrategy,
Component,
computed,
contentChild,
type ElementRef,
input,
linkedSignal,
output,
TemplateRef,
viewChild,
} from "@angular/core";
export type SidebarItem = {
label: string;
/** Link target. Ignored when the item has children. */
href?: string;
/** SVG path data (d attribute) for a 24x24 stroke icon. */
icon?: string;
badge?: string | number;
/** Marks the current page. */
active?: boolean;
disabled?: boolean;
/** Sub-items. The parent item becomes an open/close button. */
children?: SidebarItem[];
/** Sub-items start open. Default: open when a sub-item is active. */
open?: boolean;
};
export type SidebarSection = { title?: string; items: SidebarItem[] };
const root = "@container flex overflow-hidden bg-canvas";
const aside =
"relative hidden w-56 shrink-0 flex-col bg-surface text-sm transition-[width] duration-200 ease-out data-[state=collapsed]:w-16 motion-reduce:transition-none **:focus-visible:outline-2 **:focus-visible:outline-offset-2 **:focus-visible:outline-primary motion-reduce:**:transition-none";
const variants = {
default: "border-r border-line",
floating: "m-2 rounded-xl border border-line",
};
const showAside = { sm: "@sm:flex", md: "@2xl:flex", lg: "@4xl:flex" };
const hideBar = { sm: "@sm:hidden", md: "@2xl:hidden", lg: "@4xl:hidden" };
const headerClass = "flex h-14 shrink-0 items-center border-b border-line px-4";
/** Header and footer content is clipped at the content edge so the rail shows only the first 32px. */
const slotClass =
"flex min-w-0 flex-1 items-center gap-2 overflow-hidden whitespace-nowrap";
const footerClass = "shrink-0 border-t border-line px-4 py-3";
const collapseButton =
"absolute top-4 -right-3 z-10 grid size-6 place-items-center rounded-full border border-line bg-surface text-muted transition-colors duration-150 ease-out hover:text-ink";
const collapseIcon =
"size-3.5 transition-transform duration-200 ease-out in-data-[state=collapsed]:rotate-180";
const navClass =
"min-h-0 flex-1 overflow-y-auto p-3 in-data-[state=collapsed]:overflow-visible";
const listWrap = "relative grid gap-3 [anchor-scope:--active,--hover]";
const indicator =
"absolute inset-[anchor(--hover_top,anchor(--active_top))_anchor(--hover_right,anchor(--active_right))_anchor(--hover_bottom,anchor(--active_bottom))_anchor(--hover_left,anchor(--active_left))] rounded-md bg-subtle transition-[inset] duration-200 ease-out";
const sectionClass =
"grid gap-0.5 border-t border-line pt-3 first-of-type:border-t-0 first-of-type:pt-0";
const titleClass =
"px-2.5 pb-1 text-xs font-medium text-faint in-data-[state=collapsed]:sr-only";
const listClass = "grid gap-0.5";
const item =
"group/item relative flex h-9 w-full items-center gap-3 rounded-md px-2.5 text-left text-muted transition-colors duration-150 ease-out hover:text-ink aria-disabled:pointer-events-none aria-disabled:opacity-50 aria-[current=page]:font-medium aria-[current=page]:text-ink hover:[anchor-name:--hover] focus-visible:[anchor-name:--hover] aria-[current=page]:[anchor-name:--active] [&:has(+div_[aria-current=page])]:[anchor-name:--active]";
const iconClass = "size-5 shrink-0";
const labelClass = "min-w-0 flex-1 truncate in-data-[state=collapsed]:sr-only";
const badgeClass =
"rounded-full bg-primary-soft px-1.5 py-0.5 text-xs leading-none font-medium text-primary in-data-[state=collapsed]:sr-only";
const dot =
"absolute top-1.5 right-1.5 hidden size-2 rounded-full bg-primary in-data-[state=collapsed]:block";
const chevron =
"size-4 shrink-0 text-faint transition-transform duration-200 ease-out group-aria-expanded/item:rotate-90 in-data-[state=collapsed]:hidden";
const tip =
"absolute top-1/2 left-full ml-3 hidden -translate-y-1/2 rounded-md bg-ink px-2 py-1 text-xs whitespace-nowrap text-canvas shadow-overlay in-data-[state=collapsed]:group-hover/item:block in-data-[state=collapsed]:group-focus-visible/item:block";
const region =
"invisible grid grid-rows-[0fr] transition-[grid-template-rows,visibility] duration-200 ease-out data-[state=open]:visible data-[state=open]:grid-rows-[1fr] in-data-[state=collapsed]:hidden";
const regionInner = "min-h-0 overflow-hidden";
const subList = "ml-5 grid gap-0.5 border-l border-line py-1 pr-1 pl-2";
const subItem =
"relative flex h-8 w-full items-center rounded-md px-2.5 text-muted transition-colors duration-150 ease-out hover:text-ink aria-disabled:pointer-events-none aria-disabled:opacity-50 aria-[current=page]:font-medium aria-[current=page]:text-ink hover:[anchor-name:--hover] focus-visible:[anchor-name:--hover] aria-[current=page]:[anchor-name:--active] in-data-[state=closed]:[anchor-name:none]!";
const content = "flex min-w-0 flex-1 flex-col";
const mobileBar = "flex h-14 shrink-0 items-center border-b border-line px-3";
const iconButton =
"grid size-9 shrink-0 place-items-center rounded-md text-ink transition-colors duration-150 ease-out hover:bg-subtle focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary motion-reduce:transition-none";
const dialogClass =
"right-auto left-0 m-0 h-dvh max-h-dvh w-72 flex-col border-r border-line bg-surface p-0 text-sm text-ink shadow-overlay transition-transform duration-200 ease-out backdrop:bg-ink/40 open:flex starting:open:-translate-x-full motion-reduce:transition-none **:focus-visible:outline-2 **:focus-visible:outline-offset-2 **:focus-visible:outline-primary motion-reduce:**:transition-none";
/** Hrefs with a scheme other than http, https, mailto, and tel (javascript: for example) become "#". Whitespace and control characters are ignored as in browsers. */
const safeHref = (href: string) =>
/^(?!https?:|mailto:|tel:)[a-z][\w+.-]*:/i.test(href.replace(/[\0- ]/g, ""))
? "#"
: href;
/** Static stroke icon markup, inlined into the template at compile time (ngc only evaluates plain constants). */
const chevronIcon = `<svg class="${chevron}" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="m9 6 6 6-6 6" /></svg>`;
const collapseSvg = `<svg class="${collapseIcon}" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="m15 6-6 6 6 6" /></svg>`;
const closeSvg = `<svg class="${iconClass}" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M18 6 6 18M6 6l12 12" /></svg>`;
const menuSvg = `<svg class="${iconClass}" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M4 6h16M4 12h16M4 18h16" /></svg>`;
/** Item content shared by links and group buttons (expects `entry` in scope). */
const body = `
@if (entry.icon) {
<svg class="${iconClass}" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path [attr.d]="entry.icon" /></svg>
}
<span class="${labelClass}">{{ entry.label }}</span>
@if (entry.badge != null && entry.badge !== "") {
<span class="${badgeClass}">{{ entry.badge }}</span>
<span aria-hidden="true" class="${dot}"></span>
}
@if (entry.children?.length) {
${chevronIcon}
}
<span aria-hidden="true" class="${tip}">{{ entry.label }}</span>
`;
let nextId = 0;
/**
* Header and footer are templates (`<ng-template #header>`, `<ng-template #footer>`) because they
* render twice: in the sidebar and in the mobile dialog. Everything else is the page content.
* Host stays out of layout; id and class move to the root element.
*/
@Component({
selector: "markas-sidebar",
changeDetection: ChangeDetectionStrategy.OnPush,
imports: [NgTemplateOutlet],
host: { class: "contents", "[attr.id]": "null" },
template: `
<!-- The same nav serves the desktop sidebar (prefix d) and the mobile dialog (prefix m). -->
<ng-template #nav let-prefix let-rail="rail">
<nav [attr.aria-label]="navLabel()" class="${navClass}">
<div class="${listWrap}">
<span aria-hidden="true" class="${indicator}"></span>
@for (section of sections(); track $index; let s = $index) {
<div class="${sectionClass}">
@if (section.title) {
<p aria-hidden="true" class="${titleClass}">
{{ section.title }}
</p>
}
<ul
[attr.aria-label]="section.title || null"
class="${listClass}"
>
@for (entry of section.items; track $index; let i = $index) {
<li>
@if (entry.children?.length) {
<button
type="button"
[attr.aria-expanded]="!!groups()[s + '-' + i]"
[attr.aria-controls]="
rootId() + '-' + prefix + '-g' + s + '-' + i
"
class="${item}"
(click)="toggleGroup(s + '-' + i, rail)"
>
${body}
</button>
<div
[id]="rootId() + '-' + prefix + '-g' + s + '-' + i"
[attr.data-state]="
groups()[s + '-' + i] ? 'open' : 'closed'
"
class="${region}"
>
<div class="${regionInner}">
<ul class="${subList}">
@for (child of entry.children; track $index) {
<li>
<a
[attr.href]="
child.disabled
? null
: safeHref(child.href ?? '#')
"
[attr.aria-current]="
!child.disabled && child.active
? 'page'
: null
"
[attr.role]="child.disabled ? 'link' : null"
[attr.aria-disabled]="
child.disabled ? 'true' : null
"
class="${subItem}"
>{{ child.label }}</a
>
</li>
}
</ul>
</div>
</div>
} @else {
<a
[attr.href]="
entry.disabled ? null : safeHref(entry.href ?? '#')
"
[attr.aria-current]="
!entry.disabled && entry.active ? 'page' : null
"
[attr.role]="entry.disabled ? 'link' : null"
[attr.aria-disabled]="entry.disabled ? 'true' : null"
class="${item}"
>
${body}
</a>
}
</li>
}
</ul>
</div>
}
</div>
</nav>
</ng-template>
<div [id]="rootId()" [class]="rootClasses()">
<aside
[id]="rootId() + '-aside'"
[attr.data-state]="isCollapsed() ? 'collapsed' : 'expanded'"
[class]="asideClasses()"
>
@if (header(); as headerTpl) {
<div class="${headerClass}">
<div class="${slotClass}">
<ng-container *ngTemplateOutlet="headerTpl" />
</div>
</div>
}
<ng-container
*ngTemplateOutlet="
nav;
context: { $implicit: 'd', rail: isCollapsed() }
"
/>
@if (footer(); as footerTpl) {
<div class="${footerClass}">
<div class="${slotClass}">
<ng-container *ngTemplateOutlet="footerTpl" />
</div>
</div>
}
<button
type="button"
[attr.aria-label]="isCollapsed() ? expandLabel() : collapseLabel()"
[attr.aria-expanded]="!isCollapsed()"
[attr.aria-controls]="rootId() + '-aside'"
class="${collapseButton}"
(click)="setCollapsed(!isCollapsed())"
>
${collapseSvg}
</button>
</aside>
<dialog
#dialog
[id]="rootId() + '-dialog'"
[attr.aria-label]="navLabel()"
class="${dialogClass}"
(click)="onDialogClick($event)"
>
<div class="${headerClass}">
<div class="${slotClass}">
@if (header(); as headerTpl) {
<ng-container *ngTemplateOutlet="headerTpl" />
}
</div>
<form method="dialog">
<button
type="submit"
[attr.aria-label]="closeLabel()"
class="${iconButton}"
>
${closeSvg}
</button>
</form>
</div>
<ng-container
*ngTemplateOutlet="nav; context: { $implicit: 'm', rail: false }"
/>
@if (footer(); as footerTpl) {
<div class="${footerClass}">
<div class="${slotClass}">
<ng-container *ngTemplateOutlet="footerTpl" />
</div>
</div>
}
</dialog>
<div class="${content}">
<div [class]="mobileBarClasses()">
<button
type="button"
[attr.aria-label]="openLabel()"
aria-haspopup="dialog"
[attr.aria-controls]="rootId() + '-dialog'"
class="${iconButton}"
(click)="dialogRef().nativeElement.showModal()"
>
${menuSvg}
</button>
</div>
<ng-content />
</div>
</div>
`,
})
export class Sidebar {
readonly sections = input<SidebarSection[]>([]);
readonly variant = input<keyof typeof variants>("default");
/** Minimum container width for the sidebar to sit next to the content: sm 24rem, md 42rem, lg 56rem. */
readonly breakpoint = input<keyof typeof showAside>("md");
/** Icon rail mode. Works with [(collapsed)]; a plain value sets the initial state. */
readonly collapsed = input(false, { transform: booleanAttribute });
readonly navLabel = input("Sidebar");
readonly collapseLabel = input("Collapse sidebar");
readonly expandLabel = input("Expand sidebar");
readonly openLabel = input("Open sidebar");
readonly closeLabel = input("Close sidebar");
readonly id = input<string>();
readonly userClass = input("", { alias: "class" });
readonly collapsedChange = output<boolean>();
protected readonly header = contentChild("header", { read: TemplateRef });
protected readonly footer = contentChild("footer", { read: TemplateRef });
protected readonly dialogRef =
viewChild.required<ElementRef<HTMLDialogElement>>("dialog");
protected readonly safeHref = safeHref;
private readonly generatedId = `markas-sidebar-${nextId++}`;
protected readonly rootId = computed(() => this.id() ?? this.generatedId);
protected readonly isCollapsed = linkedSignal(() => this.collapsed());
/** Sub-item groups start open when open is set or a sub-item is active. */
protected readonly groups = linkedSignal<Record<string, boolean>>(() =>
Object.fromEntries(
this.sections().flatMap((section, s) =>
section.items.map((entry, i) => [
`${s}-${i}`,
entry.open ?? !!entry.children?.some((child) => child.active),
]),
),
),
);
protected readonly rootClasses = computed(() =>
[root, this.userClass()].filter(Boolean).join(" "),
);
protected readonly asideClasses = computed(
() =>
`${aside} ${variants[this.variant()]} ${showAside[this.breakpoint()]}`,
);
protected readonly mobileBarClasses = computed(
() => `${mobileBar} ${hideBar[this.breakpoint()]}`,
);
protected setCollapsed(next: boolean) {
this.isCollapsed.set(next);
this.collapsedChange.emit(next);
}
/** In the rail, a parent item expands the sidebar and opens its group. */
protected toggleGroup(key: string, rail: boolean) {
if (rail) this.setCollapsed(false);
this.groups.update((current) => ({
...current,
[key]: rail || !current[key],
}));
}
protected onDialogClick(event: MouseEvent) {
const target = event.target as Element;
const dialog = event.currentTarget as HTMLDialogElement;
if (target === dialog || target.closest("a[href]")) dialog.close();
}
}Pemakaian
<x-markas.sidebar
nav-label="Navigasi samping"
collapse-label="Ciutkan sidebar"
expand-label="Bentangkan sidebar"
open-label="Buka sidebar"
close-label="Tutup sidebar"
:sections="[
['items' => [
['label' => 'Beranda', 'href' => '/', 'icon' => 'M3 10.5 12 3l9 7.5V20a1 1 0 0 1-1 1h-5v-6h-6v6H4a1 1 0 0 1-1-1z'],
['label' => 'Kotak masuk', 'href' => '/inbox', 'icon' => 'M3 13h5l1.5 3h5l1.5-3h5M5 5h14l2 8v6a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1v-6z', 'badge' => 12],
]],
['title' => 'Workspace', 'items' => [
['label' => 'Proyek', 'icon' => 'M3 7a2 2 0 0 1 2-2h4l2 2h8a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z', 'children' => [
['label' => 'Desain ulang situs', 'href' => '/proyek/situs', 'active' => true],
['label' => 'Aplikasi seluler', 'href' => '/proyek/seluler'],
]],
]],
]"
class="h-dvh"
>
<x-slot:header>MarkasUI</x-slot:header>
<x-slot:footer>Rina Saputra</x-slot:footer>
<main class="flex-1 p-6">...</main>
</x-markas.sidebar>Butuh Alpine.js. Dengarkan perubahan rail lewat x-on:markas-collapsed-change="tersimpan = $event.
import { Sidebar } from "@/components/markas/Sidebar";
const sections = [
{
items: [
{
label: "Beranda",
href: "/",
icon: "M3 10.5 12 3l9 7.5V20a1 1 0 0 1-1 1h-5v-6h-6v6H4a1 1 0 0 1-1-1z",
},
{
label: "Kotak masuk",
href: "/inbox",
icon: "M3 13h5l1.5 3h5l1.5-3h5M5 5h14l2 8v6a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1v-6z",
badge: 12,
},
],
},
{
title: "Workspace",
items: [
{
label: "Proyek",
icon: "M3 7a2 2 0 0 1 2-2h4l2 2h8a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",
children: [
{ label: "Desain ulang situs", href: "/proyek/situs", active: true },
{ label: "Aplikasi seluler", href: "/proyek/seluler" },
],
},
],
},
];
const [collapsed, setCollapsed] = useState(false);
<Sidebar
sections={sections}
header="MarkasUI"
footer="Rina Saputra"
collapsed={collapsed}
onCollapsedChange={setCollapsed}
navLabel="Navigasi samping"
collapseLabel="Ciutkan sidebar"
expandLabel="Bentangkan sidebar"
openLabel="Buka sidebar"
closeLabel="Tutup sidebar"
className="h-dvh"
>
<main className="flex-1 p-6">...</main>
</Sidebar>;<script setup lang="ts">
import { ref } from "vue";
import Sidebar from "@/components/markas/Sidebar.vue";
const collapsed = ref(false);
// sections: bentuknya sama dengan contoh React
</script>
<template>
<Sidebar
v-model:collapsed="collapsed"
:sections="sections"
nav-label="Navigasi samping"
collapse-label="Ciutkan sidebar"
expand-label="Bentangkan sidebar"
open-label="Buka sidebar"
close-label="Tutup sidebar"
class="h-dvh"
>
<template #header>MarkasUI</template>
<template #footer>Rina Saputra</template>
<main class="flex-1 p-6">...</main>
</Sidebar>
</template><script lang="ts">
import Sidebar from "$lib/components/markas/Sidebar.svelte";
let collapsed = $state(false);
// sections: bentuknya sama dengan contoh React
</script>
<Sidebar bind:collapsed {sections} class="h-dvh">
{#snippet header()}MarkasUI{/snippet}
{#snippet footer()}Rina Saputra{/snippet}
<main class="flex-1 p-6">...</main>
</Sidebar>---
import Sidebar from "@/components/markas/Sidebar.astro";
// sections: bentuknya sama dengan contoh React
---
<Sidebar sections={sections} class="h-dvh">
<Fragment slot="header">MarkasUI</Fragment>
<Fragment slot="footer">Rina Saputra</Fragment>
<main class="flex-1 p-6">...</main>
</Sidebar>Satu script kecil yang dibundel menangani tombol rail, grup sub-item, dan dialog seluler untuk semua sidebar di halaman. Dengarkan perubahan rail dengan addEventListener("markas-collapsed-change", (e) => e.
import { Component, signal } from "@angular/core";
import { Sidebar } from "./markas/sidebar.component";
@Component({
selector: "app-shell",
imports: [Sidebar],
template: `
<markas-sidebar
[(collapsed)]="collapsed"
[sections]="sections"
class="h-dvh"
>
<ng-template #header>MarkasUI</ng-template>
<ng-template #footer>Rina Saputra</ng-template>
<main class="flex-1 p-6">...</main>
</markas-sidebar>
`,
})
export class AppShell {
readonly collapsed = signal(false);
// sections: bentuknya sama dengan contoh React
}header dan footer berupa ng-template karena dirender dua kali: di sidebar dan di dialog seluler.
- Komponen ini adalah kerangka aplikasi utuh: taruh isi halaman di dalamnya. Lebarnya menentukan tata letak lewat container query. Mulai
breakpoint(defaultmd, 42rem) sidebar tampil di samping konten; di bawahnya tombol menu membuka link yang sama di<dialog>native yang meluncur dari kiri. - Tombol bulat di tepi sidebar mengubahnya jadi rail ikon selebar 64px. Label lalu tampil sebagai tooltip dan badge sebagai titik. Secara default state-nya tidak terkontrol. Mulai dalam mode rail dengan
defaultCollapseddi React,:collapsed="true"tanpav-modeldi Vue dan Blade, atau nilaicollapsedbiasa di Svelte, Astro, dan Angular. - Di mode rail, item induk membentangkan sidebar dan membuka sub-itemnya.
- Sorotan meluncur ke item yang di-hover atau difokus lalu kembali ke item aktif. Sorotan memakai CSS anchor positioning tanpa JavaScript; browser yang belum mendukungnya tetap menandai item aktif dengan teks tebal. Grup sub-item yang memuat halaman aktif terbuka di awal; isi
openuntuk mengubahnya. headerdanfooterdirender dua kali: di sidebar dan di dialog seluler. Pemilih workspace (DropdownMenu) atau pemicu pencarian (Command) berfungsi di kedua salinan; di Blade, id di salinan dialog diberi akhiran-magar tetap unik (Astro: awalanm-).- Sembunyikan bagian header atau footer di mode rail dengan
in-data-[state=collapsed]:hidden, misalnya kartu upgrade. - Label bawaan berbahasa Inggris: “Sidebar”, “Collapse sidebar”, “Expand sidebar”, “Open sidebar”, dan “Close sidebar”. Terjemahkan lewat
navLabel,collapseLabel,expandLabel,openLabel, dancloseLabel(Blade:nav-label,collapse-label, dan seterusnya), seperti contoh di atas.
Props
| Nama | Tipe | Default | Keterangan |
|---|---|---|---|
sections | { title?, items: { label, href?, icon?, badge?, active?, disabled?, open?, children? }[] }[] | [] | Grup link. icon berisi path SVG (d) untuk ikon garis 24px. Item dengan children menjadi tombol buka/tutup. |
header | slot / ReactNode / snippet | - | Brand atau workspace di atas. Di mode rail hanya 32px pertama yang terlihat. Angular: <ng-template #header>, karena dirender di sidebar dan dialog seluler. |
footer | slot / ReactNode / snippet | - | Profil pengguna di bawah. Angular: <ng-template #footer>. |
children | slot / ReactNode / snippet | - | Isi halaman yang tampil di samping sidebar. |
variant | "default" | "floating" | default | default menempel dengan border kanan, floating berupa panel membulat yang mengambang. |
breakpoint | "sm" | "md" | "lg" | md | Lebar kontainer mulai sidebar tampil di samping konten: 24rem, 42rem, atau 56rem. Di bawahnya tombol membuka sidebar sebagai dialog. |
collapsed | boolean | - | Mode rail ikon. React: terkontrol bersama onCollapsedChange. Vue: v-model:collapsed, atau nilai biasa untuk keadaan awal tidak terkontrol. Svelte: bind:collapsed atau nilai awal biasa. Angular: [(collapsed)] atau nilai awal biasa. Blade dan Astro: keadaan awal, perubahan mengirim event markas-collapsed-change. |
defaultCollapsed | boolean | false | Mode rail awal saat tidak terkontrol (hanya React). |
collapsedChange | output<boolean> | - | Khusus Angular. Dipancarkan dengan keadaan rail baru saat berubah. |
navLabel | string | Sidebar | Label aksesibel nav dan dialog seluler. Isi "Sidebar" atau "Navigasi samping" untuk situs berbahasa Indonesia. |
collapseLabel | string | Collapse sidebar | Label aksesibel tombol rail saat sidebar terbentang. Isi "Ciutkan sidebar". |
expandLabel | string | Expand sidebar | Label aksesibel tombol rail saat sidebar diciutkan. Isi "Bentangkan sidebar". |
openLabel | string | Open sidebar | Label aksesibel tombol yang membuka dialog seluler. Isi "Buka sidebar". |
closeLabel | string | Close sidebar | Label aksesibel tombol tutup di dialog seluler. Isi "Tutup sidebar". |
Aksesibilitas
- Link berada di nav berlabel navLabel, halaman saat ini diberi aria-current=page, dan setiap grup berjudul adalah list berlabel judulnya.
- Item dengan sub-item adalah tombol disclosure dengan aria-expanded dan aria-controls, sub-item yang tertutup tidak bisa difokus.
- Tombol rail memakai aria-expanded dan aria-controls yang menunjuk ke sidebar. Di mode rail label tetap terbaca pembaca layar dan tampil sebagai tooltip saat hover dan fokus.
- Di tata letak sempit sidebar terbuka di dialog modal native: Escape atau backdrop menutupnya dan fokus kembali ke tombol pembuka.
- Item nonaktif adalah link tanpa href dengan aria-disabled=true.
Komponen terkait
Komponen navigasi lain dengan class yang sama di setiap framework.
- AccordionDaftar bagian yang bisa dibuka dan ditutup, dibangun dari details dan summary native tanpa JavaScript.
- BreadcrumbJejak lokasi halaman dalam hierarki situs, dengan halaman saat ini ditandai aria-current.
- CollapsibleSatu bagian yang bisa dibuka dan ditutup memakai details dan summary native tanpa JavaScript. Cocok untuk konten tampilkan lebih banyak.
- FooterFooter situs dengan enam tata letak: kolom link, tengah berpendar, kartu newsletter pil, wordmark raksasa terpotong, ajakan gelap berpendar, dan pil mengambang.
- MenubarBar horizontal berisi beberapa menu seperti aplikasi desktop, berbasis Popover API, dengan keyboard sesuai pola WAI-ARIA Menubar.
- NavbarHeader situs dengan brand, link, menu dropdown, pill hover yang meluncur, area aksi, dan menu seluler dengan grup yang bisa dibuka.