Header situs dengan brand, link, menu dropdown, pill hover yang meluncur, area aksi, dan menu seluler dengan grup yang bisa dibuka.
@php
$logo = [
['fill' => 'fill-ink/15', 'points' => '354,578 1256,138 1171,430 268,868'],
['fill' => 'fill-ink/55', 'points' => '553,443 1455,3 1370,295 467,733'],
['fill' => 'fill-success/35', 'points' => '421,762 1325,318 1240,611 336,1050'],
['fill' => 'fill-ink/30', 'points' => '265,1073 1169,629 1084,922 180,1362'],
['fill' => 'fill-ink/80', 'points' => '93,965 997,521 912,814 8,1253'],
['fill' => 'fill-success', 'points' => '347,1135 1251,691 1166,984 262,1424'],
];
$links = [
['label' => 'Docs', 'href' => '/docs', 'active' => true],
[
'label' => 'Components',
'children' => [
[
'label' => 'Forms',
'href' => '/components/forms',
'description' => 'Input, select, checkbox, and more',
'icon' => 'M3 7h18v10H3zM7 12h.01M11 12h6',
],
[
'label' => 'Overlays',
'href' => '/components/overlays',
'description' => 'Modal, drawer, popover, toast',
'icon' => 'M8 8h12v12H8zM4 16V4h12',
],
[
'label' => 'Navigation',
'href' => '/components/navigation',
'description' => 'Navbar, sidebar, tabs, menus',
'icon' => 'M12 21a9 9 0 1 0 0-18 9 9 0 0 0 0 18zm4-13-2 6-6 2 2-6z',
],
[
'label' => 'Data display',
'href' => '/components/data',
'description' => 'Table, card, badge, avatar',
'icon' => 'M3 3v18h18M7 15l4-4 3 3 5-6',
],
[
'label' => 'Feedback',
'href' => '/components/feedback',
'description' => 'Alert, progress, skeleton',
'icon' => 'M12 9v4m0 4h.01M10.3 3.9 1.8 18a2 2 0 0 0 1.7 3h17a2 2 0 0 0 1.7-3L13.7 3.9a2 2 0 0 0-3.4 0z',
],
[
'label' => 'Effects',
'href' => '/components/effects',
'description' => 'Aurora, beams, and grid patterns',
'icon' => 'M12 3v4M12 17v4M3 12h4M17 12h4M6 6l2.5 2.5M15.5 15.5 18 18M6 18l2.5-2.5M15.5 8.5 18 6',
],
],
],
[
'label' => 'Resources',
'children' => [
[
'label' => 'Templates',
'href' => '/templates',
'description' => 'Full pages built from components',
'icon' => 'M3 4h18v6H3zM3 14h8v6H3zm12 0h6v6h-6z',
],
[
'label' => 'Changelog',
'href' => '/changelog',
'description' => 'What shipped this week',
'icon' => 'M12 7v5l3 2M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0z',
],
[
'label' => 'Community',
'href' => '/community',
'description' => 'Ask and share on GitHub',
'icon' => 'M17 20v-2a4 4 0 0 0-4-4H7a4 4 0 0 0-4 4v2M10 10a4 4 0 1 0 0-8 4 4 0 0 0 0 8zm11 10v-2a4 4 0 0 0-3-3.9M16 2.1a4 4 0 0 1 0 7.8',
],
],
],
['label' => 'Pricing', 'href' => '/pricing'],
];
$brand = 'flex items-center gap-2 rounded-md';
$logoClass = 'size-6';
$github = 'inline-flex size-9 items-center justify-center rounded-md text-muted transition-colors duration-150 ease-out hover:bg-subtle hover:text-ink';
$icon = 'size-5';
@endphp
<x-markas.navbar :links="$links">
<x-slot:brand>
<a href="/" class="{{ $brand }}">
<svg class="{{ $logoClass }}" viewBox="0 0 1464 1430" aria-hidden="true">
@foreach ($logo as $shape)
<polygon class="{{ $shape['fill'] }}" points="{{ $shape['points'] }}" />
@endforeach
</svg>
<span>MarkasUI</span>
</a>
</x-slot:brand>
<x-slot:actions>
<a href="https://github.com" aria-label="GitHub" class="{{ $github }}">
<svg class="{{ $icon }}" 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 22v-4a4.8 4.8 0 0 0-1-3.5c3 0 6-2 6-5.5.1-1.3-.3-2.5-1-3.5.3-1.2.3-2.4 0-3.5 0 0-1 0-3 1.5a13.4 13.4 0 0 0-8 0C6 2 5 2 5 2c-.3 1.2-.3 2.4 0 3.5A5.4 5.4 0 0 0 4 9c0 3.5 3 5.5 6 5.5-.4.5-.7 1-.9 1.7-.2.6-.2 1.2-.1 1.8v4M9 18c-4.5 2-5-2-7-2" /></svg>
</a>
<x-markas.button size="sm">Get started</x-markas.button>
</x-slot:actions>
</x-markas.navbar>import { Button } from "@/components/markas/Button";
import { Navbar } from "@/components/markas/Navbar";
const logo = [
{ fill: "fill-ink/15", points: "354,578 1256,138 1171,430 268,868" },
{ fill: "fill-ink/55", points: "553,443 1455,3 1370,295 467,733" },
{ fill: "fill-success/35", points: "421,762 1325,318 1240,611 336,1050" },
{ fill: "fill-ink/30", points: "265,1073 1169,629 1084,922 180,1362" },
{ fill: "fill-ink/80", points: "93,965 997,521 912,814 8,1253" },
{ fill: "fill-success", points: "347,1135 1251,691 1166,984 262,1424" },
];
const links = [
{ label: "Docs", href: "/docs", active: true },
{
label: "Components",
children: [
{
label: "Forms",
href: "/components/forms",
description: "Input, select, checkbox, and more",
icon: "M3 7h18v10H3zM7 12h.01M11 12h6",
},
{
label: "Overlays",
href: "/components/overlays",
description: "Modal, drawer, popover, toast",
icon: "M8 8h12v12H8zM4 16V4h12",
},
{
label: "Navigation",
href: "/components/navigation",
description: "Navbar, sidebar, tabs, menus",
icon: "M12 21a9 9 0 1 0 0-18 9 9 0 0 0 0 18zm4-13-2 6-6 2 2-6z",
},
{
label: "Data display",
href: "/components/data",
description: "Table, card, badge, avatar",
icon: "M3 3v18h18M7 15l4-4 3 3 5-6",
},
{
label: "Feedback",
href: "/components/feedback",
description: "Alert, progress, skeleton",
icon: "M12 9v4m0 4h.01M10.3 3.9 1.8 18a2 2 0 0 0 1.7 3h17a2 2 0 0 0 1.7-3L13.7 3.9a2 2 0 0 0-3.4 0z",
},
{
label: "Effects",
href: "/components/effects",
description: "Aurora, beams, and grid patterns",
icon: "M12 3v4M12 17v4M3 12h4M17 12h4M6 6l2.5 2.5M15.5 15.5 18 18M6 18l2.5-2.5M15.5 8.5 18 6",
},
],
},
{
label: "Resources",
children: [
{
label: "Templates",
href: "/templates",
description: "Full pages built from components",
icon: "M3 4h18v6H3zM3 14h8v6H3zm12 0h6v6h-6z",
},
{
label: "Changelog",
href: "/changelog",
description: "What shipped this week",
icon: "M12 7v5l3 2M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0z",
},
{
label: "Community",
href: "/community",
description: "Ask and share on GitHub",
icon: "M17 20v-2a4 4 0 0 0-4-4H7a4 4 0 0 0-4 4v2M10 10a4 4 0 1 0 0-8 4 4 0 0 0 0 8zm11 10v-2a4 4 0 0 0-3-3.9M16 2.1a4 4 0 0 1 0 7.8",
},
],
},
{ label: "Pricing", href: "/pricing" },
];
const brand = "flex items-center gap-2 rounded-md";
const logoClass = "size-6";
const github =
"inline-flex size-9 items-center justify-center rounded-md text-muted transition-colors duration-150 ease-out hover:bg-subtle hover:text-ink";
const icon = "size-5";
export default function NavbarExample() {
return (
<Navbar
links={links}
brand={
<a href="/" className={brand}>
<svg className={logoClass} viewBox="0 0 1464 1430" aria-hidden="true">
{logo.map((shape) => (
<polygon
key={shape.points}
className={shape.fill}
points={shape.points}
/>
))}
</svg>
<span>MarkasUI</span>
</a>
}
actions={
<>
<a href="https://github.com" aria-label="GitHub" className={github}>
<svg
className={icon}
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
strokeWidth="1.5"
strokeLinecap="round"
strokeLinejoin="round"
aria-hidden="true"
>
<path d="M15 22v-4a4.8 4.8 0 0 0-1-3.5c3 0 6-2 6-5.5.1-1.3-.3-2.5-1-3.5.3-1.2.3-2.4 0-3.5 0 0-1 0-3 1.5a13.4 13.4 0 0 0-8 0C6 2 5 2 5 2c-.3 1.2-.3 2.4 0 3.5A5.4 5.4 0 0 0 4 9c0 3.5 3 5.5 6 5.5-.4.5-.7 1-.9 1.7-.2.6-.2 1.2-.1 1.8v4M9 18c-4.5 2-5-2-7-2" />
</svg>
</a>
<Button size="sm">Get started</Button>
</>
}
/>
);
}<script setup lang="ts">
import Button from "@/components/markas/Button.vue";
import Navbar from "@/components/markas/Navbar.vue";
const logo = [
{ fill: "fill-ink/15", points: "354,578 1256,138 1171,430 268,868" },
{ fill: "fill-ink/55", points: "553,443 1455,3 1370,295 467,733" },
{ fill: "fill-success/35", points: "421,762 1325,318 1240,611 336,1050" },
{ fill: "fill-ink/30", points: "265,1073 1169,629 1084,922 180,1362" },
{ fill: "fill-ink/80", points: "93,965 997,521 912,814 8,1253" },
{ fill: "fill-success", points: "347,1135 1251,691 1166,984 262,1424" },
];
const links = [
{ label: "Docs", href: "/docs", active: true },
{
label: "Components",
children: [
{
label: "Forms",
href: "/components/forms",
description: "Input, select, checkbox, and more",
icon: "M3 7h18v10H3zM7 12h.01M11 12h6",
},
{
label: "Overlays",
href: "/components/overlays",
description: "Modal, drawer, popover, toast",
icon: "M8 8h12v12H8zM4 16V4h12",
},
{
label: "Navigation",
href: "/components/navigation",
description: "Navbar, sidebar, tabs, menus",
icon: "M12 21a9 9 0 1 0 0-18 9 9 0 0 0 0 18zm4-13-2 6-6 2 2-6z",
},
{
label: "Data display",
href: "/components/data",
description: "Table, card, badge, avatar",
icon: "M3 3v18h18M7 15l4-4 3 3 5-6",
},
{
label: "Feedback",
href: "/components/feedback",
description: "Alert, progress, skeleton",
icon: "M12 9v4m0 4h.01M10.3 3.9 1.8 18a2 2 0 0 0 1.7 3h17a2 2 0 0 0 1.7-3L13.7 3.9a2 2 0 0 0-3.4 0z",
},
{
label: "Effects",
href: "/components/effects",
description: "Aurora, beams, and grid patterns",
icon: "M12 3v4M12 17v4M3 12h4M17 12h4M6 6l2.5 2.5M15.5 15.5 18 18M6 18l2.5-2.5M15.5 8.5 18 6",
},
],
},
{
label: "Resources",
children: [
{
label: "Templates",
href: "/templates",
description: "Full pages built from components",
icon: "M3 4h18v6H3zM3 14h8v6H3zm12 0h6v6h-6z",
},
{
label: "Changelog",
href: "/changelog",
description: "What shipped this week",
icon: "M12 7v5l3 2M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0z",
},
{
label: "Community",
href: "/community",
description: "Ask and share on GitHub",
icon: "M17 20v-2a4 4 0 0 0-4-4H7a4 4 0 0 0-4 4v2M10 10a4 4 0 1 0 0-8 4 4 0 0 0 0 8zm11 10v-2a4 4 0 0 0-3-3.9M16 2.1a4 4 0 0 1 0 7.8",
},
],
},
{ label: "Pricing", href: "/pricing" },
];
const brand = "flex items-center gap-2 rounded-md";
const logoClass = "size-6";
const github =
"inline-flex size-9 items-center justify-center rounded-md text-muted transition-colors duration-150 ease-out hover:bg-subtle hover:text-ink";
const icon = "size-5";
</script>
<template>
<Navbar :links="links">
<template #brand>
<a href="/" :class="brand">
<svg :class="logoClass" viewBox="0 0 1464 1430" aria-hidden="true">
<polygon
v-for="shape in logo"
:key="shape.points"
:class="shape.fill"
:points="shape.points"
/>
</svg>
<span>MarkasUI</span>
</a>
</template>
<template #actions>
<a href="https://github.com" aria-label="GitHub" :class="github">
<svg
:class="icon"
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 22v-4a4.8 4.8 0 0 0-1-3.5c3 0 6-2 6-5.5.1-1.3-.3-2.5-1-3.5.3-1.2.3-2.4 0-3.5 0 0-1 0-3 1.5a13.4 13.4 0 0 0-8 0C6 2 5 2 5 2c-.3 1.2-.3 2.4 0 3.5A5.4 5.4 0 0 0 4 9c0 3.5 3 5.5 6 5.5-.4.5-.7 1-.9 1.7-.2.6-.2 1.2-.1 1.8v4M9 18c-4.5 2-5-2-7-2"
/>
</svg>
</a>
<Button size="sm">Get started</Button>
</template>
</Navbar>
</template><script lang="ts">
import Button from "$lib/components/markas/Button.svelte";
import Navbar from "$lib/components/markas/Navbar.svelte";
const logo = [
{ fill: "fill-ink/15", points: "354,578 1256,138 1171,430 268,868" },
{ fill: "fill-ink/55", points: "553,443 1455,3 1370,295 467,733" },
{ fill: "fill-success/35", points: "421,762 1325,318 1240,611 336,1050" },
{ fill: "fill-ink/30", points: "265,1073 1169,629 1084,922 180,1362" },
{ fill: "fill-ink/80", points: "93,965 997,521 912,814 8,1253" },
{ fill: "fill-success", points: "347,1135 1251,691 1166,984 262,1424" },
];
const links = [
{ label: "Docs", href: "/docs", active: true },
{
label: "Components",
children: [
{
label: "Forms",
href: "/components/forms",
description: "Input, select, checkbox, and more",
icon: "M3 7h18v10H3zM7 12h.01M11 12h6",
},
{
label: "Overlays",
href: "/components/overlays",
description: "Modal, drawer, popover, toast",
icon: "M8 8h12v12H8zM4 16V4h12",
},
{
label: "Navigation",
href: "/components/navigation",
description: "Navbar, sidebar, tabs, menus",
icon: "M12 21a9 9 0 1 0 0-18 9 9 0 0 0 0 18zm4-13-2 6-6 2 2-6z",
},
{
label: "Data display",
href: "/components/data",
description: "Table, card, badge, avatar",
icon: "M3 3v18h18M7 15l4-4 3 3 5-6",
},
{
label: "Feedback",
href: "/components/feedback",
description: "Alert, progress, skeleton",
icon: "M12 9v4m0 4h.01M10.3 3.9 1.8 18a2 2 0 0 0 1.7 3h17a2 2 0 0 0 1.7-3L13.7 3.9a2 2 0 0 0-3.4 0z",
},
{
label: "Effects",
href: "/components/effects",
description: "Aurora, beams, and grid patterns",
icon: "M12 3v4M12 17v4M3 12h4M17 12h4M6 6l2.5 2.5M15.5 15.5 18 18M6 18l2.5-2.5M15.5 8.5 18 6",
},
],
},
{
label: "Resources",
children: [
{
label: "Templates",
href: "/templates",
description: "Full pages built from components",
icon: "M3 4h18v6H3zM3 14h8v6H3zm12 0h6v6h-6z",
},
{
label: "Changelog",
href: "/changelog",
description: "What shipped this week",
icon: "M12 7v5l3 2M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0z",
},
{
label: "Community",
href: "/community",
description: "Ask and share on GitHub",
icon: "M17 20v-2a4 4 0 0 0-4-4H7a4 4 0 0 0-4 4v2M10 10a4 4 0 1 0 0-8 4 4 0 0 0 0 8zm11 10v-2a4 4 0 0 0-3-3.9M16 2.1a4 4 0 0 1 0 7.8",
},
],
},
{ label: "Pricing", href: "/pricing" },
];
const brandClass = "flex items-center gap-2 rounded-md";
const logoClass = "size-6";
const github =
"inline-flex size-9 items-center justify-center rounded-md text-muted transition-colors duration-150 ease-out hover:bg-subtle hover:text-ink";
const icon = "size-5";
</script>
<Navbar {links}>
{#snippet brand()}
<a href="/" class={brandClass}>
<svg class={logoClass} viewBox="0 0 1464 1430" aria-hidden="true">
{#each logo as shape (shape.points)}
<polygon class={shape.fill} points={shape.points} />
{/each}
</svg>
<span>MarkasUI</span>
</a>
{/snippet}
{#snippet actions()}
<a href="https://github.com" aria-label="GitHub" class={github}>
<svg
class={icon}
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 22v-4a4.8 4.8 0 0 0-1-3.5c3 0 6-2 6-5.5.1-1.3-.3-2.5-1-3.5.3-1.2.3-2.4 0-3.5 0 0-1 0-3 1.5a13.4 13.4 0 0 0-8 0C6 2 5 2 5 2c-.3 1.2-.3 2.4 0 3.5A5.4 5.4 0 0 0 4 9c0 3.5 3 5.5 6 5.5-.4.5-.7 1-.9 1.7-.2.6-.2 1.2-.1 1.8v4M9 18c-4.5 2-5-2-7-2"
/>
</svg>
</a>
<Button size="sm">Get started</Button>
{/snippet}
</Navbar>---
import Button from "@/components/markas/Button.astro";
import Navbar from "@/components/markas/Navbar.astro";
const logo = [
{ fill: "fill-ink/15", points: "354,578 1256,138 1171,430 268,868" },
{ fill: "fill-ink/55", points: "553,443 1455,3 1370,295 467,733" },
{ fill: "fill-success/35", points: "421,762 1325,318 1240,611 336,1050" },
{ fill: "fill-ink/30", points: "265,1073 1169,629 1084,922 180,1362" },
{ fill: "fill-ink/80", points: "93,965 997,521 912,814 8,1253" },
{ fill: "fill-success", points: "347,1135 1251,691 1166,984 262,1424" },
];
const links = [
{ label: "Docs", href: "/docs", active: true },
{
label: "Components",
children: [
{
label: "Forms",
href: "/components/forms",
description: "Input, select, checkbox, and more",
icon: "M3 7h18v10H3zM7 12h.01M11 12h6",
},
{
label: "Overlays",
href: "/components/overlays",
description: "Modal, drawer, popover, toast",
icon: "M8 8h12v12H8zM4 16V4h12",
},
{
label: "Navigation",
href: "/components/navigation",
description: "Navbar, sidebar, tabs, menus",
icon: "M12 21a9 9 0 1 0 0-18 9 9 0 0 0 0 18zm4-13-2 6-6 2 2-6z",
},
{
label: "Data display",
href: "/components/data",
description: "Table, card, badge, avatar",
icon: "M3 3v18h18M7 15l4-4 3 3 5-6",
},
{
label: "Feedback",
href: "/components/feedback",
description: "Alert, progress, skeleton",
icon: "M12 9v4m0 4h.01M10.3 3.9 1.8 18a2 2 0 0 0 1.7 3h17a2 2 0 0 0 1.7-3L13.7 3.9a2 2 0 0 0-3.4 0z",
},
{
label: "Effects",
href: "/components/effects",
description: "Aurora, beams, and grid patterns",
icon: "M12 3v4M12 17v4M3 12h4M17 12h4M6 6l2.5 2.5M15.5 15.5 18 18M6 18l2.5-2.5M15.5 8.5 18 6",
},
],
},
{
label: "Resources",
children: [
{
label: "Templates",
href: "/templates",
description: "Full pages built from components",
icon: "M3 4h18v6H3zM3 14h8v6H3zm12 0h6v6h-6z",
},
{
label: "Changelog",
href: "/changelog",
description: "What shipped this week",
icon: "M12 7v5l3 2M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0z",
},
{
label: "Community",
href: "/community",
description: "Ask and share on GitHub",
icon: "M17 20v-2a4 4 0 0 0-4-4H7a4 4 0 0 0-4 4v2M10 10a4 4 0 1 0 0-8 4 4 0 0 0 0 8zm11 10v-2a4 4 0 0 0-3-3.9M16 2.1a4 4 0 0 1 0 7.8",
},
],
},
{ label: "Pricing", href: "/pricing" },
];
const brand = "flex items-center gap-2 rounded-md";
const logoClass = "size-6";
const github =
"inline-flex size-9 items-center justify-center rounded-md text-muted transition-colors duration-150 ease-out hover:bg-subtle hover:text-ink";
const icon = "size-5";
---
<Navbar links={links}>
<a slot="brand" href="/" class={brand}>
<svg class={logoClass} viewBox="0 0 1464 1430" aria-hidden="true">
{logo.map((shape) => <polygon class={shape.fill} points={shape.points} />)}
</svg>
<span>MarkasUI</span>
</a>
<Fragment slot="actions">
<a href="https://github.com" aria-label="GitHub" class={github}>
<svg
class={icon}
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 22v-4a4.8 4.8 0 0 0-1-3.5c3 0 6-2 6-5.5.1-1.3-.3-2.5-1-3.5.3-1.2.3-2.4 0-3.5 0 0-1 0-3 1.5a13.4 13.4 0 0 0-8 0C6 2 5 2 5 2c-.3 1.2-.3 2.4 0 3.5A5.4 5.4 0 0 0 4 9c0 3.5 3 5.5 6 5.5-.4.5-.7 1-.9 1.7-.2.6-.2 1.2-.1 1.8v4M9 18c-4.5 2-5-2-7-2"></path>
</svg>
</a>
<Button size="sm">Get started</Button>
</Fragment>
</Navbar>import { Component } from "@angular/core";
import { Button } from "./markas/button.component";
import {
Navbar,
type NavbarLink,
} from "./markas/navbar.component";
const logo = [
{ fill: "fill-ink/15", points: "354,578 1256,138 1171,430 268,868" },
{ fill: "fill-ink/55", points: "553,443 1455,3 1370,295 467,733" },
{ fill: "fill-success/35", points: "421,762 1325,318 1240,611 336,1050" },
{ fill: "fill-ink/30", points: "265,1073 1169,629 1084,922 180,1362" },
{ fill: "fill-ink/80", points: "93,965 997,521 912,814 8,1253" },
{ fill: "fill-success", points: "347,1135 1251,691 1166,984 262,1424" },
];
const links: NavbarLink[] = [
{ label: "Docs", href: "/docs", active: true },
{
label: "Components",
children: [
{
label: "Forms",
href: "/components/forms",
description: "Input, select, checkbox, and more",
icon: "M3 7h18v10H3zM7 12h.01M11 12h6",
},
{
label: "Overlays",
href: "/components/overlays",
description: "Modal, drawer, popover, toast",
icon: "M8 8h12v12H8zM4 16V4h12",
},
{
label: "Navigation",
href: "/components/navigation",
description: "Navbar, sidebar, tabs, menus",
icon: "M12 21a9 9 0 1 0 0-18 9 9 0 0 0 0 18zm4-13-2 6-6 2 2-6z",
},
{
label: "Data display",
href: "/components/data",
description: "Table, card, badge, avatar",
icon: "M3 3v18h18M7 15l4-4 3 3 5-6",
},
{
label: "Feedback",
href: "/components/feedback",
description: "Alert, progress, skeleton",
icon: "M12 9v4m0 4h.01M10.3 3.9 1.8 18a2 2 0 0 0 1.7 3h17a2 2 0 0 0 1.7-3L13.7 3.9a2 2 0 0 0-3.4 0z",
},
{
label: "Effects",
href: "/components/effects",
description: "Aurora, beams, and grid patterns",
icon: "M12 3v4M12 17v4M3 12h4M17 12h4M6 6l2.5 2.5M15.5 15.5 18 18M6 18l2.5-2.5M15.5 8.5 18 6",
},
],
},
{
label: "Resources",
children: [
{
label: "Templates",
href: "/templates",
description: "Full pages built from components",
icon: "M3 4h18v6H3zM3 14h8v6H3zm12 0h6v6h-6z",
},
{
label: "Changelog",
href: "/changelog",
description: "What shipped this week",
icon: "M12 7v5l3 2M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0z",
},
{
label: "Community",
href: "/community",
description: "Ask and share on GitHub",
icon: "M17 20v-2a4 4 0 0 0-4-4H7a4 4 0 0 0-4 4v2M10 10a4 4 0 1 0 0-8 4 4 0 0 0 0 8zm11 10v-2a4 4 0 0 0-3-3.9M16 2.1a4 4 0 0 1 0 7.8",
},
],
},
{ label: "Pricing", href: "/pricing" },
];
@Component({
selector: "markas-example",
imports: [Button, Navbar],
template: `
<header markas-navbar [links]="links">
<a brand href="/" [class]="brand">
<svg
[attr.class]="logoClass"
viewBox="0 0 1464 1430"
aria-hidden="true"
>
@for (shape of logo; track shape.points) {
<polygon [attr.class]="shape.fill" [attr.points]="shape.points" />
}
</svg>
<span>MarkasUI</span>
</a>
<ng-container actions>
<a href="https://github.com" aria-label="GitHub" [class]="github">
<svg
[attr.class]="icon"
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 22v-4a4.8 4.8 0 0 0-1-3.5c3 0 6-2 6-5.5.1-1.3-.3-2.5-1-3.5.3-1.2.3-2.4 0-3.5 0 0-1 0-3 1.5a13.4 13.4 0 0 0-8 0C6 2 5 2 5 2c-.3 1.2-.3 2.4 0 3.5A5.4 5.4 0 0 0 4 9c0 3.5 3 5.5 6 5.5-.4.5-.7 1-.9 1.7-.2.6-.2 1.2-.1 1.8v4M9 18c-4.5 2-5-2-7-2"
/>
</svg>
</a>
<button markas-button size="sm">Get started</button>
</ng-container>
</header>
`,
})
export default class NavbarExample {
protected readonly logo = logo;
protected readonly links = links;
protected readonly brand = "flex items-center gap-2 rounded-md";
protected readonly logoClass = "size-6";
protected readonly github =
"inline-flex size-9 items-center justify-center rounded-md text-muted transition-colors duration-150 ease-out hover:bg-subtle hover:text-ink";
protected readonly icon = "size-5";
}Contoh
Pil kaca mengambang
Copy, paste, and ship it today
A glass pill that floats over the page. The highlight slides to whatever you point at.
Copy, paste, and ship it today
A glass pill that floats over the page. The highlight slides to whatever you point at.
Copy, paste, and ship it today
A glass pill that floats over the page. The highlight slides to whatever you point at.
Copy, paste, and ship it today
A glass pill that floats over the page. The highlight slides to whatever you point at.
Copy, paste, and ship it today
A glass pill that floats over the page. The highlight slides to whatever you point at.
@php
$logo = [
['fill' => 'fill-ink/15', 'points' => '354,578 1256,138 1171,430 268,868'],
['fill' => 'fill-ink/55', 'points' => '553,443 1455,3 1370,295 467,733'],
['fill' => 'fill-success/35', 'points' => '421,762 1325,318 1240,611 336,1050'],
['fill' => 'fill-ink/30', 'points' => '265,1073 1169,629 1084,922 180,1362'],
['fill' => 'fill-ink/80', 'points' => '93,965 997,521 912,814 8,1253'],
['fill' => 'fill-success', 'points' => '347,1135 1251,691 1166,984 262,1424'],
];
$links = [
['label' => 'Docs', 'href' => '/docs'],
[
'label' => 'Components',
'children' => [
[
'label' => 'Forms',
'href' => '/components/forms',
'description' => 'Input, select, checkbox, and more',
'icon' => 'M3 7h18v10H3zM7 12h.01M11 12h6',
],
[
'label' => 'Overlays',
'href' => '/components/overlays',
'description' => 'Modal, drawer, popover, toast',
'icon' => 'M8 8h12v12H8zM4 16V4h12',
],
[
'label' => 'Effects',
'href' => '/components/effects',
'description' => 'Aurora, beams, and grid patterns',
'icon' => 'M12 3v4M12 17v4M3 12h4M17 12h4M6 6l2.5 2.5M15.5 15.5 18 18M6 18l2.5-2.5M15.5 8.5 18 6',
],
],
],
['label' => 'Templates', 'href' => '/templates', 'active' => true],
['label' => 'Pricing', 'href' => '/pricing'],
];
$stage = 'relative isolate overflow-hidden rounded-2xl border border-line bg-canvas bg-[radial-gradient(45%_70%_at_12%_0%,color-mix(in_oklab,var(--color-success)_30%,transparent),transparent),radial-gradient(40%_60%_at_90%_20%,color-mix(in_oklab,var(--color-ink)_12%,transparent),transparent)] px-3 pt-4 pb-14';
$grid = 'absolute inset-0 -z-10 bg-[linear-gradient(to_right,var(--color-line)_1px,transparent_1px),linear-gradient(to_bottom,var(--color-line)_1px,transparent_1px)] bg-size-[32px_32px] [mask-image:radial-gradient(ellipse_at_top,black,transparent_75%)]';
$pill = 'mx-auto max-w-3xl rounded-[1.75rem]! border-line/70! bg-surface/60! backdrop-blur-xl [&>div:first-child]:pr-2 [&>div:first-child]:pl-5 [&>div>nav>span]:rounded-full [&>div>nav_li>:first-child]:rounded-full';
$brand = 'flex items-center gap-2 rounded-full';
$logoClass = 'size-6';
$cta = 'rounded-full! pr-2.5!';
$arrow = 'size-4';
$hero = 'mx-auto grid max-w-md gap-3 pt-14 text-center';
$title = 'text-3xl font-semibold tracking-tight text-balance text-ink';
$lead = 'text-sm text-muted text-pretty';
@endphp
<div class="{{ $stage }}">
<div aria-hidden="true" class="{{ $grid }}"></div>
<x-markas.navbar :links="$links" variant="floating" class="{{ $pill }}">
<x-slot:brand>
<a href="/" class="{{ $brand }}">
<svg class="{{ $logoClass }}" viewBox="0 0 1464 1430" aria-hidden="true">
@foreach ($logo as $shape)
<polygon class="{{ $shape['fill'] }}" points="{{ $shape['points'] }}" />
@endforeach
</svg>
<span>MarkasUI</span>
</a>
</x-slot:brand>
<x-slot:actions>
<x-markas.button size="sm" class="{{ $cta }}">
Get started
<svg class="{{ $arrow }}" 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>
</x-markas.button>
</x-slot:actions>
</x-markas.navbar>
<div class="{{ $hero }}">
<h2 class="{{ $title }}">Copy, paste, and ship it today</h2>
<p class="{{ $lead }}">A glass pill that floats over the page. The highlight slides to whatever you point at.</p>
</div>
</div>import { Button } from "@/components/markas/Button";
import { Navbar } from "@/components/markas/Navbar";
const logo = [
{ fill: "fill-ink/15", points: "354,578 1256,138 1171,430 268,868" },
{ fill: "fill-ink/55", points: "553,443 1455,3 1370,295 467,733" },
{ fill: "fill-success/35", points: "421,762 1325,318 1240,611 336,1050" },
{ fill: "fill-ink/30", points: "265,1073 1169,629 1084,922 180,1362" },
{ fill: "fill-ink/80", points: "93,965 997,521 912,814 8,1253" },
{ fill: "fill-success", points: "347,1135 1251,691 1166,984 262,1424" },
];
const links = [
{ label: "Docs", href: "/docs" },
{
label: "Components",
children: [
{
label: "Forms",
href: "/components/forms",
description: "Input, select, checkbox, and more",
icon: "M3 7h18v10H3zM7 12h.01M11 12h6",
},
{
label: "Overlays",
href: "/components/overlays",
description: "Modal, drawer, popover, toast",
icon: "M8 8h12v12H8zM4 16V4h12",
},
{
label: "Effects",
href: "/components/effects",
description: "Aurora, beams, and grid patterns",
icon: "M12 3v4M12 17v4M3 12h4M17 12h4M6 6l2.5 2.5M15.5 15.5 18 18M6 18l2.5-2.5M15.5 8.5 18 6",
},
],
},
{ label: "Templates", href: "/templates", active: true },
{ label: "Pricing", href: "/pricing" },
];
const stage =
"relative isolate overflow-hidden rounded-2xl border border-line bg-canvas bg-[radial-gradient(45%_70%_at_12%_0%,color-mix(in_oklab,var(--color-success)_30%,transparent),transparent),radial-gradient(40%_60%_at_90%_20%,color-mix(in_oklab,var(--color-ink)_12%,transparent),transparent)] px-3 pt-4 pb-14";
const grid =
"absolute inset-0 -z-10 bg-[linear-gradient(to_right,var(--color-line)_1px,transparent_1px),linear-gradient(to_bottom,var(--color-line)_1px,transparent_1px)] bg-size-[32px_32px] [mask-image:radial-gradient(ellipse_at_top,black,transparent_75%)]";
const pill =
"mx-auto max-w-3xl rounded-[1.75rem]! border-line/70! bg-surface/60! backdrop-blur-xl [&>div:first-child]:pr-2 [&>div:first-child]:pl-5 [&>div>nav>span]:rounded-full [&>div>nav_li>:first-child]:rounded-full";
const brand = "flex items-center gap-2 rounded-full";
const logoClass = "size-6";
const cta = "rounded-full! pr-2.5!";
const arrow = "size-4";
const hero = "mx-auto grid max-w-md gap-3 pt-14 text-center";
const title = "text-3xl font-semibold tracking-tight text-balance text-ink";
const lead = "text-sm text-muted text-pretty";
export default function Example() {
return (
<div className={stage}>
<div aria-hidden="true" className={grid} />
<Navbar
links={links}
variant="floating"
className={pill}
brand={
<a href="/" className={brand}>
<svg
className={logoClass}
viewBox="0 0 1464 1430"
aria-hidden="true"
>
{logo.map((shape) => (
<polygon
key={shape.points}
className={shape.fill}
points={shape.points}
/>
))}
</svg>
<span>MarkasUI</span>
</a>
}
actions={
<Button size="sm" className={cta}>
Get started
<svg
className={arrow}
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>
</Button>
}
/>
<div className={hero}>
<h2 className={title}>Copy, paste, and ship it today</h2>
<p className={lead}>
A glass pill that floats over the page. The highlight slides to
whatever you point at.
</p>
</div>
</div>
);
}<script setup lang="ts">
import Button from "@/components/markas/Button.vue";
import Navbar from "@/components/markas/Navbar.vue";
const logo = [
{ fill: "fill-ink/15", points: "354,578 1256,138 1171,430 268,868" },
{ fill: "fill-ink/55", points: "553,443 1455,3 1370,295 467,733" },
{ fill: "fill-success/35", points: "421,762 1325,318 1240,611 336,1050" },
{ fill: "fill-ink/30", points: "265,1073 1169,629 1084,922 180,1362" },
{ fill: "fill-ink/80", points: "93,965 997,521 912,814 8,1253" },
{ fill: "fill-success", points: "347,1135 1251,691 1166,984 262,1424" },
];
const links = [
{ label: "Docs", href: "/docs" },
{
label: "Components",
children: [
{
label: "Forms",
href: "/components/forms",
description: "Input, select, checkbox, and more",
icon: "M3 7h18v10H3zM7 12h.01M11 12h6",
},
{
label: "Overlays",
href: "/components/overlays",
description: "Modal, drawer, popover, toast",
icon: "M8 8h12v12H8zM4 16V4h12",
},
{
label: "Effects",
href: "/components/effects",
description: "Aurora, beams, and grid patterns",
icon: "M12 3v4M12 17v4M3 12h4M17 12h4M6 6l2.5 2.5M15.5 15.5 18 18M6 18l2.5-2.5M15.5 8.5 18 6",
},
],
},
{ label: "Templates", href: "/templates", active: true },
{ label: "Pricing", href: "/pricing" },
];
const stage =
"relative isolate overflow-hidden rounded-2xl border border-line bg-canvas bg-[radial-gradient(45%_70%_at_12%_0%,color-mix(in_oklab,var(--color-success)_30%,transparent),transparent),radial-gradient(40%_60%_at_90%_20%,color-mix(in_oklab,var(--color-ink)_12%,transparent),transparent)] px-3 pt-4 pb-14";
const grid =
"absolute inset-0 -z-10 bg-[linear-gradient(to_right,var(--color-line)_1px,transparent_1px),linear-gradient(to_bottom,var(--color-line)_1px,transparent_1px)] bg-size-[32px_32px] [mask-image:radial-gradient(ellipse_at_top,black,transparent_75%)]";
const pill =
"mx-auto max-w-3xl rounded-[1.75rem]! border-line/70! bg-surface/60! backdrop-blur-xl [&>div:first-child]:pr-2 [&>div:first-child]:pl-5 [&>div>nav>span]:rounded-full [&>div>nav_li>:first-child]:rounded-full";
const brand = "flex items-center gap-2 rounded-full";
const logoClass = "size-6";
const cta = "rounded-full! pr-2.5!";
const arrow = "size-4";
const hero = "mx-auto grid max-w-md gap-3 pt-14 text-center";
const title = "text-3xl font-semibold tracking-tight text-balance text-ink";
const lead = "text-sm text-muted text-pretty";
</script>
<template>
<div :class="stage">
<div aria-hidden="true" :class="grid" />
<Navbar :links="links" variant="floating" :class="pill">
<template #brand>
<a href="/" :class="brand">
<svg :class="logoClass" viewBox="0 0 1464 1430" aria-hidden="true">
<polygon
v-for="shape in logo"
:key="shape.points"
:class="shape.fill"
:points="shape.points"
/>
</svg>
<span>MarkasUI</span>
</a>
</template>
<template #actions>
<Button size="sm" :class="cta">
Get started
<svg
:class="arrow"
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>
</Button>
</template>
</Navbar>
<div :class="hero">
<h2 :class="title">Copy, paste, and ship it today</h2>
<p :class="lead">
A glass pill that floats over the page. The highlight slides to whatever
you point at.
</p>
</div>
</div>
</template><script lang="ts">
import Button from "$lib/components/markas/Button.svelte";
import Navbar from "$lib/components/markas/Navbar.svelte";
const logo = [
{ fill: "fill-ink/15", points: "354,578 1256,138 1171,430 268,868" },
{ fill: "fill-ink/55", points: "553,443 1455,3 1370,295 467,733" },
{ fill: "fill-success/35", points: "421,762 1325,318 1240,611 336,1050" },
{ fill: "fill-ink/30", points: "265,1073 1169,629 1084,922 180,1362" },
{ fill: "fill-ink/80", points: "93,965 997,521 912,814 8,1253" },
{ fill: "fill-success", points: "347,1135 1251,691 1166,984 262,1424" },
];
const links = [
{ label: "Docs", href: "/docs" },
{
label: "Components",
children: [
{
label: "Forms",
href: "/components/forms",
description: "Input, select, checkbox, and more",
icon: "M3 7h18v10H3zM7 12h.01M11 12h6",
},
{
label: "Overlays",
href: "/components/overlays",
description: "Modal, drawer, popover, toast",
icon: "M8 8h12v12H8zM4 16V4h12",
},
{
label: "Effects",
href: "/components/effects",
description: "Aurora, beams, and grid patterns",
icon: "M12 3v4M12 17v4M3 12h4M17 12h4M6 6l2.5 2.5M15.5 15.5 18 18M6 18l2.5-2.5M15.5 8.5 18 6",
},
],
},
{ label: "Templates", href: "/templates", active: true },
{ label: "Pricing", href: "/pricing" },
];
const stage =
"relative isolate overflow-hidden rounded-2xl border border-line bg-canvas bg-[radial-gradient(45%_70%_at_12%_0%,color-mix(in_oklab,var(--color-success)_30%,transparent),transparent),radial-gradient(40%_60%_at_90%_20%,color-mix(in_oklab,var(--color-ink)_12%,transparent),transparent)] px-3 pt-4 pb-14";
const grid =
"absolute inset-0 -z-10 bg-[linear-gradient(to_right,var(--color-line)_1px,transparent_1px),linear-gradient(to_bottom,var(--color-line)_1px,transparent_1px)] bg-size-[32px_32px] [mask-image:radial-gradient(ellipse_at_top,black,transparent_75%)]";
const pill =
"mx-auto max-w-3xl rounded-[1.75rem]! border-line/70! bg-surface/60! backdrop-blur-xl [&>div:first-child]:pr-2 [&>div:first-child]:pl-5 [&>div>nav>span]:rounded-full [&>div>nav_li>:first-child]:rounded-full";
const brandClass = "flex items-center gap-2 rounded-full";
const logoClass = "size-6";
const cta = "rounded-full! pr-2.5!";
const arrow = "size-4";
const hero = "mx-auto grid max-w-md gap-3 pt-14 text-center";
const title = "text-3xl font-semibold tracking-tight text-balance text-ink";
const lead = "text-sm text-muted text-pretty";
</script>
<div class={stage}>
<div aria-hidden="true" class={grid}></div>
<Navbar {links} variant="floating" class={pill}>
{#snippet brand()}
<a href="/" class={brandClass}>
<svg class={logoClass} viewBox="0 0 1464 1430" aria-hidden="true">
{#each logo as shape (shape.points)}
<polygon class={shape.fill} points={shape.points} />
{/each}
</svg>
<span>MarkasUI</span>
</a>
{/snippet}
{#snippet actions()}
<Button size="sm" class={cta}>
Get started
<svg
class={arrow}
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>
</Button>
{/snippet}
</Navbar>
<div class={hero}>
<h2 class={title}>Copy, paste, and ship it today</h2>
<p class={lead}>
A glass pill that floats over the page. The highlight slides to whatever
you point at.
</p>
</div>
</div>---
import Button from "@/components/markas/Button.astro";
import Navbar from "@/components/markas/Navbar.astro";
const logo = [
{ fill: "fill-ink/15", points: "354,578 1256,138 1171,430 268,868" },
{ fill: "fill-ink/55", points: "553,443 1455,3 1370,295 467,733" },
{ fill: "fill-success/35", points: "421,762 1325,318 1240,611 336,1050" },
{ fill: "fill-ink/30", points: "265,1073 1169,629 1084,922 180,1362" },
{ fill: "fill-ink/80", points: "93,965 997,521 912,814 8,1253" },
{ fill: "fill-success", points: "347,1135 1251,691 1166,984 262,1424" },
];
const links = [
{ label: "Docs", href: "/docs" },
{
label: "Components",
children: [
{
label: "Forms",
href: "/components/forms",
description: "Input, select, checkbox, and more",
icon: "M3 7h18v10H3zM7 12h.01M11 12h6",
},
{
label: "Overlays",
href: "/components/overlays",
description: "Modal, drawer, popover, toast",
icon: "M8 8h12v12H8zM4 16V4h12",
},
{
label: "Effects",
href: "/components/effects",
description: "Aurora, beams, and grid patterns",
icon: "M12 3v4M12 17v4M3 12h4M17 12h4M6 6l2.5 2.5M15.5 15.5 18 18M6 18l2.5-2.5M15.5 8.5 18 6",
},
],
},
{ label: "Templates", href: "/templates", active: true },
{ label: "Pricing", href: "/pricing" },
];
const stage =
"relative isolate overflow-hidden rounded-2xl border border-line bg-canvas bg-[radial-gradient(45%_70%_at_12%_0%,color-mix(in_oklab,var(--color-success)_30%,transparent),transparent),radial-gradient(40%_60%_at_90%_20%,color-mix(in_oklab,var(--color-ink)_12%,transparent),transparent)] px-3 pt-4 pb-14";
const grid =
"absolute inset-0 -z-10 bg-[linear-gradient(to_right,var(--color-line)_1px,transparent_1px),linear-gradient(to_bottom,var(--color-line)_1px,transparent_1px)] bg-size-[32px_32px] [mask-image:radial-gradient(ellipse_at_top,black,transparent_75%)]";
const pill =
"mx-auto max-w-3xl rounded-[1.75rem]! border-line/70! bg-surface/60! backdrop-blur-xl [&>div:first-child]:pr-2 [&>div:first-child]:pl-5 [&>div>nav>span]:rounded-full [&>div>nav_li>:first-child]:rounded-full";
const brand = "flex items-center gap-2 rounded-full";
const logoClass = "size-6";
const cta = "rounded-full! pr-2.5!";
const arrow = "size-4";
const hero = "mx-auto grid max-w-md gap-3 pt-14 text-center";
const title = "text-3xl font-semibold tracking-tight text-balance text-ink";
const lead = "text-sm text-muted text-pretty";
---
<div class={stage}>
<div aria-hidden="true" class={grid}></div>
<Navbar links={links} variant="floating" class={pill}>
<a slot="brand" href="/" class={brand}>
<svg class={logoClass} viewBox="0 0 1464 1430" aria-hidden="true">
{logo.map((shape) => <polygon class={shape.fill} points={shape.points} />)}
</svg>
<span>MarkasUI</span>
</a>
<Button slot="actions" size="sm" class={cta}>
Get started
<svg
class={arrow}
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>
</Button>
</Navbar>
<div class={hero}>
<h2 class={title}>Copy, paste, and ship it today</h2>
<p class={lead}>
A glass pill that floats over the page. The highlight slides to whatever
you point at.
</p>
</div>
</div>import { Component } from "@angular/core";
import { Button } from "./markas/button.component";
import {
Navbar,
type NavbarLink,
} from "./markas/navbar.component";
const logo = [
{ fill: "fill-ink/15", points: "354,578 1256,138 1171,430 268,868" },
{ fill: "fill-ink/55", points: "553,443 1455,3 1370,295 467,733" },
{ fill: "fill-success/35", points: "421,762 1325,318 1240,611 336,1050" },
{ fill: "fill-ink/30", points: "265,1073 1169,629 1084,922 180,1362" },
{ fill: "fill-ink/80", points: "93,965 997,521 912,814 8,1253" },
{ fill: "fill-success", points: "347,1135 1251,691 1166,984 262,1424" },
];
const links: NavbarLink[] = [
{ label: "Docs", href: "/docs" },
{
label: "Components",
children: [
{
label: "Forms",
href: "/components/forms",
description: "Input, select, checkbox, and more",
icon: "M3 7h18v10H3zM7 12h.01M11 12h6",
},
{
label: "Overlays",
href: "/components/overlays",
description: "Modal, drawer, popover, toast",
icon: "M8 8h12v12H8zM4 16V4h12",
},
{
label: "Effects",
href: "/components/effects",
description: "Aurora, beams, and grid patterns",
icon: "M12 3v4M12 17v4M3 12h4M17 12h4M6 6l2.5 2.5M15.5 15.5 18 18M6 18l2.5-2.5M15.5 8.5 18 6",
},
],
},
{ label: "Templates", href: "/templates", active: true },
{ label: "Pricing", href: "/pricing" },
];
const stage =
"relative isolate overflow-hidden rounded-2xl border border-line bg-canvas bg-[radial-gradient(45%_70%_at_12%_0%,color-mix(in_oklab,var(--color-success)_30%,transparent),transparent),radial-gradient(40%_60%_at_90%_20%,color-mix(in_oklab,var(--color-ink)_12%,transparent),transparent)] px-3 pt-4 pb-14";
const grid =
"absolute inset-0 -z-10 bg-[linear-gradient(to_right,var(--color-line)_1px,transparent_1px),linear-gradient(to_bottom,var(--color-line)_1px,transparent_1px)] bg-size-[32px_32px] [mask-image:radial-gradient(ellipse_at_top,black,transparent_75%)]";
const pill =
"mx-auto max-w-3xl rounded-[1.75rem]! border-line/70! bg-surface/60! backdrop-blur-xl [&>div:first-child]:pr-2 [&>div:first-child]:pl-5 [&>div>nav>span]:rounded-full [&>div>nav_li>:first-child]:rounded-full";
const brand = "flex items-center gap-2 rounded-full";
const logoClass = "size-6";
const cta = "rounded-full! pr-2.5!";
const arrow = "size-4";
const hero = "mx-auto grid max-w-md gap-3 pt-14 text-center";
const title = "text-3xl font-semibold tracking-tight text-balance text-ink";
const lead = "text-sm text-muted text-pretty";
@Component({
selector: "markas-example",
imports: [Button, Navbar],
template: `
<div [class]="stage">
<div aria-hidden="true" [class]="grid"></div>
<header markas-navbar [links]="links" variant="floating" [class]="pill">
<a brand href="/" [class]="brand">
<svg
[attr.class]="logoClass"
viewBox="0 0 1464 1430"
aria-hidden="true"
>
@for (shape of logo; track shape.points) {
<polygon [attr.class]="shape.fill" [attr.points]="shape.points" />
}
</svg>
<span>MarkasUI</span>
</a>
<button markas-button actions size="sm" [class]="cta">
Get started
<svg
[attr.class]="arrow"
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>
</button>
</header>
<div [class]="hero">
<h2 [class]="title">Copy, paste, and ship it today</h2>
<p [class]="lead">
A glass pill that floats over the page. The highlight slides to
whatever you point at.
</p>
</div>
</div>
`,
})
export default class NavbarFloatingExample {
protected readonly logo = logo;
protected readonly links = links;
protected readonly stage = stage;
protected readonly grid = grid;
protected readonly pill = pill;
protected readonly brand = brand;
protected readonly logoClass = logoClass;
protected readonly cta = cta;
protected readonly arrow = arrow;
protected readonly hero = hero;
protected readonly title = title;
protected readonly lead = lead;
}Dengan bar pengumuman
@php
$logo = [
['fill' => 'fill-ink/15', 'points' => '354,578 1256,138 1171,430 268,868'],
['fill' => 'fill-ink/55', 'points' => '553,443 1455,3 1370,295 467,733'],
['fill' => 'fill-success/35', 'points' => '421,762 1325,318 1240,611 336,1050'],
['fill' => 'fill-ink/30', 'points' => '265,1073 1169,629 1084,922 180,1362'],
['fill' => 'fill-ink/80', 'points' => '93,965 997,521 912,814 8,1253'],
['fill' => 'fill-success', 'points' => '347,1135 1251,691 1166,984 262,1424'],
];
$links = [
['label' => 'Docs', 'href' => '/docs'],
['label' => 'Components', 'href' => '/components', 'active' => true],
['label' => 'Templates', 'href' => '/templates'],
['label' => 'Changelog', 'href' => '/changelog'],
];
$shell = '@container grid';
$bar = 'relative flex items-center justify-center bg-primary bg-[radial-gradient(45%_160%_at_50%_0%,color-mix(in_oklab,var(--color-success)_55%,transparent),transparent)] py-2 pr-11 pl-4 text-sm text-on-primary';
$message = 'group inline-flex min-w-0 items-center gap-2 rounded-full focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-on-primary';
$badge = 'bg-surface!';
$headline = 'truncate font-medium';
$detail = 'hidden text-on-primary/75 @lg:inline';
$arrow = 'size-4 shrink-0 transition-transform duration-150 ease-out group-hover:translate-x-0.5 motion-reduce:transition-none';
$dismiss = 'absolute right-2 inline-flex size-7 items-center justify-center rounded-md transition-colors duration-150 ease-out hover:bg-on-primary/15 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-on-primary';
$icon = 'size-4';
$brand = 'flex items-center gap-2 rounded-md';
$logoClass = 'size-6';
@endphp
<div x-data="{ open: true }" class="{{ $shell }}">
<div x-show="open" class="{{ $bar }}">
<a href="/changelog" class="{{ $message }}">
<x-markas.badge variant="success" class="{{ $badge }}">New</x-markas.badge>
<span class="{{ $headline }}">MarkasUI 1.0 is here</span>
<span class="{{ $detail }}">Read the release notes</span>
<svg class="{{ $arrow }}" 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>
<button type="button" aria-label="Dismiss announcement" @click="open = false" class="{{ $dismiss }}">
<svg class="{{ $icon }}" 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>
</button>
</div>
<x-markas.navbar :links="$links">
<x-slot:brand>
<a href="/" class="{{ $brand }}">
<svg class="{{ $logoClass }}" viewBox="0 0 1464 1430" aria-hidden="true">
@foreach ($logo as $shape)
<polygon class="{{ $shape['fill'] }}" points="{{ $shape['points'] }}" />
@endforeach
</svg>
<span>MarkasUI</span>
</a>
</x-slot:brand>
<x-slot:actions>
<x-markas.theme-toggle size="sm" animation="eclipse" />
<x-markas.button size="sm">Get started</x-markas.button>
</x-slot:actions>
</x-markas.navbar>
</div>import { useState } from "react";
import { Badge } from "@/components/markas/Badge";
import { Button } from "@/components/markas/Button";
import { Navbar } from "@/components/markas/Navbar";
import { ThemeToggle } from "@/components/markas/ThemeToggle";
const logo = [
{ fill: "fill-ink/15", points: "354,578 1256,138 1171,430 268,868" },
{ fill: "fill-ink/55", points: "553,443 1455,3 1370,295 467,733" },
{ fill: "fill-success/35", points: "421,762 1325,318 1240,611 336,1050" },
{ fill: "fill-ink/30", points: "265,1073 1169,629 1084,922 180,1362" },
{ fill: "fill-ink/80", points: "93,965 997,521 912,814 8,1253" },
{ fill: "fill-success", points: "347,1135 1251,691 1166,984 262,1424" },
];
const links = [
{ label: "Docs", href: "/docs" },
{ label: "Components", href: "/components", active: true },
{ label: "Templates", href: "/templates" },
{ label: "Changelog", href: "/changelog" },
];
const shell = "@container grid";
const bar =
"relative flex items-center justify-center bg-primary bg-[radial-gradient(45%_160%_at_50%_0%,color-mix(in_oklab,var(--color-success)_55%,transparent),transparent)] py-2 pr-11 pl-4 text-sm text-on-primary";
const message =
"group inline-flex min-w-0 items-center gap-2 rounded-full focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-on-primary";
const badge = "bg-surface!";
const headline = "truncate font-medium";
const detail = "hidden text-on-primary/75 @lg:inline";
const arrow =
"size-4 shrink-0 transition-transform duration-150 ease-out group-hover:translate-x-0.5 motion-reduce:transition-none";
const dismiss =
"absolute right-2 inline-flex size-7 items-center justify-center rounded-md transition-colors duration-150 ease-out hover:bg-on-primary/15 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-on-primary";
const icon = "size-4";
const brand = "flex items-center gap-2 rounded-md";
const logoClass = "size-6";
export default function Example() {
const [open, setOpen] = useState(true);
return (
<div className={shell}>
{open && (
<div className={bar}>
<a href="/changelog" className={message}>
<Badge variant="success" className={badge}>
New
</Badge>
<span className={headline}>MarkasUI 1.0 is here</span>
<span className={detail}>Read the release notes</span>
<svg
className={arrow}
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>
<button
type="button"
aria-label="Dismiss announcement"
onClick={() => setOpen(false)}
className={dismiss}
>
<svg
className={icon}
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
strokeWidth="1.5"
strokeLinecap="round"
strokeLinejoin="round"
aria-hidden="true"
>
<path d="M18 6 6 18M6 6l12 12" />
</svg>
</button>
</div>
)}
<Navbar
links={links}
brand={
<a href="/" className={brand}>
<svg
className={logoClass}
viewBox="0 0 1464 1430"
aria-hidden="true"
>
{logo.map((shape) => (
<polygon
key={shape.points}
className={shape.fill}
points={shape.points}
/>
))}
</svg>
<span>MarkasUI</span>
</a>
}
actions={
<>
<ThemeToggle size="sm" animation="eclipse" />
<Button size="sm">Get started</Button>
</>
}
/>
</div>
);
}<script setup lang="ts">
import { ref } from "vue";
import Badge from "@/components/markas/Badge.vue";
import Button from "@/components/markas/Button.vue";
import Navbar from "@/components/markas/Navbar.vue";
import ThemeToggle from "@/components/markas/ThemeToggle.vue";
const logo = [
{ fill: "fill-ink/15", points: "354,578 1256,138 1171,430 268,868" },
{ fill: "fill-ink/55", points: "553,443 1455,3 1370,295 467,733" },
{ fill: "fill-success/35", points: "421,762 1325,318 1240,611 336,1050" },
{ fill: "fill-ink/30", points: "265,1073 1169,629 1084,922 180,1362" },
{ fill: "fill-ink/80", points: "93,965 997,521 912,814 8,1253" },
{ fill: "fill-success", points: "347,1135 1251,691 1166,984 262,1424" },
];
const links = [
{ label: "Docs", href: "/docs" },
{ label: "Components", href: "/components", active: true },
{ label: "Templates", href: "/templates" },
{ label: "Changelog", href: "/changelog" },
];
const shell = "@container grid";
const bar =
"relative flex items-center justify-center bg-primary bg-[radial-gradient(45%_160%_at_50%_0%,color-mix(in_oklab,var(--color-success)_55%,transparent),transparent)] py-2 pr-11 pl-4 text-sm text-on-primary";
const message =
"group inline-flex min-w-0 items-center gap-2 rounded-full focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-on-primary";
const badge = "bg-surface!";
const headline = "truncate font-medium";
const detail = "hidden text-on-primary/75 @lg:inline";
const arrow =
"size-4 shrink-0 transition-transform duration-150 ease-out group-hover:translate-x-0.5 motion-reduce:transition-none";
const dismiss =
"absolute right-2 inline-flex size-7 items-center justify-center rounded-md transition-colors duration-150 ease-out hover:bg-on-primary/15 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-on-primary";
const icon = "size-4";
const open = ref(true);
const brand = "flex items-center gap-2 rounded-md";
const logoClass = "size-6";
</script>
<template>
<div :class="shell">
<div v-if="open" :class="bar">
<a href="/changelog" :class="message">
<Badge variant="success" :class="badge">New</Badge>
<span :class="headline">MarkasUI 1.0 is here</span>
<span :class="detail">Read the release notes</span>
<svg
:class="arrow"
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>
<button
type="button"
aria-label="Dismiss announcement"
:class="dismiss"
@click="open = false"
>
<svg
:class="icon"
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>
</button>
</div>
<Navbar :links="links">
<template #brand>
<a href="/" :class="brand">
<svg :class="logoClass" viewBox="0 0 1464 1430" aria-hidden="true">
<polygon
v-for="shape in logo"
:key="shape.points"
:class="shape.fill"
:points="shape.points"
/>
</svg>
<span>MarkasUI</span>
</a>
</template>
<template #actions>
<ThemeToggle size="sm" animation="eclipse" />
<Button size="sm">Get started</Button>
</template>
</Navbar>
</div>
</template><script lang="ts">
import Badge from "$lib/components/markas/Badge.svelte";
import Button from "$lib/components/markas/Button.svelte";
import Navbar from "$lib/components/markas/Navbar.svelte";
import ThemeToggle from "$lib/components/markas/ThemeToggle.svelte";
const logo = [
{ fill: "fill-ink/15", points: "354,578 1256,138 1171,430 268,868" },
{ fill: "fill-ink/55", points: "553,443 1455,3 1370,295 467,733" },
{ fill: "fill-success/35", points: "421,762 1325,318 1240,611 336,1050" },
{ fill: "fill-ink/30", points: "265,1073 1169,629 1084,922 180,1362" },
{ fill: "fill-ink/80", points: "93,965 997,521 912,814 8,1253" },
{ fill: "fill-success", points: "347,1135 1251,691 1166,984 262,1424" },
];
const links = [
{ label: "Docs", href: "/docs" },
{ label: "Components", href: "/components", active: true },
{ label: "Templates", href: "/templates" },
{ label: "Changelog", href: "/changelog" },
];
const shell = "@container grid";
const bar =
"relative flex items-center justify-center bg-primary bg-[radial-gradient(45%_160%_at_50%_0%,color-mix(in_oklab,var(--color-success)_55%,transparent),transparent)] py-2 pr-11 pl-4 text-sm text-on-primary";
const message =
"group inline-flex min-w-0 items-center gap-2 rounded-full focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-on-primary";
const badge = "bg-surface!";
const headline = "truncate font-medium";
const detail = "hidden text-on-primary/75 @lg:inline";
const arrow =
"size-4 shrink-0 transition-transform duration-150 ease-out group-hover:translate-x-0.5 motion-reduce:transition-none";
const dismiss =
"absolute right-2 inline-flex size-7 items-center justify-center rounded-md transition-colors duration-150 ease-out hover:bg-on-primary/15 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-on-primary";
const icon = "size-4";
let open = $state(true);
const brandLink = "flex items-center gap-2 rounded-md";
const logoClass = "size-6";
</script>
<div class={shell}>
{#if open}<div class={bar}>
<a href="/changelog" class={message}>
<Badge variant="success" class={badge}>New</Badge>
<span class={headline}>MarkasUI 1.0 is here</span>
<span class={detail}>Read the release notes</span>
<svg
class={arrow}
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>
<button
type="button"
aria-label="Dismiss announcement"
class={dismiss}
onclick={() => (open = false)}
>
<svg
class={icon}
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>
</button>
</div>{/if}
<Navbar {links}>
{#snippet brand()}
<a href="/" class={brandLink}>
<svg class={logoClass} viewBox="0 0 1464 1430" aria-hidden="true">
{#each logo as shape (shape.points)}<polygon
class={shape.fill}
points={shape.points}
/>{/each}
</svg>
<span>MarkasUI</span>
</a>
{/snippet}
{#snippet actions()}
<ThemeToggle size="sm" animation="eclipse" />
<Button size="sm">Get started</Button>
{/snippet}
</Navbar>
</div>---
import Badge from "@/components/markas/Badge.astro";
import Button from "@/components/markas/Button.astro";
import Navbar from "@/components/markas/Navbar.astro";
import ThemeToggle from "@/components/markas/ThemeToggle.astro";
const logo = [
{ fill: "fill-ink/15", points: "354,578 1256,138 1171,430 268,868" },
{ fill: "fill-ink/55", points: "553,443 1455,3 1370,295 467,733" },
{ fill: "fill-success/35", points: "421,762 1325,318 1240,611 336,1050" },
{ fill: "fill-ink/30", points: "265,1073 1169,629 1084,922 180,1362" },
{ fill: "fill-ink/80", points: "93,965 997,521 912,814 8,1253" },
{ fill: "fill-success", points: "347,1135 1251,691 1166,984 262,1424" },
];
const links = [
{ label: "Docs", href: "/docs" },
{ label: "Components", href: "/components", active: true },
{ label: "Templates", href: "/templates" },
{ label: "Changelog", href: "/changelog" },
];
const shell = "@container grid";
const bar =
"relative flex items-center justify-center bg-primary bg-[radial-gradient(45%_160%_at_50%_0%,color-mix(in_oklab,var(--color-success)_55%,transparent),transparent)] py-2 pr-11 pl-4 text-sm text-on-primary";
const message =
"group inline-flex min-w-0 items-center gap-2 rounded-full focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-on-primary";
const badge = "bg-surface!";
const headline = "truncate font-medium";
const detail = "hidden text-on-primary/75 @lg:inline";
const arrow =
"size-4 shrink-0 transition-transform duration-150 ease-out group-hover:translate-x-0.5 motion-reduce:transition-none";
const dismiss =
"absolute right-2 inline-flex size-7 items-center justify-center rounded-md transition-colors duration-150 ease-out hover:bg-on-primary/15 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-on-primary";
const icon = "size-4";
const brand = "flex items-center gap-2 rounded-md";
const logoClass = "size-6";
---
<div class={shell}>
<div class={bar} data-announcement>
<a href="/changelog" class={message}>
<Badge variant="success" class={badge}>New</Badge>
<span class={headline}>MarkasUI 1.0 is here</span>
<span class={detail}>Read the release notes</span>
<svg class={arrow} 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>
<button type="button" aria-label="Dismiss announcement" class={dismiss} data-dismiss>
<svg class={icon} 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>
</button>
</div>
<Navbar links={links}>
<Fragment slot="brand">
<a href="/" class={brand}>
<svg class={logoClass} viewBox="0 0 1464 1430" aria-hidden="true">
{logo.map((shape) => (<polygon class={shape.fill} points={shape.points} />))}
</svg>
<span>MarkasUI</span>
</a>
</Fragment>
<Fragment slot="actions">
<ThemeToggle size="sm" animation="eclipse" />
<Button size="sm">Get started</Button>
</Fragment>
</Navbar>
</div>
<script>
// The dismiss button removes the announcement bar.
for (const button of document.querySelectorAll("[data-dismiss]"))
button.addEventListener("click", () =>
button.closest("[data-announcement]")?.remove(),
);
</script>import { Component, signal } from "@angular/core";
import { Badge } from "./markas/badge.component";
import { Button } from "./markas/button.component";
import { Navbar } from "./markas/navbar.component";
import { ThemeToggle } from "./markas/theme-toggle.component";
@Component({
selector: "markas-example",
imports: [Badge, Button, Navbar, ThemeToggle],
template: `
<div [class]="shell">
@if (open()) {
<div [class]="bar">
<a href="/changelog" [class]="message">
<span markas-badge variant="success" [class]="badge">New</span>
<span [class]="headline">MarkasUI 1.0 is here</span>
<span [class]="detail">Read the release notes</span>
<svg
[class]="arrow"
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>
<button
type="button"
aria-label="Dismiss announcement"
[class]="dismiss"
(click)="open.set(false)"
>
<svg
[class]="icon"
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>
</button>
</div>
}
<header markas-navbar [links]="links">
<ng-container brand>
<a href="/" [class]="brand">
<svg [class]="logoClass" viewBox="0 0 1464 1430" aria-hidden="true">
@for (shape of logo; track shape.points) {
<polygon [class]="shape.fill" [attr.points]="shape.points" />
}
</svg>
<span>MarkasUI</span>
</a>
</ng-container>
<ng-container actions>
<button markas-theme-toggle size="sm" animation="eclipse"></button>
<button markas-button size="sm">Get started</button>
</ng-container>
</header>
</div>
`,
})
export default class NavbarAnnouncementExample {
protected readonly logo = [
{ fill: "fill-ink/15", points: "354,578 1256,138 1171,430 268,868" },
{ fill: "fill-ink/55", points: "553,443 1455,3 1370,295 467,733" },
{ fill: "fill-success/35", points: "421,762 1325,318 1240,611 336,1050" },
{ fill: "fill-ink/30", points: "265,1073 1169,629 1084,922 180,1362" },
{ fill: "fill-ink/80", points: "93,965 997,521 912,814 8,1253" },
{ fill: "fill-success", points: "347,1135 1251,691 1166,984 262,1424" },
];
protected readonly links = [
{ label: "Docs", href: "/docs" },
{ label: "Components", href: "/components", active: true },
{ label: "Templates", href: "/templates" },
{ label: "Changelog", href: "/changelog" },
];
protected readonly shell = "@container grid";
protected readonly bar =
"relative flex items-center justify-center bg-primary bg-[radial-gradient(45%_160%_at_50%_0%,color-mix(in_oklab,var(--color-success)_55%,transparent),transparent)] py-2 pr-11 pl-4 text-sm text-on-primary";
protected readonly message =
"group inline-flex min-w-0 items-center gap-2 rounded-full focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-on-primary";
protected readonly badge = "bg-surface!";
protected readonly headline = "truncate font-medium";
protected readonly detail = "hidden text-on-primary/75 @lg:inline";
protected readonly arrow =
"size-4 shrink-0 transition-transform duration-150 ease-out group-hover:translate-x-0.5 motion-reduce:transition-none";
protected readonly dismiss =
"absolute right-2 inline-flex size-7 items-center justify-center rounded-md transition-colors duration-150 ease-out hover:bg-on-primary/15 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-on-primary";
protected readonly icon = "size-4";
protected readonly open = signal(true);
protected readonly brand = "flex items-center gap-2 rounded-md";
protected readonly logoClass = "size-6";
}Pencarian perintah di tengah
@php
$logo = [
['fill' => 'fill-ink/15', 'points' => '354,578 1256,138 1171,430 268,868'],
['fill' => 'fill-ink/55', 'points' => '553,443 1455,3 1370,295 467,733'],
['fill' => 'fill-success/35', 'points' => '421,762 1325,318 1240,611 336,1050'],
['fill' => 'fill-ink/30', 'points' => '265,1073 1169,629 1084,922 180,1362'],
['fill' => 'fill-ink/80', 'points' => '93,965 997,521 912,814 8,1253'],
['fill' => 'fill-success', 'points' => '347,1135 1251,691 1166,984 262,1424'],
];
$links = [
['label' => 'Docs', 'href' => '/docs', 'active' => true],
['label' => 'Components', 'href' => '/components'],
['label' => 'Blog', 'href' => '/blog'],
];
$commands = [
['group' => 'Components', 'label' => 'Button', 'href' => '/components/button'],
['group' => 'Components', 'label' => 'Navbar', 'href' => '/components/navbar'],
['group' => 'Components', 'label' => 'Command', 'href' => '/components/command'],
['group' => 'Pages', 'label' => 'Installation', 'href' => '/docs/installation'],
['group' => 'Pages', 'label' => 'Templates', 'href' => '/templates'],
['group' => 'Pages', 'label' => 'Changelog', 'href' => '/changelog'],
];
$layout = '[&>div>div:last-child]:min-w-0 [&>div>div:last-child]:flex-1 @2xl:[&>div>nav]:order-last';
$brand = 'flex items-center gap-2 rounded-md';
$logoClass = 'size-6';
$search = 'mx-auto flex h-10 max-w-md min-w-0 flex-1 items-center gap-2.5 rounded-full border border-line bg-canvas pr-2 pl-4 text-sm text-muted transition-colors duration-150 ease-out hover:border-primary-line hover:bg-subtle motion-reduce:transition-none';
$searchIcon = 'size-4 shrink-0';
$placeholder = 'min-w-0 flex-1 truncate text-left';
// Phones have no hotkey, and the label needs the room in a narrow bar.
$shortcut = '@max-xs:hidden';
@endphp
<x-markas.navbar :links="$links" class="{{ $layout }}">
<x-slot:brand>
<a href="/" class="{{ $brand }}">
<svg class="{{ $logoClass }}" viewBox="0 0 1464 1430" aria-hidden="true">
@foreach ($logo as $shape)
<polygon class="{{ $shape['fill'] }}" points="{{ $shape['points'] }}" />
@endforeach
</svg>
<span>MarkasUI</span>
</a>
</x-slot:brand>
<x-slot:actions>
<x-markas.command hotkey :items="$commands">
<x-slot:trigger>
<button type="button" aria-keyshortcuts="Meta+K" class="{{ $search }}">
<svg class="{{ $searchIcon }}" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="m21 21-4.3-4.3" /><path d="M11 18a7 7 0 1 0 0-14 7 7 0 0 0 0 14z" /></svg>
<span class="{{ $placeholder }}">Search components</span>
<x-markas.kbd size="sm" class="{{ $shortcut }}">⌘K</x-markas.kbd>
</button>
</x-slot:trigger>
</x-markas.command>
</x-slot:actions>
</x-markas.navbar>import { Command } from "@/components/markas/Command";
import { Kbd } from "@/components/markas/Kbd";
import { Navbar } from "@/components/markas/Navbar";
const logo = [
{ fill: "fill-ink/15", points: "354,578 1256,138 1171,430 268,868" },
{ fill: "fill-ink/55", points: "553,443 1455,3 1370,295 467,733" },
{ fill: "fill-success/35", points: "421,762 1325,318 1240,611 336,1050" },
{ fill: "fill-ink/30", points: "265,1073 1169,629 1084,922 180,1362" },
{ fill: "fill-ink/80", points: "93,965 997,521 912,814 8,1253" },
{ fill: "fill-success", points: "347,1135 1251,691 1166,984 262,1424" },
];
const links = [
{ label: "Docs", href: "/docs", active: true },
{ label: "Components", href: "/components" },
{ label: "Blog", href: "/blog" },
];
const commands = [
{ group: "Components", label: "Button", href: "/components/button" },
{ group: "Components", label: "Navbar", href: "/components/navbar" },
{ group: "Components", label: "Command", href: "/components/command" },
{ group: "Pages", label: "Installation", href: "/docs/installation" },
{ group: "Pages", label: "Templates", href: "/templates" },
{ group: "Pages", label: "Changelog", href: "/changelog" },
];
/** From 42rem the links move to the end so the search sits in the middle. */
const layout =
"[&>div>div:last-child]:min-w-0 [&>div>div:last-child]:flex-1 @2xl:[&>div>nav]:order-last";
const brand = "flex items-center gap-2 rounded-md";
const logoClass = "size-6";
const search =
"mx-auto flex h-10 max-w-md min-w-0 flex-1 items-center gap-2.5 rounded-full border border-line bg-canvas pr-2 pl-4 text-sm text-muted transition-colors duration-150 ease-out hover:border-primary-line hover:bg-subtle motion-reduce:transition-none";
const searchIcon = "size-4 shrink-0";
const placeholder = "min-w-0 flex-1 truncate text-left";
// Phones have no hotkey, and the label needs the room in a narrow bar.
const shortcut = "@max-xs:hidden";
export default function Example() {
return (
<Navbar
links={links}
className={layout}
brand={
<a href="/" className={brand}>
<svg className={logoClass} viewBox="0 0 1464 1430" aria-hidden="true">
{logo.map((shape) => (
<polygon
key={shape.points}
className={shape.fill}
points={shape.points}
/>
))}
</svg>
<span>MarkasUI</span>
</a>
}
actions={
<Command
hotkey
items={commands}
trigger={
<button type="button" aria-keyshortcuts="Meta+K" className={search}>
<svg
className={searchIcon}
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
strokeWidth="1.5"
strokeLinecap="round"
strokeLinejoin="round"
aria-hidden="true"
>
<path d="m21 21-4.3-4.3" />
<path d="M11 18a7 7 0 1 0 0-14 7 7 0 0 0 0 14z" />
</svg>
<span className={placeholder}>Search components</span>
<Kbd size="sm" className={shortcut}>
⌘K
</Kbd>
</button>
}
/>
}
/>
);
}<script setup lang="ts">
import Command from "@/components/markas/Command.vue";
import Kbd from "@/components/markas/Kbd.vue";
import Navbar from "@/components/markas/Navbar.vue";
const logo = [
{ fill: "fill-ink/15", points: "354,578 1256,138 1171,430 268,868" },
{ fill: "fill-ink/55", points: "553,443 1455,3 1370,295 467,733" },
{ fill: "fill-success/35", points: "421,762 1325,318 1240,611 336,1050" },
{ fill: "fill-ink/30", points: "265,1073 1169,629 1084,922 180,1362" },
{ fill: "fill-ink/80", points: "93,965 997,521 912,814 8,1253" },
{ fill: "fill-success", points: "347,1135 1251,691 1166,984 262,1424" },
];
const links = [
{ label: "Docs", href: "/docs", active: true },
{ label: "Components", href: "/components" },
{ label: "Blog", href: "/blog" },
];
const commands = [
{ group: "Components", label: "Button", href: "/components/button" },
{ group: "Components", label: "Navbar", href: "/components/navbar" },
{ group: "Components", label: "Command", href: "/components/command" },
{ group: "Pages", label: "Installation", href: "/docs/installation" },
{ group: "Pages", label: "Templates", href: "/templates" },
{ group: "Pages", label: "Changelog", href: "/changelog" },
];
/** From 42rem the links move to the end so the search sits in the middle. */
const layout =
"[&>div>div:last-child]:min-w-0 [&>div>div:last-child]:flex-1 @2xl:[&>div>nav]:order-last";
const brand = "flex items-center gap-2 rounded-md";
const logoClass = "size-6";
const search =
"mx-auto flex h-10 max-w-md min-w-0 flex-1 items-center gap-2.5 rounded-full border border-line bg-canvas pr-2 pl-4 text-sm text-muted transition-colors duration-150 ease-out hover:border-primary-line hover:bg-subtle motion-reduce:transition-none";
const searchIcon = "size-4 shrink-0";
const placeholder = "min-w-0 flex-1 truncate text-left";
// Phones have no hotkey, and the label needs the room in a narrow bar.
const shortcut = "@max-xs:hidden";
</script>
<template>
<Navbar :links="links" :class="layout">
<template #brand>
<a href="/" :class="brand">
<svg :class="logoClass" viewBox="0 0 1464 1430" aria-hidden="true">
<polygon
v-for="shape in logo"
:key="shape.points"
:class="shape.fill"
:points="shape.points"
/>
</svg>
<span>MarkasUI</span>
</a>
</template>
<template #actions>
<Command hotkey :items="commands">
<template #trigger>
<button type="button" aria-keyshortcuts="Meta+K" :class="search">
<svg
:class="searchIcon"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
stroke-width="1.5"
stroke-linecap="round"
stroke-linejoin="round"
aria-hidden="true"
>
<path d="m21 21-4.3-4.3" />
<path d="M11 18a7 7 0 1 0 0-14 7 7 0 0 0 0 14z" />
</svg>
<span :class="placeholder">Search components</span>
<Kbd size="sm" :class="shortcut">⌘K</Kbd>
</button>
</template>
</Command>
</template>
</Navbar>
</template><script lang="ts">
import Command from "$lib/components/markas/Command.svelte";
import Kbd from "$lib/components/markas/Kbd.svelte";
import Navbar from "$lib/components/markas/Navbar.svelte";
const logo = [
{ fill: "fill-ink/15", points: "354,578 1256,138 1171,430 268,868" },
{ fill: "fill-ink/55", points: "553,443 1455,3 1370,295 467,733" },
{ fill: "fill-success/35", points: "421,762 1325,318 1240,611 336,1050" },
{ fill: "fill-ink/30", points: "265,1073 1169,629 1084,922 180,1362" },
{ fill: "fill-ink/80", points: "93,965 997,521 912,814 8,1253" },
{ fill: "fill-success", points: "347,1135 1251,691 1166,984 262,1424" },
];
const links = [
{ label: "Docs", href: "/docs", active: true },
{ label: "Components", href: "/components" },
{ label: "Blog", href: "/blog" },
];
const commands = [
{ group: "Components", label: "Button", href: "/components/button" },
{ group: "Components", label: "Navbar", href: "/components/navbar" },
{ group: "Components", label: "Command", href: "/components/command" },
{ group: "Pages", label: "Installation", href: "/docs/installation" },
{ group: "Pages", label: "Templates", href: "/templates" },
{ group: "Pages", label: "Changelog", href: "/changelog" },
];
/** From 42rem the links move to the end so the search sits in the middle. */
const layout =
"[&>div>div:last-child]:min-w-0 [&>div>div:last-child]:flex-1 @2xl:[&>div>nav]:order-last";
const brandClass = "flex items-center gap-2 rounded-md";
const logoClass = "size-6";
const search =
"mx-auto flex h-10 max-w-md min-w-0 flex-1 items-center gap-2.5 rounded-full border border-line bg-canvas pr-2 pl-4 text-sm text-muted transition-colors duration-150 ease-out hover:border-primary-line hover:bg-subtle motion-reduce:transition-none";
const searchIcon = "size-4 shrink-0";
const placeholder = "min-w-0 flex-1 truncate text-left";
// Phones have no hotkey, and the label needs the room in a narrow bar.
const shortcut = "@max-xs:hidden";
</script>
<Navbar {links} class={layout}>
{#snippet brand()}
<a href="/" class={brandClass}>
<svg class={logoClass} viewBox="0 0 1464 1430" aria-hidden="true">
{#each logo as shape (shape.points)}
<polygon class={shape.fill} points={shape.points} />
{/each}
</svg>
<span>MarkasUI</span>
</a>
{/snippet}
{#snippet actions()}
<Command hotkey items={commands}>
{#snippet trigger()}
<button type="button" aria-keyshortcuts="Meta+K" class={search}>
<svg
class={searchIcon}
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
stroke-width="1.5"
stroke-linecap="round"
stroke-linejoin="round"
aria-hidden="true"
>
<path d="m21 21-4.3-4.3" />
<path d="M11 18a7 7 0 1 0 0-14 7 7 0 0 0 0 14z" />
</svg>
<span class={placeholder}>Search components</span>
<Kbd size="sm" class={shortcut}>⌘K</Kbd>
</button>
{/snippet}
</Command>
{/snippet}
</Navbar>---
import Command from "@/components/markas/Command.astro";
import Kbd from "@/components/markas/Kbd.astro";
import Navbar from "@/components/markas/Navbar.astro";
const logo = [
{ fill: "fill-ink/15", points: "354,578 1256,138 1171,430 268,868" },
{ fill: "fill-ink/55", points: "553,443 1455,3 1370,295 467,733" },
{ fill: "fill-success/35", points: "421,762 1325,318 1240,611 336,1050" },
{ fill: "fill-ink/30", points: "265,1073 1169,629 1084,922 180,1362" },
{ fill: "fill-ink/80", points: "93,965 997,521 912,814 8,1253" },
{ fill: "fill-success", points: "347,1135 1251,691 1166,984 262,1424" },
];
const links = [
{ label: "Docs", href: "/docs", active: true },
{ label: "Components", href: "/components" },
{ label: "Blog", href: "/blog" },
];
const commands = [
{ group: "Components", label: "Button", href: "/components/button" },
{ group: "Components", label: "Navbar", href: "/components/navbar" },
{ group: "Components", label: "Command", href: "/components/command" },
{ group: "Pages", label: "Installation", href: "/docs/installation" },
{ group: "Pages", label: "Templates", href: "/templates" },
{ group: "Pages", label: "Changelog", href: "/changelog" },
];
/** From 42rem the links move to the end so the search sits in the middle. */
const layout =
"[&>div>div:last-child]:min-w-0 [&>div>div:last-child]:flex-1 @2xl:[&>div>nav]:order-last";
const brand = "flex items-center gap-2 rounded-md";
const logoClass = "size-6";
const search =
"mx-auto flex h-10 max-w-md min-w-0 flex-1 items-center gap-2.5 rounded-full border border-line bg-canvas pr-2 pl-4 text-sm text-muted transition-colors duration-150 ease-out hover:border-primary-line hover:bg-subtle motion-reduce:transition-none";
const searchIcon = "size-4 shrink-0";
const placeholder = "min-w-0 flex-1 truncate text-left";
// Phones have no hotkey, and the label needs the room in a narrow bar.
const shortcut = "@max-xs:hidden";
---
<Navbar links={links} class={layout}>
<a slot="brand" href="/" class={brand}>
<svg class={logoClass} viewBox="0 0 1464 1430" aria-hidden="true">
{logo.map((shape) => <polygon class={shape.fill} points={shape.points} />)}
</svg>
<span>MarkasUI</span>
</a>
<Command slot="actions" hotkey items={commands}>
<button
slot="trigger"
type="button"
aria-keyshortcuts="Meta+K"
class={search}
>
<svg
class={searchIcon}
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
stroke-width="1.5"
stroke-linecap="round"
stroke-linejoin="round"
aria-hidden="true"
>
<path d="m21 21-4.3-4.3"></path>
<path d="M11 18a7 7 0 1 0 0-14 7 7 0 0 0 0 14z"></path>
</svg>
<span class={placeholder}>Search components</span>
<Kbd size="sm" class={shortcut}>⌘K</Kbd>
</button>
</Command>
</Navbar>import { Component } from "@angular/core";
import { Command } from "./markas/command.component";
import { Kbd } from "./markas/kbd.component";
import {
Navbar,
type NavbarLink,
} from "./markas/navbar.component";
const logo = [
{ fill: "fill-ink/15", points: "354,578 1256,138 1171,430 268,868" },
{ fill: "fill-ink/55", points: "553,443 1455,3 1370,295 467,733" },
{ fill: "fill-success/35", points: "421,762 1325,318 1240,611 336,1050" },
{ fill: "fill-ink/30", points: "265,1073 1169,629 1084,922 180,1362" },
{ fill: "fill-ink/80", points: "93,965 997,521 912,814 8,1253" },
{ fill: "fill-success", points: "347,1135 1251,691 1166,984 262,1424" },
];
const links: NavbarLink[] = [
{ label: "Docs", href: "/docs", active: true },
{ label: "Components", href: "/components" },
{ label: "Blog", href: "/blog" },
];
const commands = [
{ group: "Components", label: "Button", href: "/components/button" },
{ group: "Components", label: "Navbar", href: "/components/navbar" },
{ group: "Components", label: "Command", href: "/components/command" },
{ group: "Pages", label: "Installation", href: "/docs/installation" },
{ group: "Pages", label: "Templates", href: "/templates" },
{ group: "Pages", label: "Changelog", href: "/changelog" },
];
/** From 42rem the links move to the end so the search sits in the middle. */
const layout =
"[&>div>div:last-child]:min-w-0 [&>div>div:last-child]:flex-1 @2xl:[&>div>nav]:order-last";
const brand = "flex items-center gap-2 rounded-md";
const logoClass = "size-6";
const search =
"mx-auto flex h-10 max-w-md min-w-0 flex-1 items-center gap-2.5 rounded-full border border-line bg-canvas pr-2 pl-4 text-sm text-muted transition-colors duration-150 ease-out hover:border-primary-line hover:bg-subtle motion-reduce:transition-none";
const searchIcon = "size-4 shrink-0";
const placeholder = "min-w-0 flex-1 truncate text-left";
// Phones have no hotkey, and the label needs the room in a narrow bar.
const shortcut = "@max-xs:hidden";
@Component({
selector: "markas-example",
imports: [Command, Kbd, Navbar],
template: `
<header markas-navbar [links]="links" [class]="layout">
<a brand href="/" [class]="brand">
<svg
[attr.class]="logoClass"
viewBox="0 0 1464 1430"
aria-hidden="true"
>
@for (shape of logo; track shape.points) {
<polygon [attr.class]="shape.fill" [attr.points]="shape.points" />
}
</svg>
<span>MarkasUI</span>
</a>
<markas-command actions hotkey [items]="commands">
<button
trigger
type="button"
aria-keyshortcuts="Meta+K"
[class]="search"
>
<svg
[attr.class]="searchIcon"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
stroke-width="1.5"
stroke-linecap="round"
stroke-linejoin="round"
aria-hidden="true"
>
<path d="m21 21-4.3-4.3" />
<path d="M11 18a7 7 0 1 0 0-14 7 7 0 0 0 0 14z" />
</svg>
<span [class]="placeholder">Search components</span>
<kbd markas-kbd size="sm" [class]="shortcut">⌘K</kbd>
</button>
</markas-command>
</header>
`,
})
export default class NavbarSearchExample {
protected readonly logo = logo;
protected readonly links = links;
protected readonly commands = commands;
protected readonly layout = layout;
protected readonly brand = brand;
protected readonly logoClass = logoClass;
protected readonly search = search;
protected readonly searchIcon = searchIcon;
protected readonly placeholder = placeholder;
protected readonly shortcut = shortcut;
}Dua tingkat dengan bar utilitas
@php
$logo = [
['fill' => 'fill-ink/15', 'points' => '354,578 1256,138 1171,430 268,868'],
['fill' => 'fill-ink/55', 'points' => '553,443 1455,3 1370,295 467,733'],
['fill' => 'fill-success/35', 'points' => '421,762 1325,318 1240,611 336,1050'],
['fill' => 'fill-ink/30', 'points' => '265,1073 1169,629 1084,922 180,1362'],
['fill' => 'fill-ink/80', 'points' => '93,965 997,521 912,814 8,1253'],
['fill' => 'fill-success', 'points' => '347,1135 1251,691 1166,984 262,1424'],
];
$links = [
[
'label' => 'Components',
'children' => [
[
'label' => 'Forms',
'href' => '/components/forms',
'description' => 'Input, select, checkbox, and more',
'icon' => 'M3 7h18v10H3zM7 12h.01M11 12h6',
],
[
'label' => 'Overlays',
'href' => '/components/overlays',
'description' => 'Modal, drawer, popover, toast',
'icon' => 'M8 8h12v12H8zM4 16V4h12',
],
[
'label' => 'Navigation',
'href' => '/components/navigation',
'description' => 'Navbar, sidebar, tabs, menus',
'icon' => 'M12 21a9 9 0 1 0 0-18 9 9 0 0 0 0 18zm4-13-2 6-6 2 2-6z',
],
],
],
['label' => 'Templates', 'href' => '/templates', 'active' => true],
['label' => 'Docs', 'href' => '/docs'],
['label' => 'Pricing', 'href' => '/pricing'],
];
$utilities = [
['label' => 'Changelog', 'href' => '/changelog'],
['label' => 'GitHub', 'href' => 'https://github.com'],
['label' => 'Sign in', 'href' => '/login'],
];
$shell = '@container grid';
$strip = 'flex h-9 items-center gap-4 border-b border-line bg-canvas px-4 text-xs text-muted';
$status = 'inline-flex items-center gap-2 rounded-sm hover:text-ink focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary';
$dot = 'size-1.5 rounded-full bg-success ring-4 ring-success/20';
$version = 'hidden rounded-full border border-line px-2 py-px @lg:inline';
$utilityNav = 'ml-auto flex items-center gap-4';
$utilityLink = 'rounded-sm transition-colors duration-150 ease-out hover:text-ink focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary motion-reduce:transition-none';
$main = '[&>div:first-child]:h-16';
$brand = 'flex items-center gap-2.5 rounded-md text-base';
$logoClass = 'size-7';
$sales = 'hidden @3xl:block';
@endphp
<div class="{{ $shell }}">
<div class="{{ $strip }}">
<a href="/status" class="{{ $status }}">
<span aria-hidden="true" class="{{ $dot }}"></span>
All systems normal
</a>
<span class="{{ $version }}">v1.0.0</span>
<nav aria-label="Utilities" class="{{ $utilityNav }}">
@foreach ($utilities as $link)
<a href="{{ $link['href'] }}" class="{{ $utilityLink }}">{{ $link['label'] }}</a>
@endforeach
</nav>
</div>
<x-markas.navbar :links="$links" class="{{ $main }}">
<x-slot:brand>
<a href="/" class="{{ $brand }}">
<svg class="{{ $logoClass }}" viewBox="0 0 1464 1430" aria-hidden="true">
@foreach ($logo as $shape)
<polygon class="{{ $shape['fill'] }}" points="{{ $shape['points'] }}" />
@endforeach
</svg>
<span>MarkasUI</span>
</a>
</x-slot:brand>
<x-slot:actions>
<div class="{{ $sales }}">
<x-markas.button size="sm" variant="secondary">Contact sales</x-markas.button>
</div>
<x-markas.button size="sm">Get started</x-markas.button>
</x-slot:actions>
</x-markas.navbar>
</div>import { Button } from "@/components/markas/Button";
import { Navbar } from "@/components/markas/Navbar";
const logo = [
{ fill: "fill-ink/15", points: "354,578 1256,138 1171,430 268,868" },
{ fill: "fill-ink/55", points: "553,443 1455,3 1370,295 467,733" },
{ fill: "fill-success/35", points: "421,762 1325,318 1240,611 336,1050" },
{ fill: "fill-ink/30", points: "265,1073 1169,629 1084,922 180,1362" },
{ fill: "fill-ink/80", points: "93,965 997,521 912,814 8,1253" },
{ fill: "fill-success", points: "347,1135 1251,691 1166,984 262,1424" },
];
const links = [
{
label: "Components",
children: [
{
label: "Forms",
href: "/components/forms",
description: "Input, select, checkbox, and more",
icon: "M3 7h18v10H3zM7 12h.01M11 12h6",
},
{
label: "Overlays",
href: "/components/overlays",
description: "Modal, drawer, popover, toast",
icon: "M8 8h12v12H8zM4 16V4h12",
},
{
label: "Navigation",
href: "/components/navigation",
description: "Navbar, sidebar, tabs, menus",
icon: "M12 21a9 9 0 1 0 0-18 9 9 0 0 0 0 18zm4-13-2 6-6 2 2-6z",
},
],
},
{ label: "Templates", href: "/templates", active: true },
{ label: "Docs", href: "/docs" },
{ label: "Pricing", href: "/pricing" },
];
const utilities = [
{ label: "Changelog", href: "/changelog" },
{ label: "GitHub", href: "https://github.com" },
{ label: "Sign in", href: "/login" },
];
const shell = "@container grid";
const strip =
"flex h-9 items-center gap-4 border-b border-line bg-canvas px-4 text-xs text-muted";
const status =
"inline-flex items-center gap-2 rounded-sm hover:text-ink focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary";
const dot = "size-1.5 rounded-full bg-success ring-4 ring-success/20";
const version = "hidden rounded-full border border-line px-2 py-px @lg:inline";
const utilityNav = "ml-auto flex items-center gap-4";
const utilityLink =
"rounded-sm transition-colors duration-150 ease-out hover:text-ink focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary motion-reduce:transition-none";
const main = "[&>div:first-child]:h-16";
const brand = "flex items-center gap-2.5 rounded-md text-base";
const logoClass = "size-7";
const sales = "hidden @3xl:block";
export default function Example() {
return (
<div className={shell}>
<div className={strip}>
<a href="/status" className={status}>
<span aria-hidden="true" className={dot} />
All systems normal
</a>
<span className={version}>v1.0.0</span>
<nav aria-label="Utilities" className={utilityNav}>
{utilities.map((link) => (
<a key={link.href} href={link.href} className={utilityLink}>
{link.label}
</a>
))}
</nav>
</div>
<Navbar
links={links}
className={main}
brand={
<a href="/" className={brand}>
<svg
className={logoClass}
viewBox="0 0 1464 1430"
aria-hidden="true"
>
{logo.map((shape) => (
<polygon
key={shape.points}
className={shape.fill}
points={shape.points}
/>
))}
</svg>
<span>MarkasUI</span>
</a>
}
actions={
<>
<div className={sales}>
<Button size="sm" variant="secondary">
Contact sales
</Button>
</div>
<Button size="sm">Get started</Button>
</>
}
/>
</div>
);
}<script setup lang="ts">
import Button from "@/components/markas/Button.vue";
import Navbar from "@/components/markas/Navbar.vue";
const logo = [
{ fill: "fill-ink/15", points: "354,578 1256,138 1171,430 268,868" },
{ fill: "fill-ink/55", points: "553,443 1455,3 1370,295 467,733" },
{ fill: "fill-success/35", points: "421,762 1325,318 1240,611 336,1050" },
{ fill: "fill-ink/30", points: "265,1073 1169,629 1084,922 180,1362" },
{ fill: "fill-ink/80", points: "93,965 997,521 912,814 8,1253" },
{ fill: "fill-success", points: "347,1135 1251,691 1166,984 262,1424" },
];
const links = [
{
label: "Components",
children: [
{
label: "Forms",
href: "/components/forms",
description: "Input, select, checkbox, and more",
icon: "M3 7h18v10H3zM7 12h.01M11 12h6",
},
{
label: "Overlays",
href: "/components/overlays",
description: "Modal, drawer, popover, toast",
icon: "M8 8h12v12H8zM4 16V4h12",
},
{
label: "Navigation",
href: "/components/navigation",
description: "Navbar, sidebar, tabs, menus",
icon: "M12 21a9 9 0 1 0 0-18 9 9 0 0 0 0 18zm4-13-2 6-6 2 2-6z",
},
],
},
{ label: "Templates", href: "/templates", active: true },
{ label: "Docs", href: "/docs" },
{ label: "Pricing", href: "/pricing" },
];
const utilities = [
{ label: "Changelog", href: "/changelog" },
{ label: "GitHub", href: "https://github.com" },
{ label: "Sign in", href: "/login" },
];
const shell = "@container grid";
const strip =
"flex h-9 items-center gap-4 border-b border-line bg-canvas px-4 text-xs text-muted";
const status =
"inline-flex items-center gap-2 rounded-sm hover:text-ink focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary";
const dot = "size-1.5 rounded-full bg-success ring-4 ring-success/20";
const version = "hidden rounded-full border border-line px-2 py-px @lg:inline";
const utilityNav = "ml-auto flex items-center gap-4";
const utilityLink =
"rounded-sm transition-colors duration-150 ease-out hover:text-ink focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary motion-reduce:transition-none";
const main = "[&>div:first-child]:h-16";
const brand = "flex items-center gap-2.5 rounded-md text-base";
const logoClass = "size-7";
const sales = "hidden @3xl:block";
</script>
<template>
<div :class="shell">
<div :class="strip">
<a href="/status" :class="status">
<span aria-hidden="true" :class="dot" />
All systems normal
</a>
<span :class="version">v1.0.0</span>
<nav aria-label="Utilities" :class="utilityNav">
<a
v-for="link in utilities"
:key="link.href"
:href="link.href"
:class="utilityLink"
>{{ link.label }}</a
>
</nav>
</div>
<Navbar :links="links" :class="main">
<template #brand>
<a href="/" :class="brand">
<svg :class="logoClass" viewBox="0 0 1464 1430" aria-hidden="true">
<polygon
v-for="shape in logo"
:key="shape.points"
:class="shape.fill"
:points="shape.points"
/>
</svg>
<span>MarkasUI</span>
</a>
</template>
<template #actions>
<div :class="sales">
<Button size="sm" variant="secondary">Contact sales</Button>
</div>
<Button size="sm">Get started</Button>
</template>
</Navbar>
</div>
</template><script lang="ts">
import Button from "$lib/components/markas/Button.svelte";
import Navbar from "$lib/components/markas/Navbar.svelte";
const logo = [
{ fill: "fill-ink/15", points: "354,578 1256,138 1171,430 268,868" },
{ fill: "fill-ink/55", points: "553,443 1455,3 1370,295 467,733" },
{ fill: "fill-success/35", points: "421,762 1325,318 1240,611 336,1050" },
{ fill: "fill-ink/30", points: "265,1073 1169,629 1084,922 180,1362" },
{ fill: "fill-ink/80", points: "93,965 997,521 912,814 8,1253" },
{ fill: "fill-success", points: "347,1135 1251,691 1166,984 262,1424" },
];
const links = [
{
label: "Components",
children: [
{
label: "Forms",
href: "/components/forms",
description: "Input, select, checkbox, and more",
icon: "M3 7h18v10H3zM7 12h.01M11 12h6",
},
{
label: "Overlays",
href: "/components/overlays",
description: "Modal, drawer, popover, toast",
icon: "M8 8h12v12H8zM4 16V4h12",
},
{
label: "Navigation",
href: "/components/navigation",
description: "Navbar, sidebar, tabs, menus",
icon: "M12 21a9 9 0 1 0 0-18 9 9 0 0 0 0 18zm4-13-2 6-6 2 2-6z",
},
],
},
{ label: "Templates", href: "/templates", active: true },
{ label: "Docs", href: "/docs" },
{ label: "Pricing", href: "/pricing" },
];
const utilities = [
{ label: "Changelog", href: "/changelog" },
{ label: "GitHub", href: "https://github.com" },
{ label: "Sign in", href: "/login" },
];
const shell = "@container grid";
const strip =
"flex h-9 items-center gap-4 border-b border-line bg-canvas px-4 text-xs text-muted";
const status =
"inline-flex items-center gap-2 rounded-sm hover:text-ink focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary";
const dot = "size-1.5 rounded-full bg-success ring-4 ring-success/20";
const version =
"hidden rounded-full border border-line px-2 py-px @lg:inline";
const utilityNav = "ml-auto flex items-center gap-4";
const utilityLink =
"rounded-sm transition-colors duration-150 ease-out hover:text-ink focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary motion-reduce:transition-none";
const main = "[&>div:first-child]:h-16";
const brandClass = "flex items-center gap-2.5 rounded-md text-base";
const logoClass = "size-7";
const sales = "hidden @3xl:block";
</script>
<div class={shell}>
<div class={strip}>
<a href="/status" class={status}>
<span aria-hidden="true" class={dot}></span>
All systems normal
</a>
<span class={version}>v1.0.0</span>
<nav aria-label="Utilities" class={utilityNav}>
{#each utilities as link (link.href)}
<a href={link.href} class={utilityLink}>{link.label}</a>
{/each}
</nav>
</div>
<Navbar {links} class={main}>
{#snippet brand()}
<a href="/" class={brandClass}>
<svg class={logoClass} viewBox="0 0 1464 1430" aria-hidden="true">
{#each logo as shape (shape.points)}
<polygon class={shape.fill} points={shape.points} />
{/each}
</svg>
<span>MarkasUI</span>
</a>
{/snippet}
{#snippet actions()}
<div class={sales}>
<Button size="sm" variant="secondary">Contact sales</Button>
</div>
<Button size="sm">Get started</Button>
{/snippet}
</Navbar>
</div>---
import Button from "@/components/markas/Button.astro";
import Navbar from "@/components/markas/Navbar.astro";
const logo = [
{ fill: "fill-ink/15", points: "354,578 1256,138 1171,430 268,868" },
{ fill: "fill-ink/55", points: "553,443 1455,3 1370,295 467,733" },
{ fill: "fill-success/35", points: "421,762 1325,318 1240,611 336,1050" },
{ fill: "fill-ink/30", points: "265,1073 1169,629 1084,922 180,1362" },
{ fill: "fill-ink/80", points: "93,965 997,521 912,814 8,1253" },
{ fill: "fill-success", points: "347,1135 1251,691 1166,984 262,1424" },
];
const links = [
{
label: "Components",
children: [
{
label: "Forms",
href: "/components/forms",
description: "Input, select, checkbox, and more",
icon: "M3 7h18v10H3zM7 12h.01M11 12h6",
},
{
label: "Overlays",
href: "/components/overlays",
description: "Modal, drawer, popover, toast",
icon: "M8 8h12v12H8zM4 16V4h12",
},
{
label: "Navigation",
href: "/components/navigation",
description: "Navbar, sidebar, tabs, menus",
icon: "M12 21a9 9 0 1 0 0-18 9 9 0 0 0 0 18zm4-13-2 6-6 2 2-6z",
},
],
},
{ label: "Templates", href: "/templates", active: true },
{ label: "Docs", href: "/docs" },
{ label: "Pricing", href: "/pricing" },
];
const utilities = [
{ label: "Changelog", href: "/changelog" },
{ label: "GitHub", href: "https://github.com" },
{ label: "Sign in", href: "/login" },
];
const shell = "@container grid";
const strip =
"flex h-9 items-center gap-4 border-b border-line bg-canvas px-4 text-xs text-muted";
const status =
"inline-flex items-center gap-2 rounded-sm hover:text-ink focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary";
const dot = "size-1.5 rounded-full bg-success ring-4 ring-success/20";
const version = "hidden rounded-full border border-line px-2 py-px @lg:inline";
const utilityNav = "ml-auto flex items-center gap-4";
const utilityLink =
"rounded-sm transition-colors duration-150 ease-out hover:text-ink focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary motion-reduce:transition-none";
const main = "[&>div:first-child]:h-16";
const brand = "flex items-center gap-2.5 rounded-md text-base";
const logoClass = "size-7";
const sales = "hidden @3xl:block";
---
<div class={shell}>
<div class={strip}>
<a href="/status" class={status}>
<span aria-hidden="true" class={dot}></span>
All systems normal
</a>
<span class={version}>v1.0.0</span>
<nav aria-label="Utilities" class={utilityNav}>
{
utilities.map((link) => (
<a href={link.href} class={utilityLink}>
{link.label}
</a>
))
}
</nav>
</div>
<Navbar links={links} class={main}>
<a slot="brand" href="/" class={brand}>
<svg class={logoClass} viewBox="0 0 1464 1430" aria-hidden="true">
{logo.map((shape) => <polygon class={shape.fill} points={shape.points} />)}
</svg>
<span>MarkasUI</span>
</a>
<Fragment slot="actions">
<div class={sales}>
<Button size="sm" variant="secondary">Contact sales</Button>
</div>
<Button size="sm">Get started</Button>
</Fragment>
</Navbar>
</div>import { Component } from "@angular/core";
import { Button } from "./markas/button.component";
import {
Navbar,
type NavbarLink,
} from "./markas/navbar.component";
const logo = [
{ fill: "fill-ink/15", points: "354,578 1256,138 1171,430 268,868" },
{ fill: "fill-ink/55", points: "553,443 1455,3 1370,295 467,733" },
{ fill: "fill-success/35", points: "421,762 1325,318 1240,611 336,1050" },
{ fill: "fill-ink/30", points: "265,1073 1169,629 1084,922 180,1362" },
{ fill: "fill-ink/80", points: "93,965 997,521 912,814 8,1253" },
{ fill: "fill-success", points: "347,1135 1251,691 1166,984 262,1424" },
];
const links: NavbarLink[] = [
{
label: "Components",
children: [
{
label: "Forms",
href: "/components/forms",
description: "Input, select, checkbox, and more",
icon: "M3 7h18v10H3zM7 12h.01M11 12h6",
},
{
label: "Overlays",
href: "/components/overlays",
description: "Modal, drawer, popover, toast",
icon: "M8 8h12v12H8zM4 16V4h12",
},
{
label: "Navigation",
href: "/components/navigation",
description: "Navbar, sidebar, tabs, menus",
icon: "M12 21a9 9 0 1 0 0-18 9 9 0 0 0 0 18zm4-13-2 6-6 2 2-6z",
},
],
},
{ label: "Templates", href: "/templates", active: true },
{ label: "Docs", href: "/docs" },
{ label: "Pricing", href: "/pricing" },
];
const utilities = [
{ label: "Changelog", href: "/changelog" },
{ label: "GitHub", href: "https://github.com" },
{ label: "Sign in", href: "/login" },
];
const shell = "@container grid";
const strip =
"flex h-9 items-center gap-4 border-b border-line bg-canvas px-4 text-xs text-muted";
const status =
"inline-flex items-center gap-2 rounded-sm hover:text-ink focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary";
const dot = "size-1.5 rounded-full bg-success ring-4 ring-success/20";
const version = "hidden rounded-full border border-line px-2 py-px @lg:inline";
const utilityNav = "ml-auto flex items-center gap-4";
const utilityLink =
"rounded-sm transition-colors duration-150 ease-out hover:text-ink focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary motion-reduce:transition-none";
const main = "[&>div:first-child]:h-16";
const brand = "flex items-center gap-2.5 rounded-md text-base";
const logoClass = "size-7";
const sales = "hidden @3xl:block";
@Component({
selector: "markas-example",
imports: [Button, Navbar],
template: `
<div [class]="shell">
<div [class]="strip">
<a href="/status" [class]="status">
<span aria-hidden="true" [class]="dot"></span>
All systems normal
</a>
<span [class]="version">v1.0.0</span>
<nav aria-label="Utilities" [class]="utilityNav">
@for (link of utilities; track link.href) {
<a [href]="link.href" [class]="utilityLink">{{ link.label }}</a>
}
</nav>
</div>
<header markas-navbar [links]="links" [class]="main">
<a brand href="/" [class]="brand">
<svg
[attr.class]="logoClass"
viewBox="0 0 1464 1430"
aria-hidden="true"
>
@for (shape of logo; track shape.points) {
<polygon [attr.class]="shape.fill" [attr.points]="shape.points" />
}
</svg>
<span>MarkasUI</span>
</a>
<ng-container actions>
<div [class]="sales">
<button markas-button size="sm" variant="secondary">
Contact sales
</button>
</div>
<button markas-button size="sm">Get started</button>
</ng-container>
</header>
</div>
`,
})
export default class NavbarTwoTierExample {
protected readonly logo = logo;
protected readonly links = links;
protected readonly utilities = utilities;
protected readonly shell = shell;
protected readonly strip = strip;
protected readonly status = status;
protected readonly dot = dot;
protected readonly version = version;
protected readonly utilityNav = utilityNav;
protected readonly utilityLink = utilityLink;
protected readonly main = main;
protected readonly brand = brand;
protected readonly logoClass = logoClass;
protected readonly sales = sales;
}Mega menu dengan kartu sorotan
@php
$logo = [
['fill' => 'fill-ink/15', 'points' => '354,578 1256,138 1171,430 268,868'],
['fill' => 'fill-ink/55', 'points' => '553,443 1455,3 1370,295 467,733'],
['fill' => 'fill-success/35', 'points' => '421,762 1325,318 1240,611 336,1050'],
['fill' => 'fill-ink/30', 'points' => '265,1073 1169,629 1084,922 180,1362'],
['fill' => 'fill-ink/80', 'points' => '93,965 997,521 912,814 8,1253'],
['fill' => 'fill-success', 'points' => '347,1135 1251,691 1166,984 262,1424'],
];
$product = [
[
'label' => 'Components',
'href' => '/components',
'description' => '61 accessible building blocks',
'icon' => 'M4 4h7v7H4zm9 0h7v7h-7zM4 13h7v7H4zm9 3.5a3.5 3.5 0 1 0 7 0 3.5 3.5 0 0 0-7 0z',
],
[
'label' => 'Templates',
'href' => '/templates',
'description' => 'Full pages you can ship today',
'icon' => 'M3 4h18v6H3zM3 14h8v6H3zm12 0h6v6h-6z',
],
[
'label' => 'CLI',
'href' => '/docs/cli',
'description' => 'Add components with one command',
'icon' => 'm4 17 6-5-6-5m8 12h8',
],
[
'label' => 'MCP server',
'href' => '/docs/mcp',
'description' => 'Let your editor agent install them',
'icon' => 'M12 8V4H8M4 12a8 8 0 0 0 8 8h8v-8a8 8 0 0 0-8-8M9 13h.01M15 13h.01',
],
];
$resources = [
[
'label' => 'Documentation',
'href' => '/docs',
'description' => 'Guides and API reference',
'icon' => 'M4 19.5V5a2 2 0 0 1 2-2h14v16H6.5a2.5 2.5 0 0 0 0 5H20',
],
[
'label' => 'Changelog',
'href' => '/changelog',
'description' => 'What shipped this week',
'icon' => 'M12 7v5l3 2M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0z',
],
[
'label' => 'Community',
'href' => '/community',
'description' => 'Ask and share on GitHub',
'icon' => 'M17 20v-2a4 4 0 0 0-4-4H7a4 4 0 0 0-4 4v2M10 10a4 4 0 1 0 0-8 4 4 0 0 0 0 8zm11 10v-2a4 4 0 0 0-3-3.9M16 2.1a4 4 0 0 1 0 7.8',
],
[
'label' => 'Showcase',
'href' => '/showcase',
'description' => 'Sites built with MarkasUI',
'icon' => 'M2 12s3.5-7 10-7 10 7 10 7-3.5 7-10 7S2 12 2 12zm10 3a3 3 0 1 0 0-6 3 3 0 0 0 0 6z',
],
];
$items = [
[
'label' => 'Product',
'featured' => [
'title' => 'MarkasUI 1.0',
'href' => '/changelog/1-0',
'description' => 'Blade, React, and Vue from one set of classes',
],
'links' => [
[
'label' => 'Components',
'href' => '/components',
'description' => '61 accessible building blocks',
'icon' => 'M4 4h7v7H4zm9 0h7v7h-7zM4 13h7v7H4zm9 3.5a3.5 3.5 0 1 0 7 0 3.5 3.5 0 0 0-7 0z',
],
[
'label' => 'Templates',
'href' => '/templates',
'description' => 'Full pages you can ship today',
'icon' => 'M3 4h18v6H3zM3 14h8v6H3zm12 0h6v6h-6z',
],
[
'label' => 'CLI',
'href' => '/docs/cli',
'description' => 'Add components with one command',
'icon' => 'm4 17 6-5-6-5m8 12h8',
],
[
'label' => 'MCP server',
'href' => '/docs/mcp',
'description' => 'Let your editor agent install them',
'icon' => 'M12 8V4H8M4 12a8 8 0 0 0 8 8h8v-8a8 8 0 0 0-8-8M9 13h.01M15 13h.01',
],
],
],
[
'label' => 'Resources',
'featured' => [
'title' => 'Start in five minutes',
'href' => '/docs/installation',
'description' => 'Install the CLI and add your first component',
],
'links' => [
[
'label' => 'Documentation',
'href' => '/docs',
'description' => 'Guides and API reference',
'icon' => 'M4 19.5V5a2 2 0 0 1 2-2h14v16H6.5a2.5 2.5 0 0 0 0 5H20',
],
[
'label' => 'Changelog',
'href' => '/changelog',
'description' => 'What shipped this week',
'icon' => 'M12 7v5l3 2M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0z',
],
[
'label' => 'Community',
'href' => '/community',
'description' => 'Ask and share on GitHub',
'icon' => 'M17 20v-2a4 4 0 0 0-4-4H7a4 4 0 0 0-4 4v2M10 10a4 4 0 1 0 0-8 4 4 0 0 0 0 8zm11 10v-2a4 4 0 0 0-3-3.9M16 2.1a4 4 0 0 1 0 7.8',
],
[
'label' => 'Showcase',
'href' => '/showcase',
'description' => 'Sites built with MarkasUI',
'icon' => 'M2 12s3.5-7 10-7 10 7 10 7-3.5 7-10 7S2 12 2 12zm10 3a3 3 0 1 0 0-6 3 3 0 0 0 0 6z',
],
],
],
['label' => 'Pricing', 'href' => '/pricing'],
];
$links = [
[
'label' => 'Product',
'children' => [
[
'label' => 'Components',
'href' => '/components',
'description' => '61 accessible building blocks',
'icon' => 'M4 4h7v7H4zm9 0h7v7h-7zM4 13h7v7H4zm9 3.5a3.5 3.5 0 1 0 7 0 3.5 3.5 0 0 0-7 0z',
],
[
'label' => 'Templates',
'href' => '/templates',
'description' => 'Full pages you can ship today',
'icon' => 'M3 4h18v6H3zM3 14h8v6H3zm12 0h6v6h-6z',
],
[
'label' => 'CLI',
'href' => '/docs/cli',
'description' => 'Add components with one command',
'icon' => 'm4 17 6-5-6-5m8 12h8',
],
[
'label' => 'MCP server',
'href' => '/docs/mcp',
'description' => 'Let your editor agent install them',
'icon' => 'M12 8V4H8M4 12a8 8 0 0 0 8 8h8v-8a8 8 0 0 0-8-8M9 13h.01M15 13h.01',
],
],
],
[
'label' => 'Resources',
'children' => [
[
'label' => 'Documentation',
'href' => '/docs',
'description' => 'Guides and API reference',
'icon' => 'M4 19.5V5a2 2 0 0 1 2-2h14v16H6.5a2.5 2.5 0 0 0 0 5H20',
],
[
'label' => 'Changelog',
'href' => '/changelog',
'description' => 'What shipped this week',
'icon' => 'M12 7v5l3 2M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0z',
],
[
'label' => 'Community',
'href' => '/community',
'description' => 'Ask and share on GitHub',
'icon' => 'M17 20v-2a4 4 0 0 0-4-4H7a4 4 0 0 0-4 4v2M10 10a4 4 0 1 0 0-8 4 4 0 0 0 0 8zm11 10v-2a4 4 0 0 0-3-3.9M16 2.1a4 4 0 0 1 0 7.8',
],
[
'label' => 'Showcase',
'href' => '/showcase',
'description' => 'Sites built with MarkasUI',
'icon' => 'M2 12s3.5-7 10-7 10 7 10 7-3.5 7-10 7S2 12 2 12zm10 3a3 3 0 1 0 0-6 3 3 0 0 0 0 6z',
],
],
],
['label' => 'Pricing', 'href' => '/pricing'],
];
$layout = '@2xl:[&>div>nav]:hidden';
$brand = 'flex items-center gap-2 rounded-md';
$logoClass = 'size-6';
$menu = 'hidden pl-3 font-normal @2xl:block';
$glow = '[&_[popover]>a]:bg-[radial-gradient(120%_90%_at_100%_0%,color-mix(in_oklab,var(--color-success)_55%,transparent),transparent_65%)]';
$signIn = 'hidden @lg:block';
@endphp
<x-markas.navbar :links="$links" class="{{ $layout }}">
<x-slot:brand>
<a href="/" class="{{ $brand }}">
<svg class="{{ $logoClass }}" viewBox="0 0 1464 1430" aria-hidden="true">
@foreach ($logo as $shape)
<polygon class="{{ $shape['fill'] }}" points="{{ $shape['points'] }}" />
@endforeach
</svg>
<span>MarkasUI</span>
</a>
<div class="{{ $menu }}">
<x-markas.navigation-menu :items="$items" class="{{ $glow }}" />
</div>
</x-slot:brand>
<x-slot:actions>
<div class="{{ $signIn }}">
<x-markas.button size="sm" variant="ghost">Sign in</x-markas.button>
</div>
<x-markas.button size="sm">Start building</x-markas.button>
</x-slot:actions>
</x-markas.navbar>import { Button } from "@/components/markas/Button";
import { Navbar } from "@/components/markas/Navbar";
import { NavigationMenu } from "@/components/markas/NavigationMenu";
const logo = [
{ fill: "fill-ink/15", points: "354,578 1256,138 1171,430 268,868" },
{ fill: "fill-ink/55", points: "553,443 1455,3 1370,295 467,733" },
{ fill: "fill-success/35", points: "421,762 1325,318 1240,611 336,1050" },
{ fill: "fill-ink/30", points: "265,1073 1169,629 1084,922 180,1362" },
{ fill: "fill-ink/80", points: "93,965 997,521 912,814 8,1253" },
{ fill: "fill-success", points: "347,1135 1251,691 1166,984 262,1424" },
];
const product = [
{
label: "Components",
href: "/components",
description: "61 accessible building blocks",
icon: "M4 4h7v7H4zm9 0h7v7h-7zM4 13h7v7H4zm9 3.5a3.5 3.5 0 1 0 7 0 3.5 3.5 0 0 0-7 0z",
},
{
label: "Templates",
href: "/templates",
description: "Full pages you can ship today",
icon: "M3 4h18v6H3zM3 14h8v6H3zm12 0h6v6h-6z",
},
{
label: "CLI",
href: "/docs/cli",
description: "Add components with one command",
icon: "m4 17 6-5-6-5m8 12h8",
},
{
label: "MCP server",
href: "/docs/mcp",
description: "Let your editor agent install them",
icon: "M12 8V4H8M4 12a8 8 0 0 0 8 8h8v-8a8 8 0 0 0-8-8M9 13h.01M15 13h.01",
},
];
const resources = [
{
label: "Documentation",
href: "/docs",
description: "Guides and API reference",
icon: "M4 19.5V5a2 2 0 0 1 2-2h14v16H6.5a2.5 2.5 0 0 0 0 5H20",
},
{
label: "Changelog",
href: "/changelog",
description: "What shipped this week",
icon: "M12 7v5l3 2M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0z",
},
{
label: "Community",
href: "/community",
description: "Ask and share on GitHub",
icon: "M17 20v-2a4 4 0 0 0-4-4H7a4 4 0 0 0-4 4v2M10 10a4 4 0 1 0 0-8 4 4 0 0 0 0 8zm11 10v-2a4 4 0 0 0-3-3.9M16 2.1a4 4 0 0 1 0 7.8",
},
{
label: "Showcase",
href: "/showcase",
description: "Sites built with MarkasUI",
icon: "M2 12s3.5-7 10-7 10 7 10 7-3.5 7-10 7S2 12 2 12zm10 3a3 3 0 1 0 0-6 3 3 0 0 0 0 6z",
},
];
const items = [
{
label: "Product",
featured: {
title: "MarkasUI 1.0",
href: "/changelog/1-0",
description: "Blade, React, and Vue from one set of classes",
},
links: product,
},
{
label: "Resources",
featured: {
title: "Start in five minutes",
href: "/docs/installation",
description: "Install the CLI and add your first component",
},
links: resources,
},
{ label: "Pricing", href: "/pricing" },
];
/** The same entries as Navbar links, used by the mobile menu below 42rem. */
const links = [
{ label: "Product", children: product },
{ label: "Resources", children: resources },
{ label: "Pricing", href: "/pricing" },
];
/** From 42rem NavigationMenu takes over and the built in desktop links hide. */
const layout = "@2xl:[&>div>nav]:hidden";
const brand = "flex items-center gap-2 rounded-md";
const logoClass = "size-6";
const menu = "hidden pl-3 font-normal @2xl:block";
/** A soft glow on the featured card, which is the only link placed directly in a panel. */
const glow =
"[&_[popover]>a]:bg-[radial-gradient(120%_90%_at_100%_0%,color-mix(in_oklab,var(--color-success)_55%,transparent),transparent_65%)]";
const signIn = "hidden @lg:block";
export default function Example() {
return (
<Navbar
links={links}
className={layout}
brand={
<>
<a href="/" className={brand}>
<svg
className={logoClass}
viewBox="0 0 1464 1430"
aria-hidden="true"
>
{logo.map((shape) => (
<polygon
key={shape.points}
className={shape.fill}
points={shape.points}
/>
))}
</svg>
<span>MarkasUI</span>
</a>
<div className={menu}>
<NavigationMenu items={items} className={glow} />
</div>
</>
}
actions={
<>
<div className={signIn}>
<Button size="sm" variant="ghost">
Sign in
</Button>
</div>
<Button size="sm">Start building</Button>
</>
}
/>
);
}<script setup lang="ts">
import Button from "@/components/markas/Button.vue";
import Navbar from "@/components/markas/Navbar.vue";
import NavigationMenu from "@/components/markas/NavigationMenu.vue";
const logo = [
{ fill: "fill-ink/15", points: "354,578 1256,138 1171,430 268,868" },
{ fill: "fill-ink/55", points: "553,443 1455,3 1370,295 467,733" },
{ fill: "fill-success/35", points: "421,762 1325,318 1240,611 336,1050" },
{ fill: "fill-ink/30", points: "265,1073 1169,629 1084,922 180,1362" },
{ fill: "fill-ink/80", points: "93,965 997,521 912,814 8,1253" },
{ fill: "fill-success", points: "347,1135 1251,691 1166,984 262,1424" },
];
const product = [
{
label: "Components",
href: "/components",
description: "61 accessible building blocks",
icon: "M4 4h7v7H4zm9 0h7v7h-7zM4 13h7v7H4zm9 3.5a3.5 3.5 0 1 0 7 0 3.5 3.5 0 0 0-7 0z",
},
{
label: "Templates",
href: "/templates",
description: "Full pages you can ship today",
icon: "M3 4h18v6H3zM3 14h8v6H3zm12 0h6v6h-6z",
},
{
label: "CLI",
href: "/docs/cli",
description: "Add components with one command",
icon: "m4 17 6-5-6-5m8 12h8",
},
{
label: "MCP server",
href: "/docs/mcp",
description: "Let your editor agent install them",
icon: "M12 8V4H8M4 12a8 8 0 0 0 8 8h8v-8a8 8 0 0 0-8-8M9 13h.01M15 13h.01",
},
];
const resources = [
{
label: "Documentation",
href: "/docs",
description: "Guides and API reference",
icon: "M4 19.5V5a2 2 0 0 1 2-2h14v16H6.5a2.5 2.5 0 0 0 0 5H20",
},
{
label: "Changelog",
href: "/changelog",
description: "What shipped this week",
icon: "M12 7v5l3 2M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0z",
},
{
label: "Community",
href: "/community",
description: "Ask and share on GitHub",
icon: "M17 20v-2a4 4 0 0 0-4-4H7a4 4 0 0 0-4 4v2M10 10a4 4 0 1 0 0-8 4 4 0 0 0 0 8zm11 10v-2a4 4 0 0 0-3-3.9M16 2.1a4 4 0 0 1 0 7.8",
},
{
label: "Showcase",
href: "/showcase",
description: "Sites built with MarkasUI",
icon: "M2 12s3.5-7 10-7 10 7 10 7-3.5 7-10 7S2 12 2 12zm10 3a3 3 0 1 0 0-6 3 3 0 0 0 0 6z",
},
];
const items = [
{
label: "Product",
featured: {
title: "MarkasUI 1.0",
href: "/changelog/1-0",
description: "Blade, React, and Vue from one set of classes",
},
links: product,
},
{
label: "Resources",
featured: {
title: "Start in five minutes",
href: "/docs/installation",
description: "Install the CLI and add your first component",
},
links: resources,
},
{ label: "Pricing", href: "/pricing" },
];
/** The same entries as Navbar links, used by the mobile menu below 42rem. */
const links = [
{ label: "Product", children: product },
{ label: "Resources", children: resources },
{ label: "Pricing", href: "/pricing" },
];
/** From 42rem NavigationMenu takes over and the built in desktop links hide. */
const layout = "@2xl:[&>div>nav]:hidden";
const brand = "flex items-center gap-2 rounded-md";
const logoClass = "size-6";
const menu = "hidden pl-3 font-normal @2xl:block";
/** A soft glow on the featured card, which is the only link placed directly in a panel. */
const glow =
"[&_[popover]>a]:bg-[radial-gradient(120%_90%_at_100%_0%,color-mix(in_oklab,var(--color-success)_55%,transparent),transparent_65%)]";
const signIn = "hidden @lg:block";
</script>
<template>
<Navbar :links="links" :class="layout">
<template #brand>
<a href="/" :class="brand">
<svg :class="logoClass" viewBox="0 0 1464 1430" aria-hidden="true">
<polygon
v-for="shape in logo"
:key="shape.points"
:class="shape.fill"
:points="shape.points"
/>
</svg>
<span>MarkasUI</span>
</a>
<div :class="menu">
<NavigationMenu :items="items" :class="glow" />
</div>
</template>
<template #actions>
<div :class="signIn">
<Button size="sm" variant="ghost">Sign in</Button>
</div>
<Button size="sm">Start building</Button>
</template>
</Navbar>
</template><script lang="ts">
import Button from "$lib/components/markas/Button.svelte";
import Navbar from "$lib/components/markas/Navbar.svelte";
import NavigationMenu from "$lib/components/markas/NavigationMenu.svelte";
const logo = [
{ fill: "fill-ink/15", points: "354,578 1256,138 1171,430 268,868" },
{ fill: "fill-ink/55", points: "553,443 1455,3 1370,295 467,733" },
{ fill: "fill-success/35", points: "421,762 1325,318 1240,611 336,1050" },
{ fill: "fill-ink/30", points: "265,1073 1169,629 1084,922 180,1362" },
{ fill: "fill-ink/80", points: "93,965 997,521 912,814 8,1253" },
{ fill: "fill-success", points: "347,1135 1251,691 1166,984 262,1424" },
];
const product = [
{
label: "Components",
href: "/components",
description: "61 accessible building blocks",
icon: "M4 4h7v7H4zm9 0h7v7h-7zM4 13h7v7H4zm9 3.5a3.5 3.5 0 1 0 7 0 3.5 3.5 0 0 0-7 0z",
},
{
label: "Templates",
href: "/templates",
description: "Full pages you can ship today",
icon: "M3 4h18v6H3zM3 14h8v6H3zm12 0h6v6h-6z",
},
{
label: "CLI",
href: "/docs/cli",
description: "Add components with one command",
icon: "m4 17 6-5-6-5m8 12h8",
},
{
label: "MCP server",
href: "/docs/mcp",
description: "Let your editor agent install them",
icon: "M12 8V4H8M4 12a8 8 0 0 0 8 8h8v-8a8 8 0 0 0-8-8M9 13h.01M15 13h.01",
},
];
const resources = [
{
label: "Documentation",
href: "/docs",
description: "Guides and API reference",
icon: "M4 19.5V5a2 2 0 0 1 2-2h14v16H6.5a2.5 2.5 0 0 0 0 5H20",
},
{
label: "Changelog",
href: "/changelog",
description: "What shipped this week",
icon: "M12 7v5l3 2M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0z",
},
{
label: "Community",
href: "/community",
description: "Ask and share on GitHub",
icon: "M17 20v-2a4 4 0 0 0-4-4H7a4 4 0 0 0-4 4v2M10 10a4 4 0 1 0 0-8 4 4 0 0 0 0 8zm11 10v-2a4 4 0 0 0-3-3.9M16 2.1a4 4 0 0 1 0 7.8",
},
{
label: "Showcase",
href: "/showcase",
description: "Sites built with MarkasUI",
icon: "M2 12s3.5-7 10-7 10 7 10 7-3.5 7-10 7S2 12 2 12zm10 3a3 3 0 1 0 0-6 3 3 0 0 0 0 6z",
},
];
const items = [
{
label: "Product",
featured: {
title: "MarkasUI 1.0",
href: "/changelog/1-0",
description: "Blade, React, and Vue from one set of classes",
},
links: product,
},
{
label: "Resources",
featured: {
title: "Start in five minutes",
href: "/docs/installation",
description: "Install the CLI and add your first component",
},
links: resources,
},
{ label: "Pricing", href: "/pricing" },
];
/** The same entries as Navbar links, used by the mobile menu below 42rem. */
const links = [
{ label: "Product", children: product },
{ label: "Resources", children: resources },
{ label: "Pricing", href: "/pricing" },
];
/** From 42rem NavigationMenu takes over and the built in desktop links hide. */
const layout = "@2xl:[&>div>nav]:hidden";
const brandClass = "flex items-center gap-2 rounded-md";
const logoClass = "size-6";
const menu = "hidden pl-3 font-normal @2xl:block";
/** A soft glow on the featured card, which is the only link placed directly in a panel. */
const glow =
"[&_[popover]>a]:bg-[radial-gradient(120%_90%_at_100%_0%,color-mix(in_oklab,var(--color-success)_55%,transparent),transparent_65%)]";
const signIn = "hidden @lg:block";
</script>
<Navbar {links} class={layout}>
{#snippet brand()}
<a href="/" class={brandClass}>
<svg class={logoClass} viewBox="0 0 1464 1430" aria-hidden="true">
{#each logo as shape (shape.points)}
<polygon class={shape.fill} points={shape.points} />
{/each}
</svg>
<span>MarkasUI</span>
</a>
<div class={menu}>
<NavigationMenu {items} class={glow} />
</div>
{/snippet}
{#snippet actions()}
<div class={signIn}>
<Button size="sm" variant="ghost">Sign in</Button>
</div>
<Button size="sm">Start building</Button>
{/snippet}
</Navbar>---
import Button from "@/components/markas/Button.astro";
import Navbar from "@/components/markas/Navbar.astro";
import NavigationMenu from "@/components/markas/NavigationMenu.astro";
const logo = [
{ fill: "fill-ink/15", points: "354,578 1256,138 1171,430 268,868" },
{ fill: "fill-ink/55", points: "553,443 1455,3 1370,295 467,733" },
{ fill: "fill-success/35", points: "421,762 1325,318 1240,611 336,1050" },
{ fill: "fill-ink/30", points: "265,1073 1169,629 1084,922 180,1362" },
{ fill: "fill-ink/80", points: "93,965 997,521 912,814 8,1253" },
{ fill: "fill-success", points: "347,1135 1251,691 1166,984 262,1424" },
];
const product = [
{
label: "Components",
href: "/components",
description: "61 accessible building blocks",
icon: "M4 4h7v7H4zm9 0h7v7h-7zM4 13h7v7H4zm9 3.5a3.5 3.5 0 1 0 7 0 3.5 3.5 0 0 0-7 0z",
},
{
label: "Templates",
href: "/templates",
description: "Full pages you can ship today",
icon: "M3 4h18v6H3zM3 14h8v6H3zm12 0h6v6h-6z",
},
{
label: "CLI",
href: "/docs/cli",
description: "Add components with one command",
icon: "m4 17 6-5-6-5m8 12h8",
},
{
label: "MCP server",
href: "/docs/mcp",
description: "Let your editor agent install them",
icon: "M12 8V4H8M4 12a8 8 0 0 0 8 8h8v-8a8 8 0 0 0-8-8M9 13h.01M15 13h.01",
},
];
const resources = [
{
label: "Documentation",
href: "/docs",
description: "Guides and API reference",
icon: "M4 19.5V5a2 2 0 0 1 2-2h14v16H6.5a2.5 2.5 0 0 0 0 5H20",
},
{
label: "Changelog",
href: "/changelog",
description: "What shipped this week",
icon: "M12 7v5l3 2M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0z",
},
{
label: "Community",
href: "/community",
description: "Ask and share on GitHub",
icon: "M17 20v-2a4 4 0 0 0-4-4H7a4 4 0 0 0-4 4v2M10 10a4 4 0 1 0 0-8 4 4 0 0 0 0 8zm11 10v-2a4 4 0 0 0-3-3.9M16 2.1a4 4 0 0 1 0 7.8",
},
{
label: "Showcase",
href: "/showcase",
description: "Sites built with MarkasUI",
icon: "M2 12s3.5-7 10-7 10 7 10 7-3.5 7-10 7S2 12 2 12zm10 3a3 3 0 1 0 0-6 3 3 0 0 0 0 6z",
},
];
const items = [
{
label: "Product",
featured: {
title: "MarkasUI 1.0",
href: "/changelog/1-0",
description: "Blade, React, and Vue from one set of classes",
},
links: product,
},
{
label: "Resources",
featured: {
title: "Start in five minutes",
href: "/docs/installation",
description: "Install the CLI and add your first component",
},
links: resources,
},
{ label: "Pricing", href: "/pricing" },
];
/** The same entries as Navbar links, used by the mobile menu below 42rem. */
const links = [
{ label: "Product", children: product },
{ label: "Resources", children: resources },
{ label: "Pricing", href: "/pricing" },
];
/** From 42rem NavigationMenu takes over and the built in desktop links hide. */
const layout = "@2xl:[&>div>nav]:hidden";
const brand = "flex items-center gap-2 rounded-md";
const logoClass = "size-6";
const menu = "hidden pl-3 font-normal @2xl:block";
/** A soft glow on the featured card, which is the only link placed directly in a panel. */
const glow =
"[&_[popover]>a]:bg-[radial-gradient(120%_90%_at_100%_0%,color-mix(in_oklab,var(--color-success)_55%,transparent),transparent_65%)]";
const signIn = "hidden @lg:block";
---
<Navbar links={links} class={layout}>
<Fragment slot="brand">
<a href="/" class={brand}>
<svg class={logoClass} viewBox="0 0 1464 1430" aria-hidden="true">
{logo.map((shape) => <polygon class={shape.fill} points={shape.points} />)}
</svg>
<span>MarkasUI</span>
</a>
<div class={menu}>
<NavigationMenu items={items} class={glow} />
</div>
</Fragment>
<Fragment slot="actions">
<div class={signIn}>
<Button size="sm" variant="ghost">Sign in</Button>
</div>
<Button size="sm">Start building</Button>
</Fragment>
</Navbar>import { Component } from "@angular/core";
import { Button } from "./markas/button.component";
import {
Navbar,
type NavbarLink,
} from "./markas/navbar.component";
import {
NavigationMenu,
type NavigationMenuItem,
} from "./markas/navigation-menu.component";
const logo = [
{ fill: "fill-ink/15", points: "354,578 1256,138 1171,430 268,868" },
{ fill: "fill-ink/55", points: "553,443 1455,3 1370,295 467,733" },
{ fill: "fill-success/35", points: "421,762 1325,318 1240,611 336,1050" },
{ fill: "fill-ink/30", points: "265,1073 1169,629 1084,922 180,1362" },
{ fill: "fill-ink/80", points: "93,965 997,521 912,814 8,1253" },
{ fill: "fill-success", points: "347,1135 1251,691 1166,984 262,1424" },
];
const product = [
{
label: "Components",
href: "/components",
description: "61 accessible building blocks",
icon: "M4 4h7v7H4zm9 0h7v7h-7zM4 13h7v7H4zm9 3.5a3.5 3.5 0 1 0 7 0 3.5 3.5 0 0 0-7 0z",
},
{
label: "Templates",
href: "/templates",
description: "Full pages you can ship today",
icon: "M3 4h18v6H3zM3 14h8v6H3zm12 0h6v6h-6z",
},
{
label: "CLI",
href: "/docs/cli",
description: "Add components with one command",
icon: "m4 17 6-5-6-5m8 12h8",
},
{
label: "MCP server",
href: "/docs/mcp",
description: "Let your editor agent install them",
icon: "M12 8V4H8M4 12a8 8 0 0 0 8 8h8v-8a8 8 0 0 0-8-8M9 13h.01M15 13h.01",
},
];
const resources = [
{
label: "Documentation",
href: "/docs",
description: "Guides and API reference",
icon: "M4 19.5V5a2 2 0 0 1 2-2h14v16H6.5a2.5 2.5 0 0 0 0 5H20",
},
{
label: "Changelog",
href: "/changelog",
description: "What shipped this week",
icon: "M12 7v5l3 2M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0z",
},
{
label: "Community",
href: "/community",
description: "Ask and share on GitHub",
icon: "M17 20v-2a4 4 0 0 0-4-4H7a4 4 0 0 0-4 4v2M10 10a4 4 0 1 0 0-8 4 4 0 0 0 0 8zm11 10v-2a4 4 0 0 0-3-3.9M16 2.1a4 4 0 0 1 0 7.8",
},
{
label: "Showcase",
href: "/showcase",
description: "Sites built with MarkasUI",
icon: "M2 12s3.5-7 10-7 10 7 10 7-3.5 7-10 7S2 12 2 12zm10 3a3 3 0 1 0 0-6 3 3 0 0 0 0 6z",
},
];
const items: NavigationMenuItem[] = [
{
label: "Product",
featured: {
title: "MarkasUI 1.0",
href: "/changelog/1-0",
description: "Blade, React, and Vue from one set of classes",
},
links: product,
},
{
label: "Resources",
featured: {
title: "Start in five minutes",
href: "/docs/installation",
description: "Install the CLI and add your first component",
},
links: resources,
},
{ label: "Pricing", href: "/pricing" },
];
/** The same entries as Navbar links, used by the mobile menu below 42rem. */
const links: NavbarLink[] = [
{ label: "Product", children: product },
{ label: "Resources", children: resources },
{ label: "Pricing", href: "/pricing" },
];
/** From 42rem NavigationMenu takes over and the built in desktop links hide. */
const layout = "@2xl:[&>div>nav]:hidden";
const brand = "flex items-center gap-2 rounded-md";
const logoClass = "size-6";
const menu = "hidden pl-3 font-normal @2xl:block";
/** A soft glow on the featured card, which is the only link placed directly in a panel. */
const glow =
"[&_[popover]>a]:bg-[radial-gradient(120%_90%_at_100%_0%,color-mix(in_oklab,var(--color-success)_55%,transparent),transparent_65%)]";
const signIn = "hidden @lg:block";
@Component({
selector: "markas-example",
imports: [Button, Navbar, NavigationMenu],
template: `
<header markas-navbar [links]="links" [class]="layout">
<ng-container brand>
<a href="/" [class]="brand">
<svg
[attr.class]="logoClass"
viewBox="0 0 1464 1430"
aria-hidden="true"
>
@for (shape of logo; track shape.points) {
<polygon [attr.class]="shape.fill" [attr.points]="shape.points" />
}
</svg>
<span>MarkasUI</span>
</a>
<div [class]="menu">
<markas-navigation-menu [items]="items" [class]="glow" />
</div>
</ng-container>
<ng-container actions>
<div [class]="signIn">
<button markas-button size="sm" variant="ghost">Sign in</button>
</div>
<button markas-button size="sm">Start building</button>
</ng-container>
</header>
`,
})
export default class NavbarMegaExample {
protected readonly logo = logo;
protected readonly product = product;
protected readonly resources = resources;
protected readonly items = items;
protected readonly links = links;
protected readonly layout = layout;
protected readonly brand = brand;
protected readonly logoClass = logoClass;
protected readonly menu = menu;
protected readonly glow = glow;
protected readonly signIn = signIn;
}Header dashboard
@php
$logo = [
['fill' => 'fill-ink/15', 'points' => '354,578 1256,138 1171,430 268,868'],
['fill' => 'fill-ink/55', 'points' => '553,443 1455,3 1370,295 467,733'],
['fill' => 'fill-success/35', 'points' => '421,762 1325,318 1240,611 336,1050'],
['fill' => 'fill-ink/30', 'points' => '265,1073 1169,629 1084,922 180,1362'],
['fill' => 'fill-ink/80', 'points' => '93,965 997,521 912,814 8,1253'],
['fill' => 'fill-success', 'points' => '347,1135 1251,691 1166,984 262,1424'],
];
$links = [
['label' => 'Overview', 'href' => '/overview', 'active' => true],
['label' => 'Deployments', 'href' => '/deployments'],
['label' => 'Analytics', 'href' => '/analytics'],
['label' => 'Settings', 'href' => '/settings'],
];
$path = [
['label' => 'Markas', 'href' => '/team'],
['label' => 'docs'],
];
$account = [
['label' => 'Profile', 'href' => '/profile'],
['label' => 'Settings', 'href' => '/settings'],
['label' => 'Billing', 'href' => '/billing'],
['separator' => true],
['label' => 'Sign out', 'value' => 'sign-out', 'danger' => true],
];
$home = 'rounded-md';
$logoClass = 'size-6';
$slash = 'hidden size-5 text-line @md:block';
$crumbs = 'font-normal @max-xs:hidden';
$bell = 'relative size-9 px-0!';
$icon = 'size-5';
$count = 'absolute top-1 right-1 grid h-4 min-w-4 place-items-center rounded-full bg-danger px-1 text-[10px] font-semibold text-on-primary ring-2 ring-surface';
$profile = '[&>button]:h-9 [&>button]:gap-1 [&>button]:border-0 [&>button]:px-1';
@endphp
<x-markas.navbar :links="$links">
<x-slot:brand>
<a href="/" aria-label="MarkasUI home" class="{{ $home }}">
<svg class="{{ $logoClass }}" viewBox="0 0 1464 1430" aria-hidden="true">
@foreach ($logo as $shape)
<polygon class="{{ $shape['fill'] }}" points="{{ $shape['points'] }}" />
@endforeach
</svg>
</a>
<svg class="{{ $slash }}" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" aria-hidden="true"><path d="M16 3 8 21" /></svg>
<x-markas.breadcrumb :items="$path" class="{{ $crumbs }}" />
</x-slot:brand>
<x-slot:actions>
<x-markas.button variant="ghost" aria-label="Notifications, 3 unread" class="{{ $bell }}">
<svg class="{{ $icon }}" 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 8a6 6 0 1 1 12 0c0 7 3 9 3 9H3s3-2 3-9" /><path d="M10.3 21a1.94 1.94 0 0 0 3.4 0" /></svg>
<span aria-hidden="true" class="{{ $count }}">3</span>
</x-markas.button>
<x-markas.dropdown-menu label="Account" :items="$account" class="{{ $profile }}">
<x-slot:trigger><x-markas.avatar name="Siti Aminah" size="sm" /></x-slot:trigger>
</x-markas.dropdown-menu>
</x-slot:actions>
</x-markas.navbar>import { Avatar } from "@/components/markas/Avatar";
import { Breadcrumb } from "@/components/markas/Breadcrumb";
import { Button } from "@/components/markas/Button";
import { DropdownMenu } from "@/components/markas/DropdownMenu";
import { Navbar } from "@/components/markas/Navbar";
const logo = [
{ fill: "fill-ink/15", points: "354,578 1256,138 1171,430 268,868" },
{ fill: "fill-ink/55", points: "553,443 1455,3 1370,295 467,733" },
{ fill: "fill-success/35", points: "421,762 1325,318 1240,611 336,1050" },
{ fill: "fill-ink/30", points: "265,1073 1169,629 1084,922 180,1362" },
{ fill: "fill-ink/80", points: "93,965 997,521 912,814 8,1253" },
{ fill: "fill-success", points: "347,1135 1251,691 1166,984 262,1424" },
];
const links = [
{ label: "Overview", href: "/overview", active: true },
{ label: "Deployments", href: "/deployments" },
{ label: "Analytics", href: "/analytics" },
{ label: "Settings", href: "/settings" },
];
const path = [{ label: "Markas", href: "/team" }, { label: "docs" }];
const account = [
{ label: "Profile", href: "/profile" },
{ label: "Settings", href: "/settings" },
{ label: "Billing", href: "/billing" },
{ separator: true as const },
{ label: "Sign out", value: "sign-out", danger: true },
];
const home = "rounded-md";
const logoClass = "size-6";
const slash = "hidden size-5 text-line @md:block";
const crumbs = "font-normal @max-xs:hidden";
const bell = "relative size-9 px-0!";
const icon = "size-5";
const count =
"absolute top-1 right-1 grid h-4 min-w-4 place-items-center rounded-full bg-danger px-1 text-[10px] font-semibold text-on-primary ring-2 ring-surface";
const profile =
"[&>button]:h-9 [&>button]:gap-1 [&>button]:border-0 [&>button]:px-1";
export default function Example() {
return (
<Navbar
links={links}
brand={
<>
<a href="/" aria-label="MarkasUI home" className={home}>
<svg
className={logoClass}
viewBox="0 0 1464 1430"
aria-hidden="true"
>
{logo.map((shape) => (
<polygon
key={shape.points}
className={shape.fill}
points={shape.points}
/>
))}
</svg>
</a>
<svg
className={slash}
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
strokeWidth="1.5"
strokeLinecap="round"
aria-hidden="true"
>
<path d="M16 3 8 21" />
</svg>
<Breadcrumb items={path} className={crumbs} />
</>
}
actions={
<>
<Button
variant="ghost"
aria-label="Notifications, 3 unread"
className={bell}
>
<svg
className={icon}
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
strokeWidth="1.5"
strokeLinecap="round"
strokeLinejoin="round"
aria-hidden="true"
>
<path d="M6 8a6 6 0 1 1 12 0c0 7 3 9 3 9H3s3-2 3-9" />
<path d="M10.3 21a1.94 1.94 0 0 0 3.4 0" />
</svg>
<span aria-hidden="true" className={count}>
3
</span>
</Button>
<DropdownMenu
label="Account"
items={account}
trigger={<Avatar name="Siti Aminah" size="sm" />}
className={profile}
/>
</>
}
/>
);
}<script setup lang="ts">
import Avatar from "@/components/markas/Avatar.vue";
import Breadcrumb from "@/components/markas/Breadcrumb.vue";
import Button from "@/components/markas/Button.vue";
import DropdownMenu from "@/components/markas/DropdownMenu.vue";
import Navbar from "@/components/markas/Navbar.vue";
const logo = [
{ fill: "fill-ink/15", points: "354,578 1256,138 1171,430 268,868" },
{ fill: "fill-ink/55", points: "553,443 1455,3 1370,295 467,733" },
{ fill: "fill-success/35", points: "421,762 1325,318 1240,611 336,1050" },
{ fill: "fill-ink/30", points: "265,1073 1169,629 1084,922 180,1362" },
{ fill: "fill-ink/80", points: "93,965 997,521 912,814 8,1253" },
{ fill: "fill-success", points: "347,1135 1251,691 1166,984 262,1424" },
];
const links = [
{ label: "Overview", href: "/overview", active: true },
{ label: "Deployments", href: "/deployments" },
{ label: "Analytics", href: "/analytics" },
{ label: "Settings", href: "/settings" },
];
const path = [{ label: "Markas", href: "/team" }, { label: "docs" }];
const account = [
{ label: "Profile", href: "/profile" },
{ label: "Settings", href: "/settings" },
{ label: "Billing", href: "/billing" },
{ separator: true as const },
{ label: "Sign out", value: "sign-out", danger: true },
];
const home = "rounded-md";
const logoClass = "size-6";
const slash = "hidden size-5 text-line @md:block";
const crumbs = "font-normal @max-xs:hidden";
const bell = "relative size-9 px-0!";
const icon = "size-5";
const count =
"absolute top-1 right-1 grid h-4 min-w-4 place-items-center rounded-full bg-danger px-1 text-[10px] font-semibold text-on-primary ring-2 ring-surface";
const profile =
"[&>button]:h-9 [&>button]:gap-1 [&>button]:border-0 [&>button]:px-1";
</script>
<template>
<Navbar :links="links">
<template #brand>
<a href="/" aria-label="MarkasUI home" :class="home">
<svg :class="logoClass" viewBox="0 0 1464 1430" aria-hidden="true">
<polygon
v-for="shape in logo"
:key="shape.points"
:class="shape.fill"
:points="shape.points"
/>
</svg>
</a>
<svg
:class="slash"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
stroke-width="1.5"
stroke-linecap="round"
aria-hidden="true"
>
<path d="M16 3 8 21" />
</svg>
<Breadcrumb :items="path" :class="crumbs" />
</template>
<template #actions>
<Button
variant="ghost"
aria-label="Notifications, 3 unread"
:class="bell"
>
<svg
:class="icon"
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 8a6 6 0 1 1 12 0c0 7 3 9 3 9H3s3-2 3-9" />
<path d="M10.3 21a1.94 1.94 0 0 0 3.4 0" />
</svg>
<span aria-hidden="true" :class="count">3</span>
</Button>
<DropdownMenu label="Account" :items="account" :class="profile">
<template #trigger>
<Avatar name="Siti Aminah" size="sm" />
</template>
</DropdownMenu>
</template>
</Navbar>
</template><script lang="ts">
import Avatar from "$lib/components/markas/Avatar.svelte";
import Breadcrumb from "$lib/components/markas/Breadcrumb.svelte";
import Button from "$lib/components/markas/Button.svelte";
import DropdownMenu from "$lib/components/markas/DropdownMenu.svelte";
import Navbar from "$lib/components/markas/Navbar.svelte";
const logo = [
{ fill: "fill-ink/15", points: "354,578 1256,138 1171,430 268,868" },
{ fill: "fill-ink/55", points: "553,443 1455,3 1370,295 467,733" },
{ fill: "fill-success/35", points: "421,762 1325,318 1240,611 336,1050" },
{ fill: "fill-ink/30", points: "265,1073 1169,629 1084,922 180,1362" },
{ fill: "fill-ink/80", points: "93,965 997,521 912,814 8,1253" },
{ fill: "fill-success", points: "347,1135 1251,691 1166,984 262,1424" },
];
const links = [
{ label: "Overview", href: "/overview", active: true },
{ label: "Deployments", href: "/deployments" },
{ label: "Analytics", href: "/analytics" },
{ label: "Settings", href: "/settings" },
];
const path = [{ label: "Markas", href: "/team" }, { label: "docs" }];
const account = [
{ label: "Profile", href: "/profile" },
{ label: "Settings", href: "/settings" },
{ label: "Billing", href: "/billing" },
{ separator: true as const },
{ label: "Sign out", value: "sign-out", danger: true },
];
const home = "rounded-md";
const logoClass = "size-6";
const slash = "hidden size-5 text-line @md:block";
const crumbs = "font-normal @max-xs:hidden";
const bell = "relative size-9 px-0!";
const icon = "size-5";
const count =
"absolute top-1 right-1 grid h-4 min-w-4 place-items-center rounded-full bg-danger px-1 text-[10px] font-semibold text-on-primary ring-2 ring-surface";
const profile =
"[&>button]:h-9 [&>button]:gap-1 [&>button]:border-0 [&>button]:px-1";
</script>
<Navbar {links}>
{#snippet brand()}
<a href="/" aria-label="MarkasUI home" class={home}>
<svg class={logoClass} viewBox="0 0 1464 1430" aria-hidden="true">
{#each logo as shape (shape.points)}
<polygon class={shape.fill} points={shape.points} />
{/each}
</svg>
</a>
<svg
class={slash}
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
stroke-width="1.5"
stroke-linecap="round"
aria-hidden="true"
>
<path d="M16 3 8 21" />
</svg>
<Breadcrumb items={path} class={crumbs} />
{/snippet}
{#snippet actions()}
<Button variant="ghost" aria-label="Notifications, 3 unread" class={bell}>
<svg
class={icon}
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 8a6 6 0 1 1 12 0c0 7 3 9 3 9H3s3-2 3-9" />
<path d="M10.3 21a1.94 1.94 0 0 0 3.4 0" />
</svg>
<span aria-hidden="true" class={count}>3</span>
</Button>
<DropdownMenu label="Account" items={account} class={profile}>
{#snippet trigger()}
<Avatar name="Siti Aminah" size="sm" />
{/snippet}
</DropdownMenu>
{/snippet}
</Navbar>---
import Avatar from "@/components/markas/Avatar.astro";
import Breadcrumb from "@/components/markas/Breadcrumb.astro";
import Button from "@/components/markas/Button.astro";
import DropdownMenu from "@/components/markas/DropdownMenu.astro";
import Navbar from "@/components/markas/Navbar.astro";
const logo = [
{ fill: "fill-ink/15", points: "354,578 1256,138 1171,430 268,868" },
{ fill: "fill-ink/55", points: "553,443 1455,3 1370,295 467,733" },
{ fill: "fill-success/35", points: "421,762 1325,318 1240,611 336,1050" },
{ fill: "fill-ink/30", points: "265,1073 1169,629 1084,922 180,1362" },
{ fill: "fill-ink/80", points: "93,965 997,521 912,814 8,1253" },
{ fill: "fill-success", points: "347,1135 1251,691 1166,984 262,1424" },
];
const links = [
{ label: "Overview", href: "/overview", active: true },
{ label: "Deployments", href: "/deployments" },
{ label: "Analytics", href: "/analytics" },
{ label: "Settings", href: "/settings" },
];
const path = [{ label: "Markas", href: "/team" }, { label: "docs" }];
const account = [
{ label: "Profile", href: "/profile" },
{ label: "Settings", href: "/settings" },
{ label: "Billing", href: "/billing" },
{ separator: true as const },
{ label: "Sign out", value: "sign-out", danger: true },
];
const home = "rounded-md";
const logoClass = "size-6";
const slash = "hidden size-5 text-line @md:block";
const crumbs = "font-normal @max-xs:hidden";
const bell = "relative size-9 px-0!";
const icon = "size-5";
const count =
"absolute top-1 right-1 grid h-4 min-w-4 place-items-center rounded-full bg-danger px-1 text-[10px] font-semibold text-on-primary ring-2 ring-surface";
const profile =
"[&>button]:h-9 [&>button]:gap-1 [&>button]:border-0 [&>button]:px-1";
---
<Navbar links={links}>
<Fragment slot="brand">
<a href="/" aria-label="MarkasUI home" class={home}>
<svg class={logoClass} viewBox="0 0 1464 1430" aria-hidden="true">
{logo.map((shape) => <polygon class={shape.fill} points={shape.points} />)}
</svg>
</a>
<svg
class={slash}
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
stroke-width="1.5"
stroke-linecap="round"
aria-hidden="true"
>
<path d="M16 3 8 21"></path>
</svg>
<Breadcrumb items={path} class={crumbs} />
</Fragment>
<Fragment slot="actions">
<Button variant="ghost" aria-label="Notifications, 3 unread" class={bell}>
<svg
class={icon}
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 8a6 6 0 1 1 12 0c0 7 3 9 3 9H3s3-2 3-9"></path>
<path d="M10.3 21a1.94 1.94 0 0 0 3.4 0"></path>
</svg>
<span aria-hidden="true" class={count}>3</span>
</Button>
<DropdownMenu label="Account" items={account} class={profile}>
<Avatar slot="trigger" name="Siti Aminah" size="sm" />
</DropdownMenu>
</Fragment>
</Navbar>import { Component } from "@angular/core";
import { Avatar } from "./markas/avatar.component";
import { Breadcrumb } from "./markas/breadcrumb.component";
import { Button } from "./markas/button.component";
import { DropdownMenu } from "./markas/dropdown-menu.component";
import {
Navbar,
type NavbarLink,
} from "./markas/navbar.component";
const logo = [
{ fill: "fill-ink/15", points: "354,578 1256,138 1171,430 268,868" },
{ fill: "fill-ink/55", points: "553,443 1455,3 1370,295 467,733" },
{ fill: "fill-success/35", points: "421,762 1325,318 1240,611 336,1050" },
{ fill: "fill-ink/30", points: "265,1073 1169,629 1084,922 180,1362" },
{ fill: "fill-ink/80", points: "93,965 997,521 912,814 8,1253" },
{ fill: "fill-success", points: "347,1135 1251,691 1166,984 262,1424" },
];
const links: NavbarLink[] = [
{ label: "Overview", href: "/overview", active: true },
{ label: "Deployments", href: "/deployments" },
{ label: "Analytics", href: "/analytics" },
{ label: "Settings", href: "/settings" },
];
const path = [{ label: "Markas", href: "/team" }, { label: "docs" }];
const account = [
{ label: "Profile", href: "/profile" },
{ label: "Settings", href: "/settings" },
{ label: "Billing", href: "/billing" },
{ separator: true as const },
{ label: "Sign out", value: "sign-out", danger: true },
];
const home = "rounded-md";
const logoClass = "size-6";
const slash = "hidden size-5 text-line @md:block";
const crumbs = "font-normal @max-xs:hidden";
const bell = "relative size-9 px-0!";
const icon = "size-5";
const count =
"absolute top-1 right-1 grid h-4 min-w-4 place-items-center rounded-full bg-danger px-1 text-[10px] font-semibold text-on-primary ring-2 ring-surface";
const profile =
"[&>button]:h-9 [&>button]:gap-1 [&>button]:border-0 [&>button]:px-1";
@Component({
selector: "markas-example",
imports: [Avatar, Breadcrumb, Button, DropdownMenu, Navbar],
template: `
<header markas-navbar [links]="links">
<ng-container brand>
<a href="/" aria-label="MarkasUI home" [class]="home">
<svg
[attr.class]="logoClass"
viewBox="0 0 1464 1430"
aria-hidden="true"
>
@for (shape of logo; track shape.points) {
<polygon [attr.class]="shape.fill" [attr.points]="shape.points" />
}
</svg>
</a>
<svg
[attr.class]="slash"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
stroke-width="1.5"
stroke-linecap="round"
aria-hidden="true"
>
<path d="M16 3 8 21" />
</svg>
<nav markas-breadcrumb [items]="path" [class]="crumbs"></nav>
</ng-container>
<ng-container actions>
<button
markas-button
variant="ghost"
aria-label="Notifications, 3 unread"
[class]="bell"
>
<svg
[attr.class]="icon"
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 8a6 6 0 1 1 12 0c0 7 3 9 3 9H3s3-2 3-9" />
<path d="M10.3 21a1.94 1.94 0 0 0 3.4 0" />
</svg>
<span aria-hidden="true" [class]="count">3</span>
</button>
<markas-dropdown-menu
label="Account"
[items]="account"
[class]="profile"
>
<markas-avatar trigger name="Siti Aminah" size="sm" />
</markas-dropdown-menu>
</ng-container>
</header>
`,
})
export default class NavbarAppExample {
protected readonly logo = logo;
protected readonly links = links;
protected readonly path = path;
protected readonly account = account;
protected readonly home = home;
protected readonly logoClass = logoClass;
protected readonly slash = slash;
protected readonly crumbs = crumbs;
protected readonly bell = bell;
protected readonly icon = icon;
protected readonly count = count;
protected readonly profile = profile;
}Seluler dengan tab bawah
Good morning, Rian
What shipped this week
- Navbar Eight new layouts New
- Command Grouped results and hotkey Updated
- Sidebar Collapsible icon rail Updated
- Footer Newsletter and sitemap New
- Theme toggle Six transition styles Updated
Good morning, Rian
What shipped this week
- NavbarEight new layoutsNew
- CommandGrouped results and hotkeyUpdated
- SidebarCollapsible icon railUpdated
- FooterNewsletter and sitemapNew
- Theme toggleSix transition stylesUpdated
Good morning, Rian
What shipped this week
- NavbarEight new layoutsNew
- CommandGrouped results and hotkeyUpdated
- SidebarCollapsible icon railUpdated
- FooterNewsletter and sitemapNew
- Theme toggleSix transition stylesUpdated
Good morning, Rian
What shipped this week
- Navbar Eight new layouts New
- Command Grouped results and hotkey Updated
- Sidebar Collapsible icon rail Updated
- Footer Newsletter and sitemap New
- Theme toggle Six transition styles Updated
Good morning, Rian
What shipped this week
- NavbarEight new layoutsNew
- CommandGrouped results and hotkeyUpdated
- SidebarCollapsible icon railUpdated
- FooterNewsletter and sitemapNew
- Theme toggleSix transition stylesUpdated
@php
$logo = [
['fill' => 'fill-ink/15', 'points' => '354,578 1256,138 1171,430 268,868'],
['fill' => 'fill-ink/55', 'points' => '553,443 1455,3 1370,295 467,733'],
['fill' => 'fill-success/35', 'points' => '421,762 1325,318 1240,611 336,1050'],
['fill' => 'fill-ink/30', 'points' => '265,1073 1169,629 1084,922 180,1362'],
['fill' => 'fill-ink/80', 'points' => '93,965 997,521 912,814 8,1253'],
['fill' => 'fill-success', 'points' => '347,1135 1251,691 1166,984 262,1424'],
];
$tabs = [
[
'value' => 'home',
'label' => 'Home',
'icon' => 'M3 10.5 12 3l9 7.5V20a1 1 0 0 1-1 1h-5v-6H9v6H4a1 1 0 0 1-1-1z',
],
[
'value' => 'components',
'label' => 'Components',
'icon' => 'M4 4h7v7H4zm9 0h7v7h-7zM4 13h7v7H4zm9 3.5a3.5 3.5 0 1 0 7 0 3.5 3.5 0 0 0-7 0z',
],
['value' => 'saved', 'label' => 'Saved', 'icon' => 'M6 3h12v18l-6-4-6 4z', 'badge' => 2],
[
'value' => 'profile',
'label' => 'Profile',
'icon' => 'M12 12a4 4 0 1 0 0-8 4 4 0 0 0 0 8zM4 21a8 8 0 0 1 16 0',
],
];
$updates = [
['name' => 'Navbar', 'note' => 'Eight new layouts', 'tag' => 'New'],
['name' => 'Command', 'note' => 'Grouped results and hotkey', 'tag' => 'Updated'],
['name' => 'Sidebar', 'note' => 'Collapsible icon rail', 'tag' => 'Updated'],
['name' => 'Footer', 'note' => 'Newsletter and sitemap', 'tag' => 'New'],
['name' => 'Theme toggle', 'note' => 'Six transition styles', 'tag' => 'Updated'],
];
$phone = 'relative mx-auto flex h-[560px] w-full max-w-[360px] flex-col overflow-hidden rounded-[2.5rem] border border-line bg-canvas';
$top = 'shrink-0 pt-3 [&_[aria-controls$=-menu]]:hidden';
$brand = 'flex items-center gap-2 rounded-md';
$logoClass = 'size-6';
$feed = 'flex-1 overflow-y-auto px-4 pt-5 pb-28 focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-primary';
$greeting = 'text-sm text-muted';
$heading = 'mt-1 text-2xl font-semibold tracking-tight text-ink';
$list = 'mt-5 divide-y divide-line overflow-hidden rounded-2xl border border-line bg-surface';
$row = 'flex items-center gap-3 px-4 py-3';
$rowBody = 'grid min-w-0 flex-1';
$rowTitle = 'text-sm font-medium text-ink';
$rowNote = 'truncate text-xs text-muted';
$tabBar = 'absolute inset-x-4 bottom-4';
@endphp
<div class="{{ $phone }}">
<x-markas.navbar variant="blur" class="{{ $top }}">
<x-slot:brand>
<a href="/" class="{{ $brand }}">
<svg class="{{ $logoClass }}" viewBox="0 0 1464 1430" aria-hidden="true">
@foreach ($logo as $shape)
<polygon class="{{ $shape['fill'] }}" points="{{ $shape['points'] }}" />
@endforeach
</svg>
<span>MarkasUI</span>
</a>
</x-slot:brand>
<x-slot:actions>
<x-markas.avatar name="Ahmad Rian" size="sm" />
</x-slot:actions>
</x-markas.navbar>
<div role="region" aria-label="Updates" tabindex="0" class="{{ $feed }}">
<p class="{{ $greeting }}">Good morning, Rian</p>
<h2 class="{{ $heading }}">What shipped this week</h2>
<ul class="{{ $list }}">
@foreach ($updates as $update)
<li class="{{ $row }}">
<span class="{{ $rowBody }}">
<span class="{{ $rowTitle }}">{{ $update['name'] }}</span>
<span class="{{ $rowNote }}">{{ $update['note'] }}</span>
</span>
<x-markas.badge :variant="$update['tag'] === 'New' ? 'success' : 'neutral'">{{ $update['tag'] }}</x-markas.badge>
</li>
@endforeach
</ul>
</div>
<x-markas.bottom-navigation :items="$tabs" class="{{ $tabBar }}" />
</div>import { Avatar } from "@/components/markas/Avatar";
import { Badge } from "@/components/markas/Badge";
import { BottomNavigation } from "@/components/markas/BottomNavigation";
import { Navbar } from "@/components/markas/Navbar";
const logo = [
{ fill: "fill-ink/15", points: "354,578 1256,138 1171,430 268,868" },
{ fill: "fill-ink/55", points: "553,443 1455,3 1370,295 467,733" },
{ fill: "fill-success/35", points: "421,762 1325,318 1240,611 336,1050" },
{ fill: "fill-ink/30", points: "265,1073 1169,629 1084,922 180,1362" },
{ fill: "fill-ink/80", points: "93,965 997,521 912,814 8,1253" },
{ fill: "fill-success", points: "347,1135 1251,691 1166,984 262,1424" },
];
const tabs = [
{
value: "home",
label: "Home",
icon: "M3 10.5 12 3l9 7.5V20a1 1 0 0 1-1 1h-5v-6H9v6H4a1 1 0 0 1-1-1z",
},
{
value: "components",
label: "Components",
icon: "M4 4h7v7H4zm9 0h7v7h-7zM4 13h7v7H4zm9 3.5a3.5 3.5 0 1 0 7 0 3.5 3.5 0 0 0-7 0z",
},
{
value: "saved",
label: "Saved",
icon: "M6 3h12v18l-6-4-6 4z",
badge: 2,
},
{
value: "profile",
label: "Profile",
icon: "M12 12a4 4 0 1 0 0-8 4 4 0 0 0 0 8zM4 21a8 8 0 0 1 16 0",
},
];
const updates = [
{ name: "Navbar", note: "Eight new layouts", tag: "New" },
{ name: "Command", note: "Grouped results and hotkey", tag: "Updated" },
{ name: "Sidebar", note: "Collapsible icon rail", tag: "Updated" },
{ name: "Footer", note: "Newsletter and sitemap", tag: "New" },
{ name: "Theme toggle", note: "Six transition styles", tag: "Updated" },
];
const phone =
"relative mx-auto flex h-[560px] w-full max-w-[360px] flex-col overflow-hidden rounded-[2.5rem] border border-line bg-canvas";
/** Bottom tabs replace the menu button on small screens. */
const top = "shrink-0 pt-3 [&_[aria-controls$=-menu]]:hidden";
const brand = "flex items-center gap-2 rounded-md";
const logoClass = "size-6";
const feed =
"flex-1 overflow-y-auto px-4 pt-5 pb-28 focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-primary";
const greeting = "text-sm text-muted";
const heading = "mt-1 text-2xl font-semibold tracking-tight text-ink";
const list =
"mt-5 divide-y divide-line overflow-hidden rounded-2xl border border-line bg-surface";
const row = "flex items-center gap-3 px-4 py-3";
const rowBody = "grid min-w-0 flex-1";
const rowTitle = "text-sm font-medium text-ink";
const rowNote = "truncate text-xs text-muted";
const tabBar = "absolute inset-x-4 bottom-4";
export default function Example() {
return (
<div className={phone}>
<Navbar
variant="blur"
className={top}
brand={
<a href="/" className={brand}>
<svg
className={logoClass}
viewBox="0 0 1464 1430"
aria-hidden="true"
>
{logo.map((shape) => (
<polygon
key={shape.points}
className={shape.fill}
points={shape.points}
/>
))}
</svg>
<span>MarkasUI</span>
</a>
}
actions={<Avatar name="Ahmad Rian" size="sm" />}
/>
<div role="region" aria-label="Updates" tabIndex={0} className={feed}>
<p className={greeting}>Good morning, Rian</p>
<h2 className={heading}>What shipped this week</h2>
<ul className={list}>
{updates.map((update) => (
<li key={update.name} className={row}>
<span className={rowBody}>
<span className={rowTitle}>{update.name}</span>
<span className={rowNote}>{update.note}</span>
</span>
<Badge variant={update.tag === "New" ? "success" : "neutral"}>
{update.tag}
</Badge>
</li>
))}
</ul>
</div>
<BottomNavigation items={tabs} className={tabBar} />
</div>
);
}<script setup lang="ts">
import Avatar from "@/components/markas/Avatar.vue";
import Badge from "@/components/markas/Badge.vue";
import BottomNavigation from "@/components/markas/BottomNavigation.vue";
import Navbar from "@/components/markas/Navbar.vue";
const logo = [
{ fill: "fill-ink/15", points: "354,578 1256,138 1171,430 268,868" },
{ fill: "fill-ink/55", points: "553,443 1455,3 1370,295 467,733" },
{ fill: "fill-success/35", points: "421,762 1325,318 1240,611 336,1050" },
{ fill: "fill-ink/30", points: "265,1073 1169,629 1084,922 180,1362" },
{ fill: "fill-ink/80", points: "93,965 997,521 912,814 8,1253" },
{ fill: "fill-success", points: "347,1135 1251,691 1166,984 262,1424" },
];
const tabs = [
{
value: "home",
label: "Home",
icon: "M3 10.5 12 3l9 7.5V20a1 1 0 0 1-1 1h-5v-6H9v6H4a1 1 0 0 1-1-1z",
},
{
value: "components",
label: "Components",
icon: "M4 4h7v7H4zm9 0h7v7h-7zM4 13h7v7H4zm9 3.5a3.5 3.5 0 1 0 7 0 3.5 3.5 0 0 0-7 0z",
},
{
value: "saved",
label: "Saved",
icon: "M6 3h12v18l-6-4-6 4z",
badge: 2,
},
{
value: "profile",
label: "Profile",
icon: "M12 12a4 4 0 1 0 0-8 4 4 0 0 0 0 8zM4 21a8 8 0 0 1 16 0",
},
];
const updates = [
{ name: "Navbar", note: "Eight new layouts", tag: "New" },
{ name: "Command", note: "Grouped results and hotkey", tag: "Updated" },
{ name: "Sidebar", note: "Collapsible icon rail", tag: "Updated" },
{ name: "Footer", note: "Newsletter and sitemap", tag: "New" },
{ name: "Theme toggle", note: "Six transition styles", tag: "Updated" },
];
const phone =
"relative mx-auto flex h-[560px] w-full max-w-[360px] flex-col overflow-hidden rounded-[2.5rem] border border-line bg-canvas";
/** Bottom tabs replace the menu button on small screens. */
const top = "shrink-0 pt-3 [&_[aria-controls$=-menu]]:hidden";
const brand = "flex items-center gap-2 rounded-md";
const logoClass = "size-6";
const feed =
"flex-1 overflow-y-auto px-4 pt-5 pb-28 focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-primary";
const greeting = "text-sm text-muted";
const heading = "mt-1 text-2xl font-semibold tracking-tight text-ink";
const list =
"mt-5 divide-y divide-line overflow-hidden rounded-2xl border border-line bg-surface";
const row = "flex items-center gap-3 px-4 py-3";
const rowBody = "grid min-w-0 flex-1";
const rowTitle = "text-sm font-medium text-ink";
const rowNote = "truncate text-xs text-muted";
const tabBar = "absolute inset-x-4 bottom-4";
</script>
<template>
<div :class="phone">
<Navbar variant="blur" :class="top">
<template #brand>
<a href="/" :class="brand">
<svg :class="logoClass" viewBox="0 0 1464 1430" aria-hidden="true">
<polygon
v-for="shape in logo"
:key="shape.points"
:class="shape.fill"
:points="shape.points"
/>
</svg>
<span>MarkasUI</span>
</a>
</template>
<template #actions>
<Avatar name="Ahmad Rian" size="sm" />
</template>
</Navbar>
<div role="region" aria-label="Updates" tabindex="0" :class="feed">
<p :class="greeting">Good morning, Rian</p>
<h2 :class="heading">What shipped this week</h2>
<ul :class="list">
<li v-for="update in updates" :key="update.name" :class="row">
<span :class="rowBody">
<span :class="rowTitle">{{ update.name }}</span>
<span :class="rowNote">{{ update.note }}</span>
</span>
<Badge :variant="update.tag === 'New' ? 'success' : 'neutral'">
{{ update.tag }}
</Badge>
</li>
</ul>
</div>
<BottomNavigation :items="tabs" :class="tabBar" />
</div>
</template><script lang="ts">
import Avatar from "$lib/components/markas/Avatar.svelte";
import Badge from "$lib/components/markas/Badge.svelte";
import BottomNavigation from "$lib/components/markas/BottomNavigation.svelte";
import Navbar from "$lib/components/markas/Navbar.svelte";
const logo = [
{ fill: "fill-ink/15", points: "354,578 1256,138 1171,430 268,868" },
{ fill: "fill-ink/55", points: "553,443 1455,3 1370,295 467,733" },
{ fill: "fill-success/35", points: "421,762 1325,318 1240,611 336,1050" },
{ fill: "fill-ink/30", points: "265,1073 1169,629 1084,922 180,1362" },
{ fill: "fill-ink/80", points: "93,965 997,521 912,814 8,1253" },
{ fill: "fill-success", points: "347,1135 1251,691 1166,984 262,1424" },
];
const tabs = [
{
value: "home",
label: "Home",
icon: "M3 10.5 12 3l9 7.5V20a1 1 0 0 1-1 1h-5v-6H9v6H4a1 1 0 0 1-1-1z",
},
{
value: "components",
label: "Components",
icon: "M4 4h7v7H4zm9 0h7v7h-7zM4 13h7v7H4zm9 3.5a3.5 3.5 0 1 0 7 0 3.5 3.5 0 0 0-7 0z",
},
{
value: "saved",
label: "Saved",
icon: "M6 3h12v18l-6-4-6 4z",
badge: 2,
},
{
value: "profile",
label: "Profile",
icon: "M12 12a4 4 0 1 0 0-8 4 4 0 0 0 0 8zM4 21a8 8 0 0 1 16 0",
},
];
const updates = [
{ name: "Navbar", note: "Eight new layouts", tag: "New" },
{ name: "Command", note: "Grouped results and hotkey", tag: "Updated" },
{ name: "Sidebar", note: "Collapsible icon rail", tag: "Updated" },
{ name: "Footer", note: "Newsletter and sitemap", tag: "New" },
{ name: "Theme toggle", note: "Six transition styles", tag: "Updated" },
];
const phone =
"relative mx-auto flex h-[560px] w-full max-w-[360px] flex-col overflow-hidden rounded-[2.5rem] border border-line bg-canvas";
/** Bottom tabs replace the menu button on small screens. */
const top = "shrink-0 pt-3 [&_[aria-controls$=-menu]]:hidden";
const brandLink = "flex items-center gap-2 rounded-md";
const logoClass = "size-6";
const feed =
"flex-1 overflow-y-auto px-4 pt-5 pb-28 focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-primary";
const greeting = "text-sm text-muted";
const heading = "mt-1 text-2xl font-semibold tracking-tight text-ink";
const list =
"mt-5 divide-y divide-line overflow-hidden rounded-2xl border border-line bg-surface";
const row = "flex items-center gap-3 px-4 py-3";
const rowBody = "grid min-w-0 flex-1";
const rowTitle = "text-sm font-medium text-ink";
const rowNote = "truncate text-xs text-muted";
const tabBar = "absolute inset-x-4 bottom-4";
</script>
<div class={phone}>
<Navbar variant="blur" class={top}>
{#snippet brand()}
<a href="/" class={brandLink}>
<svg class={logoClass} viewBox="0 0 1464 1430" aria-hidden="true">
{#each logo as shape (shape.points)}<polygon
class={shape.fill}
points={shape.points}
/>{/each}
</svg>
<span>MarkasUI</span>
</a>
{/snippet}
{#snippet actions()}
<Avatar name="Ahmad Rian" size="sm" />
{/snippet}
</Navbar>
<!-- svelte-ignore a11y_no_noninteractive_tabindex -->
<div role="region" aria-label="Updates" tabindex="0" class={feed}>
<p class={greeting}>Good morning, Rian</p>
<h2 class={heading}>What shipped this week</h2>
<ul class={list}>
{#each updates as update (update.name)}<li class={row}>
<span class={rowBody}>
<span class={rowTitle}>{update.name}</span>
<span class={rowNote}>{update.note}</span>
</span>
<Badge variant={update.tag === "New" ? "success" : "neutral"}>
{update.tag}
</Badge>
</li>{/each}
</ul>
</div>
<BottomNavigation items={tabs} class={tabBar} />
</div>---
import Avatar from "@/components/markas/Avatar.astro";
import Badge from "@/components/markas/Badge.astro";
import BottomNavigation from "@/components/markas/BottomNavigation.astro";
import Navbar from "@/components/markas/Navbar.astro";
const logo = [
{ fill: "fill-ink/15", points: "354,578 1256,138 1171,430 268,868" },
{ fill: "fill-ink/55", points: "553,443 1455,3 1370,295 467,733" },
{ fill: "fill-success/35", points: "421,762 1325,318 1240,611 336,1050" },
{ fill: "fill-ink/30", points: "265,1073 1169,629 1084,922 180,1362" },
{ fill: "fill-ink/80", points: "93,965 997,521 912,814 8,1253" },
{ fill: "fill-success", points: "347,1135 1251,691 1166,984 262,1424" },
];
const tabs = [
{
value: "home",
label: "Home",
icon: "M3 10.5 12 3l9 7.5V20a1 1 0 0 1-1 1h-5v-6H9v6H4a1 1 0 0 1-1-1z",
},
{
value: "components",
label: "Components",
icon: "M4 4h7v7H4zm9 0h7v7h-7zM4 13h7v7H4zm9 3.5a3.5 3.5 0 1 0 7 0 3.5 3.5 0 0 0-7 0z",
},
{
value: "saved",
label: "Saved",
icon: "M6 3h12v18l-6-4-6 4z",
badge: 2,
},
{
value: "profile",
label: "Profile",
icon: "M12 12a4 4 0 1 0 0-8 4 4 0 0 0 0 8zM4 21a8 8 0 0 1 16 0",
},
];
const updates = [
{ name: "Navbar", note: "Eight new layouts", tag: "New" },
{ name: "Command", note: "Grouped results and hotkey", tag: "Updated" },
{ name: "Sidebar", note: "Collapsible icon rail", tag: "Updated" },
{ name: "Footer", note: "Newsletter and sitemap", tag: "New" },
{ name: "Theme toggle", note: "Six transition styles", tag: "Updated" },
];
const phone =
"relative mx-auto flex h-[560px] w-full max-w-[360px] flex-col overflow-hidden rounded-[2.5rem] border border-line bg-canvas";
/** Bottom tabs replace the menu button on small screens. */
const top = "shrink-0 pt-3 [&_[aria-controls$=-menu]]:hidden";
const brand = "flex items-center gap-2 rounded-md";
const logoClass = "size-6";
const feed =
"flex-1 overflow-y-auto px-4 pt-5 pb-28 focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-primary";
const greeting = "text-sm text-muted";
const heading = "mt-1 text-2xl font-semibold tracking-tight text-ink";
const list =
"mt-5 divide-y divide-line overflow-hidden rounded-2xl border border-line bg-surface";
const row = "flex items-center gap-3 px-4 py-3";
const rowBody = "grid min-w-0 flex-1";
const rowTitle = "text-sm font-medium text-ink";
const rowNote = "truncate text-xs text-muted";
const tabBar = "absolute inset-x-4 bottom-4";
---
<div class={phone}>
<Navbar variant="blur" class={top}>
<Fragment slot="brand">
<a href="/" class={brand}>
<svg class={logoClass} viewBox="0 0 1464 1430" aria-hidden="true">
{logo.map((shape) => (<polygon class={shape.fill} points={shape.points} />))}
</svg>
<span>MarkasUI</span>
</a>
</Fragment>
<Fragment slot="actions">
<Avatar name="Ahmad Rian" size="sm" />
</Fragment>
</Navbar>
<div role="region" aria-label="Updates" tabindex="0" class={feed}>
<p class={greeting}>Good morning, Rian</p>
<h2 class={heading}>What shipped this week</h2>
<ul class={list}>
{updates.map((update) => (<li class={row}>
<span class={rowBody}>
<span class={rowTitle}>{update.name}</span>
<span class={rowNote}>{update.note}</span>
</span>
<Badge variant={update.tag === 'New' ? 'success' : 'neutral'}>
{update.tag}
</Badge>
</li>))}
</ul>
</div>
<BottomNavigation items={tabs} class={tabBar} />
</div>import { Component } from "@angular/core";
import { Avatar } from "./markas/avatar.component";
import { Badge } from "./markas/badge.component";
import { BottomNavigation } from "./markas/bottom-navigation.component";
import { Navbar } from "./markas/navbar.component";
@Component({
selector: "markas-example",
imports: [Avatar, Badge, BottomNavigation, Navbar],
template: `
<div [class]="phone">
<header markas-navbar variant="blur" [class]="top">
<ng-container brand>
<a href="/" [class]="brand">
<svg [class]="logoClass" viewBox="0 0 1464 1430" aria-hidden="true">
@for (shape of logo; track shape.points) {
<polygon [class]="shape.fill" [attr.points]="shape.points" />
}
</svg>
<span>MarkasUI</span>
</a>
</ng-container>
<ng-container actions>
<markas-avatar name="Ahmad Rian" size="sm" />
</ng-container>
</header>
<div role="region" aria-label="Updates" tabindex="0" [class]="feed">
<p [class]="greeting">Good morning, Rian</p>
<h2 [class]="heading">What shipped this week</h2>
<ul [class]="list">
@for (update of updates; track update.name) {
<li [class]="row">
<span [class]="rowBody">
<span [class]="rowTitle">{{ update.name }}</span>
<span [class]="rowNote">{{ update.note }}</span>
</span>
<span
markas-badge
[variant]="update.tag === 'New' ? 'success' : 'neutral'"
>
{{ update.tag }}
</span>
</li>
}
</ul>
</div>
<markas-bottom-navigation [items]="tabs" [class]="tabBar" />
</div>
`,
})
export default class NavbarBottomTabsExample {
protected readonly logo = [
{ fill: "fill-ink/15", points: "354,578 1256,138 1171,430 268,868" },
{ fill: "fill-ink/55", points: "553,443 1455,3 1370,295 467,733" },
{ fill: "fill-success/35", points: "421,762 1325,318 1240,611 336,1050" },
{ fill: "fill-ink/30", points: "265,1073 1169,629 1084,922 180,1362" },
{ fill: "fill-ink/80", points: "93,965 997,521 912,814 8,1253" },
{ fill: "fill-success", points: "347,1135 1251,691 1166,984 262,1424" },
];
protected readonly tabs = [
{
value: "home",
label: "Home",
icon: "M3 10.5 12 3l9 7.5V20a1 1 0 0 1-1 1h-5v-6H9v6H4a1 1 0 0 1-1-1z",
},
{
value: "components",
label: "Components",
icon: "M4 4h7v7H4zm9 0h7v7h-7zM4 13h7v7H4zm9 3.5a3.5 3.5 0 1 0 7 0 3.5 3.5 0 0 0-7 0z",
},
{
value: "saved",
label: "Saved",
icon: "M6 3h12v18l-6-4-6 4z",
badge: 2,
},
{
value: "profile",
label: "Profile",
icon: "M12 12a4 4 0 1 0 0-8 4 4 0 0 0 0 8zM4 21a8 8 0 0 1 16 0",
},
];
protected readonly updates = [
{ name: "Navbar", note: "Eight new layouts", tag: "New" },
{ name: "Command", note: "Grouped results and hotkey", tag: "Updated" },
{ name: "Sidebar", note: "Collapsible icon rail", tag: "Updated" },
{ name: "Footer", note: "Newsletter and sitemap", tag: "New" },
{ name: "Theme toggle", note: "Six transition styles", tag: "Updated" },
];
protected readonly phone =
"relative mx-auto flex h-[560px] w-full max-w-[360px] flex-col overflow-hidden rounded-[2.5rem] border border-line bg-canvas";
/** Bottom tabs replace the menu button on small screens. */
protected readonly top = "shrink-0 pt-3 [&_[aria-controls$=-menu]]:hidden";
protected readonly brand = "flex items-center gap-2 rounded-md";
protected readonly logoClass = "size-6";
protected readonly feed =
"flex-1 overflow-y-auto px-4 pt-5 pb-28 focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-primary";
protected readonly greeting = "text-sm text-muted";
protected readonly heading =
"mt-1 text-2xl font-semibold tracking-tight text-ink";
protected readonly list =
"mt-5 divide-y divide-line overflow-hidden rounded-2xl border border-line bg-surface";
protected readonly row = "flex items-center gap-3 px-4 py-3";
protected readonly rowBody = "grid min-w-0 flex-1";
protected readonly rowTitle = "text-sm font-medium text-ink";
protected readonly rowNote = "truncate text-xs text-muted";
protected readonly tabBar = "absolute inset-x-4 bottom-4";
}Bening di atas hero, solid saat digulir
Interfaces that feel finished
Scroll this page. The header starts clear over the hero and turns solid once content moves under it.
Three frameworks
Blade, React, and Vue share the same classes and variants.
Native first
Dialog, Popover API, and details before any extra script.
Tokens only
Fifteen colour tokens keep light and dark mode in step.
Interfaces that feel finished
Scroll this page. The header starts clear over the hero and turns solid once content moves under it.
Three frameworks
Blade, React, and Vue share the same classes and variants.
Native first
Dialog, Popover API, and details before any extra script.
Tokens only
Fifteen colour tokens keep light and dark mode in step.
Interfaces that feel finished
Scroll this page. The header starts clear over the hero and turns solid once content moves under it.
Three frameworks
Blade, React, and Vue share the same classes and variants.
Native first
Dialog, Popover API, and details before any extra script.
Tokens only
Fifteen colour tokens keep light and dark mode in step.
Interfaces that feel finished
Scroll this page. The header starts clear over the hero and turns solid once content moves under it.
Three frameworks
Blade, React, and Vue share the same classes and variants.
Native first
Dialog, Popover API, and details before any extra script.
Tokens only
Fifteen colour tokens keep light and dark mode in step.
Interfaces that feel finished
Scroll this page. The header starts clear over the hero and turns solid once content moves under it.
Three frameworks
Blade, React, and Vue share the same classes and variants.
Native first
Dialog, Popover API, and details before any extra script.
Tokens only
Fifteen colour tokens keep light and dark mode in step.
@php
$logo = [
['fill' => 'fill-ink/15', 'points' => '354,578 1256,138 1171,430 268,868'],
['fill' => 'fill-ink/55', 'points' => '553,443 1455,3 1370,295 467,733'],
['fill' => 'fill-success/35', 'points' => '421,762 1325,318 1240,611 336,1050'],
['fill' => 'fill-ink/30', 'points' => '265,1073 1169,629 1084,922 180,1362'],
['fill' => 'fill-ink/80', 'points' => '93,965 997,521 912,814 8,1253'],
['fill' => 'fill-success', 'points' => '347,1135 1251,691 1166,984 262,1424'],
];
$links = [
['label' => 'Components', 'href' => '/components'],
['label' => 'Templates', 'href' => '/templates'],
['label' => 'Docs', 'href' => '/docs'],
['label' => 'Pricing', 'href' => '/pricing'],
];
$features = [
[
'title' => 'Three frameworks',
'text' => 'Blade, React, and Vue share the same classes and variants.',
],
[
'title' => 'Native first',
'text' => 'Dialog, Popover API, and details before any extra script.',
],
[
'title' => 'Tokens only',
'text' => 'Fifteen colour tokens keep light and dark mode in step.',
],
];
$solidAfter = 8;
$frame = 'dark h-[460px] overflow-hidden rounded-2xl border border-line bg-canvas text-ink';
$scroller = '@container h-full overflow-y-auto focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-primary';
$bar = 'border-transparent! bg-transparent! backdrop-blur-none! transition-[background-color,border-color] duration-300 ease-out data-[scrolled=true]:border-line/60! data-[scrolled=true]:bg-surface/75! data-[scrolled=true]:backdrop-blur-md!';
$brand = 'flex items-center gap-2 rounded-md';
$logoClass = 'size-6';
$hero = 'relative -mt-14 grid justify-items-center gap-5 overflow-hidden bg-[radial-gradient(70%_55%_at_50%_0%,color-mix(in_oklab,var(--color-success)_38%,transparent),transparent),radial-gradient(50%_40%_at_85%_30%,color-mix(in_oklab,var(--color-ink)_10%,transparent),transparent)] px-6 pt-28 pb-14 text-center';
$lines = 'absolute inset-0 opacity-50 bg-[linear-gradient(to_right,var(--color-line)_1px,transparent_1px)] bg-size-[48px_100%] [mask-image:radial-gradient(ellipse_at_top,black,transparent_70%)]';
$pill = 'relative inline-flex items-center gap-2 rounded-full border border-line bg-surface/60 px-3 py-1 text-xs text-muted transition-colors duration-150 ease-out hover:text-ink focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary';
$pillDot = 'size-1.5 rounded-full bg-success';
$title = 'relative max-w-sm text-4xl font-semibold tracking-tight text-balance';
$lead = 'relative max-w-sm text-sm text-muted text-pretty';
$ctas = 'relative flex flex-wrap justify-center gap-2';
$grid = 'grid gap-3 px-6 pb-8 @2xl:grid-cols-3';
$card = 'grid gap-1 rounded-xl border border-line bg-surface p-4';
$cardTitle = 'text-sm font-medium';
$cardText = 'text-sm text-muted';
@endphp
<div x-data="{ scrolled: false }" class="{{ $frame }}">
<div role="region" aria-label="Landing page" tabindex="0" x-on:scroll="scrolled = $el.scrollTop > {{ $solidAfter }}" class="{{ $scroller }}">
<x-markas.navbar :links="$links" variant="blur" :sticky="true" x-bind:data-scrolled="String(scrolled)" class="{{ $bar }}">
<x-slot:brand>
<a href="/" class="{{ $brand }}">
<svg class="{{ $logoClass }}" viewBox="0 0 1464 1430" aria-hidden="true">
@foreach ($logo as $shape)
<polygon class="{{ $shape['fill'] }}" points="{{ $shape['points'] }}" />
@endforeach
</svg>
<span>MarkasUI</span>
</a>
</x-slot:brand>
<x-slot:actions>
<x-markas.button size="sm">Get started</x-markas.button>
</x-slot:actions>
</x-markas.navbar>
<section class="{{ $hero }}">
<div aria-hidden="true" class="{{ $lines }}"></div>
<a href="/changelog" class="{{ $pill }}">
<span aria-hidden="true" class="{{ $pillDot }}"></span>
MarkasUI 1.0 is out
</a>
<h2 class="{{ $title }}">Interfaces that feel finished</h2>
<p class="{{ $lead }}">Scroll this page. The header starts clear over the hero and turns solid once content moves under it.</p>
<div class="{{ $ctas }}">
<x-markas.button>Get started</x-markas.button>
<x-markas.button variant="secondary">Browse components</x-markas.button>
</div>
</section>
<div class="{{ $grid }}">
@foreach ($features as $feature)
<div class="{{ $card }}">
<h3 class="{{ $cardTitle }}">{{ $feature['title'] }}</h3>
<p class="{{ $cardText }}">{{ $feature['text'] }}</p>
</div>
@endforeach
</div>
</div>
</div>import { useState, type UIEvent } from "react";
import { Button } from "@/components/markas/Button";
import { Navbar } from "@/components/markas/Navbar";
const logo = [
{ fill: "fill-ink/15", points: "354,578 1256,138 1171,430 268,868" },
{ fill: "fill-ink/55", points: "553,443 1455,3 1370,295 467,733" },
{ fill: "fill-success/35", points: "421,762 1325,318 1240,611 336,1050" },
{ fill: "fill-ink/30", points: "265,1073 1169,629 1084,922 180,1362" },
{ fill: "fill-ink/80", points: "93,965 997,521 912,814 8,1253" },
{ fill: "fill-success", points: "347,1135 1251,691 1166,984 262,1424" },
];
const links = [
{ label: "Components", href: "/components" },
{ label: "Templates", href: "/templates" },
{ label: "Docs", href: "/docs" },
{ label: "Pricing", href: "/pricing" },
];
const features = [
{
title: "Three frameworks",
text: "Blade, React, and Vue share the same classes and variants.",
},
{
title: "Native first",
text: "Dialog, Popover API, and details before any extra script.",
},
{
title: "Tokens only",
text: "Fifteen colour tokens keep light and dark mode in step.",
},
];
/** Scroll distance in pixels after which the bar turns solid. */
const SOLID_AFTER = 8;
const frame =
"dark h-[460px] overflow-hidden rounded-2xl border border-line bg-canvas text-ink";
const scroller =
"@container h-full overflow-y-auto focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-primary";
/** Clear over the hero, then the blur variant shows once the page scrolls. */
const bar =
"border-transparent! bg-transparent! backdrop-blur-none! transition-[background-color,border-color] duration-300 ease-out data-[scrolled=true]:border-line/60! data-[scrolled=true]:bg-surface/75! data-[scrolled=true]:backdrop-blur-md!";
const brand = "flex items-center gap-2 rounded-md";
const logoClass = "size-6";
const hero =
"relative -mt-14 grid justify-items-center gap-5 overflow-hidden bg-[radial-gradient(70%_55%_at_50%_0%,color-mix(in_oklab,var(--color-success)_38%,transparent),transparent),radial-gradient(50%_40%_at_85%_30%,color-mix(in_oklab,var(--color-ink)_10%,transparent),transparent)] px-6 pt-28 pb-14 text-center";
const lines =
"absolute inset-0 opacity-50 bg-[linear-gradient(to_right,var(--color-line)_1px,transparent_1px)] bg-size-[48px_100%] [mask-image:radial-gradient(ellipse_at_top,black,transparent_70%)]";
const pill =
"relative inline-flex items-center gap-2 rounded-full border border-line bg-surface/60 px-3 py-1 text-xs text-muted transition-colors duration-150 ease-out hover:text-ink focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary";
const pillDot = "size-1.5 rounded-full bg-success";
const title =
"relative max-w-sm text-4xl font-semibold tracking-tight text-balance";
const lead = "relative max-w-sm text-sm text-muted text-pretty";
const ctas = "relative flex flex-wrap justify-center gap-2";
const grid = "grid gap-3 px-6 pb-8 @2xl:grid-cols-3";
const card = "grid gap-1 rounded-xl border border-line bg-surface p-4";
const cardTitle = "text-sm font-medium";
const cardText = "text-sm text-muted";
export default function Example() {
const [scrolled, setScrolled] = useState(false);
const handleScroll = (event: UIEvent<HTMLElement>) =>
setScrolled(event.currentTarget.scrollTop > SOLID_AFTER);
return (
<div className={frame}>
<div
role="region"
aria-label="Landing page"
tabIndex={0}
onScroll={handleScroll}
className={scroller}
>
<Navbar
links={links}
variant="blur"
sticky
data-scrolled={scrolled}
className={bar}
brand={
<a href="/" className={brand}>
<svg
className={logoClass}
viewBox="0 0 1464 1430"
aria-hidden="true"
>
{logo.map((shape) => (
<polygon
key={shape.points}
className={shape.fill}
points={shape.points}
/>
))}
</svg>
<span>MarkasUI</span>
</a>
}
actions={<Button size="sm">Get started</Button>}
/>
<section className={hero}>
<div aria-hidden="true" className={lines} />
<a href="/changelog" className={pill}>
<span aria-hidden="true" className={pillDot} />
MarkasUI 1.0 is out
</a>
<h2 className={title}>Interfaces that feel finished</h2>
<p className={lead}>
Scroll this page. The header starts clear over the hero and turns
solid once content moves under it.
</p>
<div className={ctas}>
<Button>Get started</Button>
<Button variant="secondary">Browse components</Button>
</div>
</section>
<div className={grid}>
{features.map((feature) => (
<div key={feature.title} className={card}>
<h3 className={cardTitle}>{feature.title}</h3>
<p className={cardText}>{feature.text}</p>
</div>
))}
</div>
</div>
</div>
);
}<script setup lang="ts">
import { ref } from "vue";
import Button from "@/components/markas/Button.vue";
import Navbar from "@/components/markas/Navbar.vue";
const logo = [
{ fill: "fill-ink/15", points: "354,578 1256,138 1171,430 268,868" },
{ fill: "fill-ink/55", points: "553,443 1455,3 1370,295 467,733" },
{ fill: "fill-success/35", points: "421,762 1325,318 1240,611 336,1050" },
{ fill: "fill-ink/30", points: "265,1073 1169,629 1084,922 180,1362" },
{ fill: "fill-ink/80", points: "93,965 997,521 912,814 8,1253" },
{ fill: "fill-success", points: "347,1135 1251,691 1166,984 262,1424" },
];
const links = [
{ label: "Components", href: "/components" },
{ label: "Templates", href: "/templates" },
{ label: "Docs", href: "/docs" },
{ label: "Pricing", href: "/pricing" },
];
const features = [
{
title: "Three frameworks",
text: "Blade, React, and Vue share the same classes and variants.",
},
{
title: "Native first",
text: "Dialog, Popover API, and details before any extra script.",
},
{
title: "Tokens only",
text: "Fifteen colour tokens keep light and dark mode in step.",
},
];
/** Scroll distance in pixels after which the bar turns solid. */
const SOLID_AFTER = 8;
const frame =
"dark h-[460px] overflow-hidden rounded-2xl border border-line bg-canvas text-ink";
const scroller =
"@container h-full overflow-y-auto focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-primary";
/** Clear over the hero, then the blur variant shows once the page scrolls. */
const bar =
"border-transparent! bg-transparent! backdrop-blur-none! transition-[background-color,border-color] duration-300 ease-out data-[scrolled=true]:border-line/60! data-[scrolled=true]:bg-surface/75! data-[scrolled=true]:backdrop-blur-md!";
const brand = "flex items-center gap-2 rounded-md";
const logoClass = "size-6";
const hero =
"relative -mt-14 grid justify-items-center gap-5 overflow-hidden bg-[radial-gradient(70%_55%_at_50%_0%,color-mix(in_oklab,var(--color-success)_38%,transparent),transparent),radial-gradient(50%_40%_at_85%_30%,color-mix(in_oklab,var(--color-ink)_10%,transparent),transparent)] px-6 pt-28 pb-14 text-center";
const lines =
"absolute inset-0 opacity-50 bg-[linear-gradient(to_right,var(--color-line)_1px,transparent_1px)] bg-size-[48px_100%] [mask-image:radial-gradient(ellipse_at_top,black,transparent_70%)]";
const pill =
"relative inline-flex items-center gap-2 rounded-full border border-line bg-surface/60 px-3 py-1 text-xs text-muted transition-colors duration-150 ease-out hover:text-ink focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary";
const pillDot = "size-1.5 rounded-full bg-success";
const title =
"relative max-w-sm text-4xl font-semibold tracking-tight text-balance";
const lead = "relative max-w-sm text-sm text-muted text-pretty";
const ctas = "relative flex flex-wrap justify-center gap-2";
const grid = "grid gap-3 px-6 pb-8 @2xl:grid-cols-3";
const card = "grid gap-1 rounded-xl border border-line bg-surface p-4";
const cardTitle = "text-sm font-medium";
const cardText = "text-sm text-muted";
const scrolled = ref(false);
const handleScroll = (event: Event) => {
scrolled.value = (event.currentTarget as HTMLElement).scrollTop > SOLID_AFTER;
};
</script>
<template>
<div :class="frame">
<div
role="region"
aria-label="Landing page"
tabindex="0"
:class="scroller"
@scroll="handleScroll"
>
<Navbar
:links="links"
variant="blur"
sticky
:data-scrolled="scrolled"
:class="bar"
>
<template #brand>
<a href="/" :class="brand">
<svg :class="logoClass" viewBox="0 0 1464 1430" aria-hidden="true">
<polygon
v-for="shape in logo"
:key="shape.points"
:class="shape.fill"
:points="shape.points"
/>
</svg>
<span>MarkasUI</span>
</a>
</template>
<template #actions>
<Button size="sm">Get started</Button>
</template>
</Navbar>
<section :class="hero">
<div aria-hidden="true" :class="lines" />
<a href="/changelog" :class="pill">
<span aria-hidden="true" :class="pillDot" />
MarkasUI 1.0 is out
</a>
<h2 :class="title">Interfaces that feel finished</h2>
<p :class="lead">
Scroll this page. The header starts clear over the hero and turns
solid once content moves under it.
</p>
<div :class="ctas">
<Button>Get started</Button>
<Button variant="secondary">Browse components</Button>
</div>
</section>
<div :class="grid">
<div v-for="feature in features" :key="feature.title" :class="card">
<h3 :class="cardTitle">{{ feature.title }}</h3>
<p :class="cardText">{{ feature.text }}</p>
</div>
</div>
</div>
</div>
</template><script lang="ts">
import Button from "$lib/components/markas/Button.svelte";
import Navbar from "$lib/components/markas/Navbar.svelte";
const logo = [
{ fill: "fill-ink/15", points: "354,578 1256,138 1171,430 268,868" },
{ fill: "fill-ink/55", points: "553,443 1455,3 1370,295 467,733" },
{ fill: "fill-success/35", points: "421,762 1325,318 1240,611 336,1050" },
{ fill: "fill-ink/30", points: "265,1073 1169,629 1084,922 180,1362" },
{ fill: "fill-ink/80", points: "93,965 997,521 912,814 8,1253" },
{ fill: "fill-success", points: "347,1135 1251,691 1166,984 262,1424" },
];
const links = [
{ label: "Components", href: "/components" },
{ label: "Templates", href: "/templates" },
{ label: "Docs", href: "/docs" },
{ label: "Pricing", href: "/pricing" },
];
const features = [
{
title: "Three frameworks",
text: "Blade, React, and Vue share the same classes and variants.",
},
{
title: "Native first",
text: "Dialog, Popover API, and details before any extra script.",
},
{
title: "Tokens only",
text: "Fifteen colour tokens keep light and dark mode in step.",
},
];
/** Scroll distance in pixels after which the bar turns solid. */
const SOLID_AFTER = 8;
const frame =
"dark h-[460px] overflow-hidden rounded-2xl border border-line bg-canvas text-ink";
const scroller =
"@container h-full overflow-y-auto focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-primary";
/** Clear over the hero, then the blur variant shows once the page scrolls. */
const bar =
"border-transparent! bg-transparent! backdrop-blur-none! transition-[background-color,border-color] duration-300 ease-out data-[scrolled=true]:border-line/60! data-[scrolled=true]:bg-surface/75! data-[scrolled=true]:backdrop-blur-md!";
const brandClass = "flex items-center gap-2 rounded-md";
const logoClass = "size-6";
const hero =
"relative -mt-14 grid justify-items-center gap-5 overflow-hidden bg-[radial-gradient(70%_55%_at_50%_0%,color-mix(in_oklab,var(--color-success)_38%,transparent),transparent),radial-gradient(50%_40%_at_85%_30%,color-mix(in_oklab,var(--color-ink)_10%,transparent),transparent)] px-6 pt-28 pb-14 text-center";
const lines =
"absolute inset-0 opacity-50 bg-[linear-gradient(to_right,var(--color-line)_1px,transparent_1px)] bg-size-[48px_100%] [mask-image:radial-gradient(ellipse_at_top,black,transparent_70%)]";
const pill =
"relative inline-flex items-center gap-2 rounded-full border border-line bg-surface/60 px-3 py-1 text-xs text-muted transition-colors duration-150 ease-out hover:text-ink focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary";
const pillDot = "size-1.5 rounded-full bg-success";
const title =
"relative max-w-sm text-4xl font-semibold tracking-tight text-balance";
const lead = "relative max-w-sm text-sm text-muted text-pretty";
const ctas = "relative flex flex-wrap justify-center gap-2";
const grid = "grid gap-3 px-6 pb-8 @2xl:grid-cols-3";
const card = "grid gap-1 rounded-xl border border-line bg-surface p-4";
const cardTitle = "text-sm font-medium";
const cardText = "text-sm text-muted";
let scrolled = $state(false);
const handleScroll = (event: Event & { currentTarget: HTMLElement }) =>
(scrolled = event.currentTarget.scrollTop > SOLID_AFTER);
</script>
<div class={frame}>
<!-- svelte-ignore a11y_no_noninteractive_tabindex -->
<div
role="region"
aria-label="Landing page"
tabindex="0"
onscroll={handleScroll}
class={scroller}
>
<Navbar {links} variant="blur" sticky data-scrolled={scrolled} class={bar}>
{#snippet brand()}
<a href="/" class={brandClass}>
<svg class={logoClass} viewBox="0 0 1464 1430" aria-hidden="true">
{#each logo as shape (shape.points)}
<polygon class={shape.fill} points={shape.points} />
{/each}
</svg>
<span>MarkasUI</span>
</a>
{/snippet}
{#snippet actions()}
<Button size="sm">Get started</Button>
{/snippet}
</Navbar>
<section class={hero}>
<div aria-hidden="true" class={lines}></div>
<a href="/changelog" class={pill}>
<span aria-hidden="true" class={pillDot}></span>
MarkasUI 1.0 is out
</a>
<h2 class={title}>Interfaces that feel finished</h2>
<p class={lead}>
Scroll this page. The header starts clear over the hero and turns solid
once content moves under it.
</p>
<div class={ctas}>
<Button>Get started</Button>
<Button variant="secondary">Browse components</Button>
</div>
</section>
<div class={grid}>
{#each features as feature (feature.title)}
<div class={card}>
<h3 class={cardTitle}>{feature.title}</h3>
<p class={cardText}>{feature.text}</p>
</div>
{/each}
</div>
</div>
</div>---
import Button from "@/components/markas/Button.astro";
import Navbar from "@/components/markas/Navbar.astro";
const logo = [
{ fill: "fill-ink/15", points: "354,578 1256,138 1171,430 268,868" },
{ fill: "fill-ink/55", points: "553,443 1455,3 1370,295 467,733" },
{ fill: "fill-success/35", points: "421,762 1325,318 1240,611 336,1050" },
{ fill: "fill-ink/30", points: "265,1073 1169,629 1084,922 180,1362" },
{ fill: "fill-ink/80", points: "93,965 997,521 912,814 8,1253" },
{ fill: "fill-success", points: "347,1135 1251,691 1166,984 262,1424" },
];
const links = [
{ label: "Components", href: "/components" },
{ label: "Templates", href: "/templates" },
{ label: "Docs", href: "/docs" },
{ label: "Pricing", href: "/pricing" },
];
const features = [
{
title: "Three frameworks",
text: "Blade, React, and Vue share the same classes and variants.",
},
{
title: "Native first",
text: "Dialog, Popover API, and details before any extra script.",
},
{
title: "Tokens only",
text: "Fifteen colour tokens keep light and dark mode in step.",
},
];
/** Scroll distance in pixels after which the bar turns solid. */
const SOLID_AFTER = 8;
const frame =
"dark h-[460px] overflow-hidden rounded-2xl border border-line bg-canvas text-ink";
const scroller =
"@container h-full overflow-y-auto focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-primary";
/** Clear over the hero, then the blur variant shows once the page scrolls. */
const bar =
"border-transparent! bg-transparent! backdrop-blur-none! transition-[background-color,border-color] duration-300 ease-out data-[scrolled=true]:border-line/60! data-[scrolled=true]:bg-surface/75! data-[scrolled=true]:backdrop-blur-md!";
const brand = "flex items-center gap-2 rounded-md";
const logoClass = "size-6";
const hero =
"relative -mt-14 grid justify-items-center gap-5 overflow-hidden bg-[radial-gradient(70%_55%_at_50%_0%,color-mix(in_oklab,var(--color-success)_38%,transparent),transparent),radial-gradient(50%_40%_at_85%_30%,color-mix(in_oklab,var(--color-ink)_10%,transparent),transparent)] px-6 pt-28 pb-14 text-center";
const lines =
"absolute inset-0 opacity-50 bg-[linear-gradient(to_right,var(--color-line)_1px,transparent_1px)] bg-size-[48px_100%] [mask-image:radial-gradient(ellipse_at_top,black,transparent_70%)]";
const pill =
"relative inline-flex items-center gap-2 rounded-full border border-line bg-surface/60 px-3 py-1 text-xs text-muted transition-colors duration-150 ease-out hover:text-ink focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary";
const pillDot = "size-1.5 rounded-full bg-success";
const title =
"relative max-w-sm text-4xl font-semibold tracking-tight text-balance";
const lead = "relative max-w-sm text-sm text-muted text-pretty";
const ctas = "relative flex flex-wrap justify-center gap-2";
const grid = "grid gap-3 px-6 pb-8 @2xl:grid-cols-3";
const card = "grid gap-1 rounded-xl border border-line bg-surface p-4";
const cardTitle = "text-sm font-medium";
const cardText = "text-sm text-muted";
---
<div class={frame}>
<div
role="region"
aria-label="Landing page"
tabindex="0"
data-solid-after={SOLID_AFTER}
class={scroller}
>
<Navbar
links={links}
variant="blur"
sticky
data-scrolled="false"
class={bar}
>
<a slot="brand" href="/" class={brand}>
<svg class={logoClass} viewBox="0 0 1464 1430" aria-hidden="true">
{logo.map((shape) => <polygon class={shape.fill} points={shape.points} />)}
</svg>
<span>MarkasUI</span>
</a>
<Button slot="actions" size="sm">Get started</Button>
</Navbar>
<section class={hero}>
<div aria-hidden="true" class={lines}></div>
<a href="/changelog" class={pill}>
<span aria-hidden="true" class={pillDot}></span>
MarkasUI 1.0 is out
</a>
<h2 class={title}>Interfaces that feel finished</h2>
<p class={lead}>
Scroll this page. The header starts clear over the hero and turns solid
once content moves under it.
</p>
<div class={ctas}>
<Button>Get started</Button>
<Button variant="secondary">Browse components</Button>
</div>
</section>
<div class={grid}>
{
features.map((feature) => (
<div class={card}>
<h3 class={cardTitle}>{feature.title}</h3>
<p class={cardText}>{feature.text}</p>
</div>
))
}
</div>
</div>
</div>
<script>
// The bar turns solid once the page scrolls past data-solid-after pixels.
document.addEventListener(
"scroll",
(event) => {
const scroller = event.target;
if (!(scroller instanceof HTMLElement) || !scroller.dataset.solidAfter)
return;
const scrolled = scroller.scrollTop > Number(scroller.dataset.solidAfter);
scroller.querySelector("header")?.setAttribute("data-scrolled", String(scrolled));
},
true,
);
</script>import { Component, signal } from "@angular/core";
import { Button } from "./markas/button.component";
import {
Navbar,
type NavbarLink,
} from "./markas/navbar.component";
const logo = [
{ fill: "fill-ink/15", points: "354,578 1256,138 1171,430 268,868" },
{ fill: "fill-ink/55", points: "553,443 1455,3 1370,295 467,733" },
{ fill: "fill-success/35", points: "421,762 1325,318 1240,611 336,1050" },
{ fill: "fill-ink/30", points: "265,1073 1169,629 1084,922 180,1362" },
{ fill: "fill-ink/80", points: "93,965 997,521 912,814 8,1253" },
{ fill: "fill-success", points: "347,1135 1251,691 1166,984 262,1424" },
];
const links: NavbarLink[] = [
{ label: "Components", href: "/components" },
{ label: "Templates", href: "/templates" },
{ label: "Docs", href: "/docs" },
{ label: "Pricing", href: "/pricing" },
];
const features = [
{
title: "Three frameworks",
text: "Blade, React, and Vue share the same classes and variants.",
},
{
title: "Native first",
text: "Dialog, Popover API, and details before any extra script.",
},
{
title: "Tokens only",
text: "Fifteen colour tokens keep light and dark mode in step.",
},
];
/** Scroll distance in pixels after which the bar turns solid. */
const SOLID_AFTER = 8;
const frame =
"dark h-[460px] overflow-hidden rounded-2xl border border-line bg-canvas text-ink";
const scroller =
"@container h-full overflow-y-auto focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-primary";
/** Clear over the hero, then the blur variant shows once the page scrolls. */
const bar =
"border-transparent! bg-transparent! backdrop-blur-none! transition-[background-color,border-color] duration-300 ease-out data-[scrolled=true]:border-line/60! data-[scrolled=true]:bg-surface/75! data-[scrolled=true]:backdrop-blur-md!";
const brand = "flex items-center gap-2 rounded-md";
const logoClass = "size-6";
const hero =
"relative -mt-14 grid justify-items-center gap-5 overflow-hidden bg-[radial-gradient(70%_55%_at_50%_0%,color-mix(in_oklab,var(--color-success)_38%,transparent),transparent),radial-gradient(50%_40%_at_85%_30%,color-mix(in_oklab,var(--color-ink)_10%,transparent),transparent)] px-6 pt-28 pb-14 text-center";
const lines =
"absolute inset-0 opacity-50 bg-[linear-gradient(to_right,var(--color-line)_1px,transparent_1px)] bg-size-[48px_100%] [mask-image:radial-gradient(ellipse_at_top,black,transparent_70%)]";
const pill =
"relative inline-flex items-center gap-2 rounded-full border border-line bg-surface/60 px-3 py-1 text-xs text-muted transition-colors duration-150 ease-out hover:text-ink focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary";
const pillDot = "size-1.5 rounded-full bg-success";
const title =
"relative max-w-sm text-4xl font-semibold tracking-tight text-balance";
const lead = "relative max-w-sm text-sm text-muted text-pretty";
const ctas = "relative flex flex-wrap justify-center gap-2";
const grid = "grid gap-3 px-6 pb-8 @2xl:grid-cols-3";
const card = "grid gap-1 rounded-xl border border-line bg-surface p-4";
const cardTitle = "text-sm font-medium";
const cardText = "text-sm text-muted";
@Component({
selector: "markas-example",
imports: [Button, Navbar],
template: `
<div [class]="frame">
<div
role="region"
aria-label="Landing page"
tabindex="0"
[class]="scroller"
(scroll)="handleScroll($event)"
>
<header
markas-navbar
[links]="links"
variant="blur"
sticky
[attr.data-scrolled]="scrolled()"
[class]="bar"
>
<a brand href="/" [class]="brand">
<svg
[attr.class]="logoClass"
viewBox="0 0 1464 1430"
aria-hidden="true"
>
@for (shape of logo; track shape.points) {
<polygon
[attr.class]="shape.fill"
[attr.points]="shape.points"
/>
}
</svg>
<span>MarkasUI</span>
</a>
<button markas-button actions size="sm">Get started</button>
</header>
<section [class]="hero">
<div aria-hidden="true" [class]="lines"></div>
<a href="/changelog" [class]="pill">
<span aria-hidden="true" [class]="pillDot"></span>
MarkasUI 1.0 is out
</a>
<h2 [class]="title">Interfaces that feel finished</h2>
<p [class]="lead">
Scroll this page. The header starts clear over the hero and turns
solid once content moves under it.
</p>
<div [class]="ctas">
<button markas-button>Get started</button>
<button markas-button variant="secondary">Browse components</button>
</div>
</section>
<div [class]="grid">
@for (feature of features; track feature.title) {
<div [class]="card">
<h3 [class]="cardTitle">{{ feature.title }}</h3>
<p [class]="cardText">{{ feature.text }}</p>
</div>
}
</div>
</div>
</div>
`,
})
export default class NavbarHeroExample {
protected readonly logo = logo;
protected readonly links = links;
protected readonly features = features;
protected readonly frame = frame;
protected readonly scroller = scroller;
protected readonly bar = bar;
protected readonly brand = brand;
protected readonly logoClass = logoClass;
protected readonly hero = hero;
protected readonly lines = lines;
protected readonly pill = pill;
protected readonly pillDot = pillDot;
protected readonly title = title;
protected readonly lead = lead;
protected readonly ctas = ctas;
protected readonly grid = grid;
protected readonly card = card;
protected readonly cardTitle = cardTitle;
protected readonly cardText = cardText;
protected readonly scrolled = signal(false);
protected handleScroll(event: Event) {
this.scrolled.set((event.target as HTMLElement).scrollTop > SOLID_AFTER);
}
}Instalasi
npx markasui@latest add navbarpnpm dlx markasui@latest add navbaryarn dlx markasui@latest add navbarbunx --bun markasui@latest add navbar- 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/navbar.blade.php.
@props([
'links' => [],
'variant' => 'default',
'sticky' => false,
'menuLabel' => 'Menu',
'navLabel' => 'Main',
'mobileNavLabel' => 'Main mobile',
])
@php
$root = '@container w-full **:focus-visible:outline-2 **:focus-visible:outline-offset-2 **:focus-visible:outline-primary motion-reduce:**:transition-none';
$variants = [
'default' => 'top-0 border-b border-line bg-surface',
'floating' => 'top-3 rounded-2xl border border-line bg-surface shadow-overlay',
'blur' => 'top-0 border-b border-line/60 bg-surface/70 backdrop-blur-md',
];
$stickyClass = 'sticky z-40';
$bar = 'flex h-14 items-center gap-4 px-3 @sm:px-4';
$brandClass = 'flex shrink-0 items-center gap-2 text-sm font-semibold text-ink';
$desktopNav = 'relative hidden items-center @2xl:flex';
$indicator = 'absolute inset-y-0 left-0 rounded-md bg-subtle transition-[translate,width] duration-200 ease-out';
$list = 'relative flex items-center';
$item = 'flex h-9 cursor-pointer items-center justify-between gap-1 rounded-md px-3 text-sm font-medium whitespace-nowrap text-muted transition-colors duration-150 ease-out hover:text-ink aria-expanded:text-ink aria-[current]:bg-subtle aria-[current]:text-ink @max-2xl:hover:bg-subtle [&::-webkit-details-marker]:hidden';
$chevron = 'size-3.5 text-faint transition-transform duration-200 ease-out in-aria-expanded:rotate-180 in-open:rotate-180';
$panel = 'inset-auto m-0 rounded-xl border border-line bg-surface p-2 text-ink shadow-overlay transition-[opacity,translate] duration-200 ease-out starting:open:translate-y-1.5 starting:open:opacity-0';
$panelList = 'grid grid-flow-col grid-rows-3 gap-1';
$panelLink = 'flex w-64 items-start gap-3 rounded-lg p-3 text-sm transition-colors duration-150 ease-out hover:bg-subtle focus-visible:bg-subtle';
$iconClass = 'size-9 shrink-0 rounded-md border border-line bg-canvas p-[7px]';
$linkBody = 'grid gap-0.5';
$linkTitle = 'font-medium';
$linkDescription = 'text-muted';
$actionsClass = 'ml-auto flex items-center gap-2';
$toggle = 'inline-flex size-9 shrink-0 items-center justify-center rounded-md text-ink transition-colors duration-150 ease-out hover:bg-subtle @2xl:hidden';
$openIcon = 'size-5 in-aria-expanded:hidden';
$closeIcon = 'hidden size-5 in-aria-expanded:block';
$mobilePanel = 'border-t border-line px-4 py-2 transition-[opacity,translate] duration-200 ease-out starting:-translate-y-1 starting:opacity-0 @2xl:hidden';
$mobileList = 'grid gap-1';
$groupList = 'my-1 ml-3 grid gap-1 border-l border-line pl-2 transition-[opacity,translate] duration-200 ease-out starting:-translate-y-1 starting:opacity-0';
// 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]/', '', (string) $href)) === 1 ? '#' : (string) ($href ?? '#');
$svg = 'viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"';
$links = array_values($links);
// Same id on every render, so Livewire's morph (which matches elements by id) keeps the element. Pass `id` to set it.
$idKey = 'markas-navbar|'.(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-navbar-'.hash('xxh32', $idKey.$idIndex);
$menuId = $id.'-menu';
@endphp
<header
x-data="{
open: false,
timer: null,
{{-- Jeda sebelum panel terbuka saat kursor singgah, dan sebelum tertutup saat kursor pergi. Jarak panel dari pemicu dan tepi layar. --}}
openDelay: 120,
closeDelay: 180,
gap: 8,
{{-- Geser indikator ke item yang di-hover, panel terbuka, atau item aktif, lalu letakkan panel terbuka di bawah pemicunya. --}}
sync() {
const nav = this.$refs.nav;
const find = (selector) => nav.querySelector(selector);
const open = find('[aria-expanded=true]');
const target = find(':scope>ul>li:hover>:first-child') ?? open ?? find('[aria-current]');
const pill = nav.firstElementChild;
pill.hidden = !target;
if (target) {
pill.style.width = target.offsetWidth + 'px';
pill.style.translate = target.offsetLeft + 'px 0';
}
const popover = open?.nextElementSibling;
if (!popover) return;
const box = open.getBoundingClientRect();
const maxLeft = innerWidth - popover.offsetWidth - this.gap;
popover.style.top = (box.bottom + this.gap) + 'px';
popover.style.left = Math.max(this.gap, Math.min(box.left, maxLeft)) + 'px';
},
destroy() {
clearTimeout(this.timer);
},
onEscape() {
if (!this.open) return;
this.open = false;
this.$refs.toggle.focus();
},
{{-- Hover mouse: masuk ke item dropdown membukanya setelah jeda, keluar menutupnya setelah jeda. Item tanpa dropdown tidak membatalkan jeda tutup. --}}
onHover(event) {
const panel = event.currentTarget.querySelector('[popover]');
this.sync();
if (event.pointerType !== 'mouse' || !panel) return;
const enter = event.type === 'pointerenter';
clearTimeout(this.timer);
this.timer = setTimeout(() => panel.togglePopover(enter), enter ? this.openDelay : this.closeDelay);
},
{{-- Klik mouse pada pemicu yang sudah terbuka (biasanya oleh hover) tidak menutupnya. --}}
onClick(event) {
if (event.detail && event.currentTarget.matches('[aria-expanded=true]')) event.preventDefault();
},
{{-- ArrowDown di pemicu membuka panel dan memfokuskan link pertama. --}}
onTriggerKeydown(event) {
const panel = event.currentTarget.nextElementSibling;
if (event.key !== 'ArrowDown') return;
event.preventDefault();
panel.showPopover();
panel.querySelector('a')?.focus();
},
{{-- beforetoggle berjalan sinkron sehingga aria-expanded selalu terbaru; toggle meletakkan panel setelah tampil. --}}
onToggle(event) {
event.target.previousElementSibling.setAttribute('aria-expanded', String(event.newState === 'open'));
this.sync();
},
}"
@keydown.escape="onEscape()"
{{ $attributes->merge(['id' => $id])->class([$root, $variants[$variant] ?? $variants['default'], $stickyClass => $sticky]) }}
>
<div class="{{ $bar }}">
@isset($brand)
<div class="{{ $brandClass }}">{{ $brand }}</div>
@endisset
<nav x-ref="nav" aria-label="{{ $navLabel }}" class="{{ $desktopNav }}">
<span aria-hidden="true" hidden class="{{ $indicator }}"></span>
<ul class="{{ $list }}">
@foreach ($links as $index => $entry)
@php
$children = $entry['children'] ?? [];
$panelId = $id.'-panel-'.$index;
@endphp
<li @pointerenter="onHover($event)" @pointerleave="onHover($event)">
@if (count($children) > 0)
<button
type="button"
popovertarget="{{ $panelId }}"
aria-expanded="false"
aria-controls="{{ $panelId }}"
class="{{ $item }}"
@click="onClick($event)"
@keydown="onTriggerKeydown($event)"
>{{ $entry['label'] }}<svg class="{{ $chevron }}" {!! $svg !!}><path d="m6 9 6 6 6-6" /></svg></button>
<div
id="{{ $panelId }}"
popover="auto"
wire:ignore.self
class="{{ $panel }}"
@beforetoggle="onToggle($event)"
@toggle="onToggle($event)"
>
<ul class="{{ $panelList }}">
@foreach ($children as $child)
<li>
<a href="{{ $safeHref($child['href'] ?? null) }}" class="{{ $panelLink }}">
@if (! empty($child['icon']))
<svg class="{{ $iconClass }}" {!! $svg !!}><path d="{{ $child['icon'] }}" /></svg>
@endif
<span class="{{ $linkBody }}">
<span class="{{ $linkTitle }}">{{ $child['label'] }}</span>
@if (! empty($child['description']))
<span class="{{ $linkDescription }}">{{ $child['description'] }}</span>
@endif
</span>
</a>
</li>
@endforeach
</ul>
</div>
@else
<a href="{{ $safeHref($entry['href'] ?? null) }}" @if (! empty($entry['active'])) aria-current="page" @endif class="{{ $item }}">{{ $entry['label'] }}</a>
@endif
</li>
@endforeach
</ul>
</nav>
<div class="{{ $actionsClass }}">
{{ $actions ?? '' }}
<button
type="button"
x-ref="toggle"
aria-label="{{ $menuLabel }}"
aria-expanded="false"
aria-controls="{{ $menuId }}"
:aria-expanded="open ? 'true' : 'false'"
@click="open = ! open"
class="{{ $toggle }}"
>
<svg class="{{ $openIcon }}" {!! $svg !!}><path d="M4 6h16M4 12h16M4 18h16" /></svg>
<svg class="{{ $closeIcon }}" {!! $svg !!}><path d="M18 6 6 18M6 6l12 12" /></svg>
</button>
</div>
</div>
<div
id="{{ $menuId }}"
data-state="closed"
hidden
:data-state="open ? 'open' : 'closed'"
:hidden="! open"
class="{{ $mobilePanel }}"
>
<nav aria-label="{{ $mobileNavLabel }}" class="{{ $mobileList }}">
@foreach ($links as $entry)
@if (count($entry['children'] ?? []) > 0)
<details wire:ignore.self>
<summary class="{{ $item }}">{{ $entry['label'] }}<svg class="{{ $chevron }}" {!! $svg !!}><path d="m6 9 6 6 6-6" /></svg></summary>
<div class="{{ $groupList }}">
@foreach ($entry['children'] as $child)
<a href="{{ $safeHref($child['href'] ?? null) }}" class="{{ $item }}">{{ $child['label'] }}</a>
@endforeach
</div>
</details>
@else
<a href="{{ $safeHref($entry['href'] ?? null) }}" @if (! empty($entry['active'])) aria-current="page" @endif class="{{ $item }}">{{ $entry['label'] }}</a>
@endif
@endforeach
</nav>
</div>
</header>- Pastikan Tailwind CSS v4 dan markas.css sudah terpasang. Lihat Instalasi.
- Salin source komponen di bawah ini ke
src/components/markas/Navbar.tsx.
"use client";
import {
useEffect,
useId,
useRef,
useState,
type ComponentProps,
type KeyboardEvent,
type MouseEvent,
type PointerEvent,
type ReactNode,
type ToggleEvent,
} from "react";
const root =
"@container w-full **:focus-visible:outline-2 **:focus-visible:outline-offset-2 **:focus-visible:outline-primary motion-reduce:**:transition-none";
const variants = {
default: "top-0 border-b border-line bg-surface",
floating: "top-3 rounded-2xl border border-line bg-surface shadow-overlay",
blur: "top-0 border-b border-line/60 bg-surface/70 backdrop-blur-md",
};
const stickyClass = "sticky z-40";
const bar = "flex h-14 items-center gap-4 px-3 @sm:px-4";
const brandClass =
"flex shrink-0 items-center gap-2 text-sm font-semibold text-ink";
const desktopNav = "relative hidden items-center @2xl:flex";
const indicator =
"absolute inset-y-0 left-0 rounded-md bg-subtle transition-[translate,width] duration-200 ease-out";
const list = "relative flex items-center";
const item =
"flex h-9 cursor-pointer items-center justify-between gap-1 rounded-md px-3 text-sm font-medium whitespace-nowrap text-muted transition-colors duration-150 ease-out hover:text-ink aria-expanded:text-ink aria-[current]:bg-subtle aria-[current]:text-ink @max-2xl:hover:bg-subtle [&::-webkit-details-marker]:hidden";
const chevron =
"size-3.5 text-faint transition-transform duration-200 ease-out in-aria-expanded:rotate-180 in-open:rotate-180";
const panel =
"inset-auto m-0 rounded-xl border border-line bg-surface p-2 text-ink shadow-overlay transition-[opacity,translate] duration-200 ease-out starting:open:translate-y-1.5 starting:open:opacity-0";
const panelList = "grid grid-flow-col grid-rows-3 gap-1";
const panelLink =
"flex w-64 items-start gap-3 rounded-lg p-3 text-sm transition-colors duration-150 ease-out hover:bg-subtle focus-visible:bg-subtle";
const iconClass =
"size-9 shrink-0 rounded-md border border-line bg-canvas p-[7px]";
const linkBody = "grid gap-0.5";
const linkTitle = "font-medium";
const linkDescription = "text-muted";
const actionsClass = "ml-auto flex items-center gap-2";
const toggle =
"inline-flex size-9 shrink-0 items-center justify-center rounded-md text-ink transition-colors duration-150 ease-out hover:bg-subtle @2xl:hidden";
const openIcon = "size-5 in-aria-expanded:hidden";
const closeIcon = "hidden size-5 in-aria-expanded:block";
const mobilePanel =
"border-t border-line px-4 py-2 transition-[opacity,translate] duration-200 ease-out starting:-translate-y-1 starting:opacity-0 @2xl:hidden";
const mobileList = "grid gap-1";
const groupList =
"my-1 ml-3 grid gap-1 border-l border-line pl-2 transition-[opacity,translate] duration-200 ease-out starting:-translate-y-1 starting:opacity-0";
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 = "#") =>
/^(?!https?:|mailto:|tel:)[a-z][\w+.-]*:/i.test(href.replace(/[\0- ]/g, ""))
? "#"
: href;
/** Jeda sebelum panel terbuka saat kursor singgah, dan sebelum tertutup saat kursor pergi. */
const OPEN_DELAY = 120;
const CLOSE_DELAY = 180;
/** Jarak panel dari pemicu dan dari tepi layar. */
const GAP = 8;
/**
* Geser indikator ke item yang di-hover, panel terbuka, atau item aktif, lalu letakkan panel terbuka
* di bawah pemicunya. Indikator adalah anak pertama nav, panel adalah saudara berikutnya dari pemicu.
*/
function sync(nav: Element) {
const find = (selector: string) => nav.querySelector<HTMLElement>(selector);
const open = find("[aria-expanded=true]");
const target =
find(":scope>ul>li:hover>:first-child") ?? open ?? find("[aria-current]");
const pill = nav.firstElementChild as HTMLElement;
pill.hidden = !target;
if (target) {
pill.style.width = `${target.offsetWidth}px`;
pill.style.translate = `${target.offsetLeft}px 0`;
}
const popover = open?.nextElementSibling as HTMLElement | undefined;
if (!popover) return;
const box = open!.getBoundingClientRect();
const maxLeft = innerWidth - popover.offsetWidth - GAP;
popover.style.top = `${box.bottom + GAP}px`;
popover.style.left = `${Math.max(GAP, Math.min(box.left, maxLeft))}px`;
}
export type NavbarChild = {
label: string;
href: string;
description?: string;
/** Data path SVG (atribut d) untuk ikon 24x24 bergaris. */
icon?: string;
};
export type NavbarLink = {
label: ReactNode;
/** Tujuan link biasa. Diabaikan bila item punya children. */
href?: string;
active?: boolean;
/** Link di dropdown. Item dengan children menjadi pemicu dropdown. */
children?: NavbarChild[];
};
export type NavbarProps = ComponentProps<"header"> & {
links?: NavbarLink[];
brand?: ReactNode;
actions?: ReactNode;
/** default: garis bawah tipis, floating: mengambang membulat, blur: latar semi transparan. */
variant?: keyof typeof variants;
sticky?: boolean;
/** Accessible label of the mobile menu button. */
menuLabel?: string;
/** Accessible label of the desktop nav element. */
navLabel?: string;
/** Accessible label of the mobile nav element. */
mobileNavLabel?: string;
};
const svg = (path: string, className: string) => (
<svg
className={className}
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
strokeWidth="1.5"
strokeLinecap="round"
strokeLinejoin="round"
aria-hidden="true"
>
<path d={path} />
</svg>
);
/** Klik mouse pada pemicu yang sudah terbuka (biasanya oleh hover) tidak menutupnya. */
const handleClick = (event: MouseEvent<HTMLElement>) => {
if (event.detail && event.currentTarget.matches("[aria-expanded=true]"))
event.preventDefault();
};
/** ArrowDown di pemicu membuka panel dan memfokuskan link pertama. */
const handleTriggerKeyDown = (event: KeyboardEvent<HTMLElement>) => {
const panel = event.currentTarget.nextElementSibling as HTMLElement;
if (event.key !== "ArrowDown") return;
event.preventDefault();
panel.showPopover();
panel.querySelector("a")?.focus();
};
/** beforetoggle berjalan sinkron sehingga aria-expanded selalu terbaru; toggle meletakkan panel setelah tampil. */
const handleToggle = (event: ToggleEvent<HTMLElement>) => {
const panel = event.currentTarget;
panel.previousElementSibling!.setAttribute(
"aria-expanded",
String(event.newState === "open"),
);
sync(panel.closest("nav")!);
};
export function Navbar({
links = [],
brand,
actions,
variant = "default",
sticky = false,
menuLabel = "Menu",
navLabel = "Main",
mobileNavLabel = "Main mobile",
id,
className,
onKeyDown,
...props
}: NavbarProps) {
const generatedId = useId();
const navbarId = id ?? generatedId;
const menuId = `${navbarId}-menu`;
const [open, setOpen] = useState(false);
const toggleRef = useRef<HTMLButtonElement>(null);
const timer = useRef<ReturnType<typeof setTimeout>>(undefined);
useEffect(() => () => clearTimeout(timer.current), []);
const handleKeyDown = (event: KeyboardEvent<HTMLElement>) => {
if (event.key === "Escape" && open) {
setOpen(false);
toggleRef.current?.focus();
}
onKeyDown?.(event);
};
/** Hover mouse: masuk ke item dropdown membukanya setelah jeda, keluar menutupnya setelah jeda. Item tanpa dropdown tidak membatalkan jeda tutup. */
const handleHover = (event: PointerEvent<HTMLElement>) => {
const item = event.currentTarget;
const panel = item.querySelector<HTMLElement>("[popover]");
sync(item.closest("nav")!);
if (event.pointerType !== "mouse" || !panel) return;
const enter = event.type === "pointerenter";
clearTimeout(timer.current);
timer.current = setTimeout(
() => panel.togglePopover(enter),
enter ? OPEN_DELAY : CLOSE_DELAY,
);
};
return (
<header
id={navbarId}
className={cx(root, variants[variant], sticky && stickyClass, className)}
onKeyDown={handleKeyDown}
{...props}
>
<div className={bar}>
{brand && <div className={brandClass}>{brand}</div>}
<nav aria-label={navLabel} className={desktopNav}>
<span aria-hidden="true" hidden className={indicator} />
<ul className={list}>
{links.map((entry, index) => {
const panelId = `${navbarId}-panel-${index}`;
return (
<li
key={index}
onPointerEnter={handleHover}
onPointerLeave={handleHover}
>
{entry.children?.length ? (
<>
<button
type="button"
popoverTarget={panelId}
aria-expanded="false"
aria-controls={panelId}
className={item}
onClick={handleClick}
onKeyDown={handleTriggerKeyDown}
>
{entry.label}
{svg("m6 9 6 6 6-6", chevron)}
</button>
<div
id={panelId}
popover="auto"
className={panel}
onBeforeToggle={handleToggle}
onToggle={handleToggle}
>
<ul className={panelList}>
{entry.children.map((child, childIndex) => (
<li key={childIndex}>
<a
href={safeHref(child.href)}
className={panelLink}
>
{child.icon && svg(child.icon, iconClass)}
<span className={linkBody}>
<span className={linkTitle}>
{child.label}
</span>
{child.description && (
<span className={linkDescription}>
{child.description}
</span>
)}
</span>
</a>
</li>
))}
</ul>
</div>
</>
) : (
<a
href={safeHref(entry.href)}
aria-current={entry.active ? "page" : undefined}
className={item}
>
{entry.label}
</a>
)}
</li>
);
})}
</ul>
</nav>
<div className={actionsClass}>
{actions}
<button
ref={toggleRef}
type="button"
aria-label={menuLabel}
aria-expanded={open}
aria-controls={menuId}
onClick={() => setOpen((value) => !value)}
className={toggle}
>
{svg("M4 6h16M4 12h16M4 18h16", openIcon)}
{svg("M18 6 6 18M6 6l12 12", closeIcon)}
</button>
</div>
</div>
<div
id={menuId}
data-state={open ? "open" : "closed"}
hidden={!open}
className={mobilePanel}
>
<nav aria-label={mobileNavLabel} className={mobileList}>
{links.map((entry, index) =>
entry.children?.length ? (
<details key={index}>
<summary className={item}>
{entry.label}
{svg("m6 9 6 6 6-6", chevron)}
</summary>
<div className={groupList}>
{entry.children.map((child, childIndex) => (
<a
key={childIndex}
href={safeHref(child.href)}
className={item}
>
{child.label}
</a>
))}
</div>
</details>
) : (
<a
key={index}
href={safeHref(entry.href)}
aria-current={entry.active ? "page" : undefined}
className={item}
>
{entry.label}
</a>
),
)}
</nav>
</div>
</header>
);
}- Pastikan Tailwind CSS v4 dan markas.css sudah terpasang. Lihat Instalasi.
- Salin source komponen di bawah ini ke
src/components/markas/Navbar.vue.
<script setup lang="ts">
import { onBeforeUnmount, ref, useId } from "vue";
export type NavbarChild = {
label: string;
href: string;
description?: string;
/** Data path SVG (atribut d) untuk ikon 24x24 bergaris. */
icon?: string;
};
export type NavbarLink = {
label: string;
/** Tujuan link biasa. Diabaikan bila item punya children. */
href?: string;
active?: boolean;
/** Link di dropdown. Item dengan children menjadi pemicu dropdown. */
children?: NavbarChild[];
};
const props = withDefaults(
defineProps<{
links?: NavbarLink[];
/** default: garis bawah tipis, floating: mengambang membulat, blur: latar semi transparan. */
variant?: "default" | "floating" | "blur";
sticky?: boolean;
id?: string;
menuLabel?: string;
navLabel?: string;
mobileNavLabel?: string;
}>(),
{
links: () => [],
variant: "default",
sticky: false,
id: undefined,
menuLabel: "Menu",
navLabel: "Main",
mobileNavLabel: "Main mobile",
},
);
const root =
"@container w-full **:focus-visible:outline-2 **:focus-visible:outline-offset-2 **:focus-visible:outline-primary motion-reduce:**:transition-none";
const variants = {
default: "top-0 border-b border-line bg-surface",
floating: "top-3 rounded-2xl border border-line bg-surface shadow-overlay",
blur: "top-0 border-b border-line/60 bg-surface/70 backdrop-blur-md",
};
const stickyClass = "sticky z-40";
const bar = "flex h-14 items-center gap-4 px-3 @sm:px-4";
const brandClass =
"flex shrink-0 items-center gap-2 text-sm font-semibold text-ink";
const desktopNav = "relative hidden items-center @2xl:flex";
const indicator =
"absolute inset-y-0 left-0 rounded-md bg-subtle transition-[translate,width] duration-200 ease-out";
const list = "relative flex items-center";
const item =
"flex h-9 cursor-pointer items-center justify-between gap-1 rounded-md px-3 text-sm font-medium whitespace-nowrap text-muted transition-colors duration-150 ease-out hover:text-ink aria-expanded:text-ink aria-[current]:bg-subtle aria-[current]:text-ink @max-2xl:hover:bg-subtle [&::-webkit-details-marker]:hidden";
const chevron =
"size-3.5 text-faint transition-transform duration-200 ease-out in-aria-expanded:rotate-180 in-open:rotate-180";
const panel =
"inset-auto m-0 rounded-xl border border-line bg-surface p-2 text-ink shadow-overlay transition-[opacity,translate] duration-200 ease-out starting:open:translate-y-1.5 starting:open:opacity-0";
const panelList = "grid grid-flow-col grid-rows-3 gap-1";
const panelLink =
"flex w-64 items-start gap-3 rounded-lg p-3 text-sm transition-colors duration-150 ease-out hover:bg-subtle focus-visible:bg-subtle";
const iconClass =
"size-9 shrink-0 rounded-md border border-line bg-canvas p-[7px]";
const linkBody = "grid gap-0.5";
const linkTitle = "font-medium";
const linkDescription = "text-muted";
const actionsClass = "ml-auto flex items-center gap-2";
const toggle =
"inline-flex size-9 shrink-0 items-center justify-center rounded-md text-ink transition-colors duration-150 ease-out hover:bg-subtle @2xl:hidden";
const openIcon = "size-5 in-aria-expanded:hidden";
const closeIcon = "hidden size-5 in-aria-expanded:block";
const mobilePanel =
"border-t border-line px-4 py-2 transition-[opacity,translate] duration-200 ease-out starting:-translate-y-1 starting:opacity-0 @2xl:hidden";
const mobileList = "grid gap-1";
const groupList =
"my-1 ml-3 grid gap-1 border-l border-line pl-2 transition-[opacity,translate] duration-200 ease-out starting:-translate-y-1 starting:opacity-0";
/** Href berskema selain http, https, mailto, dan tel (misalnya javascript:) diganti "#". Spasi dan karakter kontrol diabaikan seperti di browser. */
const safeHref = (href = "#") =>
/^(?!https?:|mailto:|tel:)[a-z][\w+.-]*:/i.test(href.replace(/[\0- ]/g, ""))
? "#"
: href;
/** Jeda sebelum panel terbuka saat kursor singgah, dan sebelum tertutup saat kursor pergi. */
const OPEN_DELAY = 120;
const CLOSE_DELAY = 180;
/** Jarak panel dari pemicu dan dari tepi layar. */
const GAP = 8;
/**
* Geser indikator ke item yang di-hover, panel terbuka, atau item aktif, lalu letakkan panel terbuka
* di bawah pemicunya. Indikator adalah anak pertama nav, panel adalah saudara berikutnya dari pemicu.
*/
function sync(nav: Element) {
const find = (selector: string) => nav.querySelector<HTMLElement>(selector);
const open = find("[aria-expanded=true]");
const target =
find(":scope>ul>li:hover>:first-child") ?? open ?? find("[aria-current]");
const pill = nav.firstElementChild as HTMLElement;
pill.hidden = !target;
if (target) {
pill.style.width = `${target.offsetWidth}px`;
pill.style.translate = `${target.offsetLeft}px 0`;
}
const popover = open?.nextElementSibling as HTMLElement | undefined;
if (!popover) return;
const box = open!.getBoundingClientRect();
const maxLeft = innerWidth - popover.offsetWidth - GAP;
popover.style.top = `${box.bottom + GAP}px`;
popover.style.left = `${Math.max(GAP, Math.min(box.left, maxLeft))}px`;
}
const svgAttrs = {
viewBox: "0 0 24 24",
fill: "none",
stroke: "currentColor",
"stroke-width": "1.5",
"stroke-linecap": "round",
"stroke-linejoin": "round",
"aria-hidden": "true",
} as const;
const generatedId = useId();
const navbarId = props.id ?? generatedId;
const open = ref(false);
let timer: ReturnType<typeof setTimeout> | undefined;
onBeforeUnmount(() => clearTimeout(timer));
function onEscape(event: KeyboardEvent) {
if (!open.value) return;
open.value = false;
(event.currentTarget as Element)
.querySelector<HTMLElement>("[aria-controls$=-menu]")
?.focus();
}
/** Hover mouse: masuk ke item dropdown membukanya setelah jeda, keluar menutupnya setelah jeda. Item tanpa dropdown tidak membatalkan jeda tutup. */
function onHover(event: PointerEvent) {
const item = event.currentTarget as Element;
const panel = item.querySelector<HTMLElement>("[popover]");
sync(item.closest("nav")!);
if (event.pointerType !== "mouse" || !panel) return;
const enter = event.type === "pointerenter";
clearTimeout(timer);
timer = setTimeout(
() => panel.togglePopover(enter),
enter ? OPEN_DELAY : CLOSE_DELAY,
);
}
// Klik mouse pada pemicu yang sudah terbuka (biasanya oleh hover) tidak menutupnya.
function onClick(event: MouseEvent) {
const trigger = event.currentTarget as Element;
if (event.detail && trigger.matches("[aria-expanded=true]"))
event.preventDefault();
}
// ArrowDown di pemicu membuka panel dan memfokuskan link pertama.
function onKeydown(event: KeyboardEvent) {
const panel = (event.currentTarget as HTMLElement)
.nextElementSibling as HTMLElement;
if (event.key !== "ArrowDown") return;
event.preventDefault();
panel.showPopover();
panel.querySelector("a")?.focus();
}
// beforetoggle berjalan sinkron sehingga aria-expanded selalu terbaru; toggle meletakkan panel setelah tampil.
function onToggle(event: ToggleEvent) {
const panel = event.target as HTMLElement;
panel.previousElementSibling!.setAttribute(
"aria-expanded",
String(event.newState === "open"),
);
sync(panel.closest("nav")!);
}
</script>
<template>
<header
:id="navbarId"
:class="[root, variants[props.variant], props.sticky && stickyClass]"
@keydown.escape="onEscape"
>
<div :class="bar">
<div v-if="$slots.brand" :class="brandClass"><slot name="brand" /></div>
<nav :aria-label="props.navLabel" :class="desktopNav">
<span aria-hidden="true" hidden :class="indicator" />
<ul :class="list">
<li
v-for="(entry, index) in props.links"
:key="index"
@pointerenter="onHover"
@pointerleave="onHover"
>
<template v-if="entry.children?.length">
<button
type="button"
:popovertarget="`${navbarId}-panel-${index}`"
aria-expanded="false"
:aria-controls="`${navbarId}-panel-${index}`"
:class="item"
@click="onClick"
@keydown="onKeydown"
>
{{ entry.label
}}<svg :class="chevron" v-bind="svgAttrs">
<path d="m6 9 6 6 6-6" />
</svg>
</button>
<div
:id="`${navbarId}-panel-${index}`"
popover="auto"
:class="panel"
@beforetoggle="onToggle"
@toggle="onToggle"
>
<ul :class="panelList">
<li
v-for="(child, childIndex) in entry.children"
:key="childIndex"
>
<a :href="safeHref(child.href)" :class="panelLink">
<svg
v-if="child.icon"
:class="iconClass"
v-bind="svgAttrs"
>
<path :d="child.icon" />
</svg>
<span :class="linkBody">
<span :class="linkTitle">{{ child.label }}</span>
<span
v-if="child.description"
:class="linkDescription"
>{{ child.description }}</span
>
</span>
</a>
</li>
</ul>
</div>
</template>
<a
v-else
:href="safeHref(entry.href)"
:aria-current="entry.active ? 'page' : undefined"
:class="item"
>{{ entry.label }}</a
>
</li>
</ul>
</nav>
<div :class="actionsClass">
<slot name="actions" />
<button
type="button"
:aria-label="props.menuLabel"
:aria-expanded="open ? 'true' : 'false'"
:aria-controls="`${navbarId}-menu`"
:class="toggle"
@click="open = !open"
>
<svg :class="openIcon" v-bind="svgAttrs">
<path d="M4 6h16M4 12h16M4 18h16" />
</svg>
<svg :class="closeIcon" v-bind="svgAttrs">
<path d="M18 6 6 18M6 6l12 12" />
</svg>
</button>
</div>
</div>
<div
:id="`${navbarId}-menu`"
:data-state="open ? 'open' : 'closed'"
:hidden="!open"
:class="mobilePanel"
>
<nav :aria-label="props.mobileNavLabel" :class="mobileList">
<template v-for="(entry, index) in props.links" :key="index">
<details v-if="entry.children?.length">
<summary :class="item">
{{ entry.label
}}<svg :class="chevron" v-bind="svgAttrs">
<path d="m6 9 6 6 6-6" />
</svg>
</summary>
<div :class="groupList">
<a
v-for="(child, childIndex) in entry.children"
:key="childIndex"
:href="safeHref(child.href)"
:class="item"
>{{ child.label }}</a
>
</div>
</details>
<a
v-else
:href="safeHref(entry.href)"
:aria-current="entry.active ? 'page' : undefined"
:class="item"
>{{ entry.label }}</a
>
</template>
</nav>
</div>
</header>
</template>- Pastikan Tailwind CSS v4 dan markas.css sudah terpasang. Lihat Instalasi.
- Salin source komponen di bawah ini ke
src/lib/components/markas/Navbar.svelte.
<script lang="ts" module>
export type NavbarChild = {
label: string;
href: string;
description?: string;
/** SVG path data (d attribute) for a 24x24 stroke icon. */
icon?: string;
};
export type NavbarLink = {
label: string;
/** Plain link target. Ignored when the item has children. */
href?: string;
active?: boolean;
/** Dropdown links. An item with children becomes a dropdown trigger. */
children?: NavbarChild[];
};
</script>
<script lang="ts">
import { onDestroy, type Snippet } from "svelte";
import type { HTMLAttributes } from "svelte/elements";
const root =
"@container w-full **:focus-visible:outline-2 **:focus-visible:outline-offset-2 **:focus-visible:outline-primary motion-reduce:**:transition-none";
const variants = {
default: "top-0 border-b border-line bg-surface",
floating: "top-3 rounded-2xl border border-line bg-surface shadow-overlay",
blur: "top-0 border-b border-line/60 bg-surface/70 backdrop-blur-md",
};
const stickyClass = "sticky z-40";
const bar = "flex h-14 items-center gap-4 px-3 @sm:px-4";
const brandClass =
"flex shrink-0 items-center gap-2 text-sm font-semibold text-ink";
const desktopNav = "relative hidden items-center @2xl:flex";
const indicator =
"absolute inset-y-0 left-0 rounded-md bg-subtle transition-[translate,width] duration-200 ease-out";
const list = "relative flex items-center";
const item =
"flex h-9 cursor-pointer items-center justify-between gap-1 rounded-md px-3 text-sm font-medium whitespace-nowrap text-muted transition-colors duration-150 ease-out hover:text-ink aria-expanded:text-ink aria-[current]:bg-subtle aria-[current]:text-ink @max-2xl:hover:bg-subtle [&::-webkit-details-marker]:hidden";
const chevron =
"size-3.5 text-faint transition-transform duration-200 ease-out in-aria-expanded:rotate-180 in-open:rotate-180";
const panel =
"inset-auto m-0 rounded-xl border border-line bg-surface p-2 text-ink shadow-overlay transition-[opacity,translate] duration-200 ease-out starting:open:translate-y-1.5 starting:open:opacity-0";
const panelList = "grid grid-flow-col grid-rows-3 gap-1";
const panelLink =
"flex w-64 items-start gap-3 rounded-lg p-3 text-sm transition-colors duration-150 ease-out hover:bg-subtle focus-visible:bg-subtle";
const iconClass =
"size-9 shrink-0 rounded-md border border-line bg-canvas p-[7px]";
const linkBody = "grid gap-0.5";
const linkTitle = "font-medium";
const linkDescription = "text-muted";
const actionsClass = "ml-auto flex items-center gap-2";
const toggle =
"inline-flex size-9 shrink-0 items-center justify-center rounded-md text-ink transition-colors duration-150 ease-out hover:bg-subtle @2xl:hidden";
const openIcon = "size-5 in-aria-expanded:hidden";
const closeIcon = "hidden size-5 in-aria-expanded:block";
const mobilePanel =
"border-t border-line px-4 py-2 transition-[opacity,translate] duration-200 ease-out starting:-translate-y-1 starting:opacity-0 @2xl:hidden";
const mobileList = "grid gap-1";
const groupList =
"my-1 ml-3 grid gap-1 border-l border-line pl-2 transition-[opacity,translate] duration-200 ease-out starting:-translate-y-1 starting:opacity-0";
/** Hrefs with a scheme other than http, https, mailto, and tel (javascript: for one) become "#". Spaces and control characters are ignored like browsers do. */
const safeHref = (href = "#") =>
/^(?!https?:|mailto:|tel:)[a-z][\w+.-]*:/i.test(href.replace(/[\0- ]/g, ""))
? "#"
: href;
/** Delay before a panel opens when the pointer lingers, and before it closes when the pointer leaves. */
const OPEN_DELAY = 120;
const CLOSE_DELAY = 180;
/** Distance of the panel from its trigger and from the viewport edge. */
const GAP = 8;
/**
* Slide the indicator to the hovered item, the open panel, or the active item, then place the
* open panel under its trigger. The indicator is the nav's first child, the panel is the trigger's next sibling.
*/
function sync(nav: Element) {
const find = (selector: string) => nav.querySelector<HTMLElement>(selector);
const open = find("[aria-expanded=true]");
const target =
find(":scope>ul>li:hover>:first-child") ?? open ?? find("[aria-current]");
const pill = nav.firstElementChild as HTMLElement;
pill.hidden = !target;
if (target) {
pill.style.width = `${target.offsetWidth}px`;
pill.style.translate = `${target.offsetLeft}px 0`;
}
const popover = open?.nextElementSibling as HTMLElement | undefined;
if (!popover) return;
const box = open!.getBoundingClientRect();
const maxLeft = innerWidth - popover.offsetWidth - GAP;
popover.style.top = `${box.bottom + GAP}px`;
popover.style.left = `${Math.max(GAP, Math.min(box.left, maxLeft))}px`;
}
type Props = HTMLAttributes<HTMLElement> & {
links?: NavbarLink[];
brand?: Snippet;
actions?: Snippet;
/** default: hairline bottom border, floating: rounded and floating, blur: translucent background. */
variant?: keyof typeof variants;
sticky?: boolean;
/** Accessible label of the mobile menu button. */
menuLabel?: string;
/** Accessible label of the desktop nav element. */
navLabel?: string;
/** Accessible label of the mobile nav element. */
mobileNavLabel?: string;
};
let {
links = [],
brand,
actions,
variant = "default",
sticky = false,
menuLabel = "Menu",
navLabel = "Main",
mobileNavLabel = "Main mobile",
id,
class: className,
onkeydown,
...rest
}: Props = $props();
const generatedId = $props.id();
const navbarId = $derived(id ?? generatedId);
const menuId = $derived(`${navbarId}-menu`);
let open = $state(false);
let toggleButton = $state<HTMLButtonElement>();
let timer: ReturnType<typeof setTimeout> | undefined;
onDestroy(() => clearTimeout(timer));
function handleKeyDown(
event: KeyboardEvent & { currentTarget: HTMLElement },
) {
if (event.key === "Escape" && open) {
open = false;
toggleButton?.focus();
}
onkeydown?.(event);
}
/** Mouse hover: entering a dropdown item opens it after a delay, leaving closes it after a delay. Items without a dropdown do not cancel the close delay. */
function handleHover(event: PointerEvent & { currentTarget: HTMLElement }) {
const entry = event.currentTarget;
const popover = entry.querySelector<HTMLElement>("[popover]");
sync(entry.closest("nav")!);
if (event.pointerType !== "mouse" || !popover) return;
const enter = event.type === "pointerenter";
clearTimeout(timer);
timer = setTimeout(
() => popover.togglePopover(enter),
enter ? OPEN_DELAY : CLOSE_DELAY,
);
}
/** A mouse click on a trigger that is already open (usually by hover) does not close it. */
function handleClick(event: MouseEvent & { currentTarget: HTMLElement }) {
if (event.detail && event.currentTarget.matches("[aria-expanded=true]"))
event.preventDefault();
}
/** ArrowDown on a trigger opens the panel and focuses the first link. */
function handleTriggerKeyDown(
event: KeyboardEvent & { currentTarget: HTMLElement },
) {
const popover = event.currentTarget.nextElementSibling as HTMLElement;
if (event.key !== "ArrowDown") return;
event.preventDefault();
popover.showPopover();
popover.querySelector("a")?.focus();
}
/** beforetoggle runs synchronously so aria-expanded is always current; toggle places the panel once it shows. */
function handleToggle(event: ToggleEvent & { currentTarget: HTMLElement }) {
const popover = event.currentTarget;
popover.previousElementSibling!.setAttribute(
"aria-expanded",
String(event.newState === "open"),
);
sync(popover.closest("nav")!);
}
</script>
{#snippet icon(path: string, className: string)}
<svg
class={className}
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
stroke-width="1.5"
stroke-linecap="round"
stroke-linejoin="round"
aria-hidden="true"
>
<path d={path} />
</svg>
{/snippet}
{#snippet link(entry: Omit<NavbarLink, "children">)}
<a
href={safeHref(entry.href)}
aria-current={entry.active ? "page" : undefined}
class={item}>{entry.label}</a
>
{/snippet}
<header
id={navbarId}
class={[root, variants[variant], sticky && stickyClass, className]}
onkeydown={handleKeyDown}
{...rest}
>
<div class={bar}>
{#if brand}
<div class={brandClass}>{@render brand()}</div>
{/if}
<nav aria-label={navLabel} class={desktopNav}>
<span aria-hidden="true" hidden class={indicator}></span>
<ul class={list}>
{#each links as entry, index (index)}
{@const panelId = `${navbarId}-panel-${index}`}
<li onpointerenter={handleHover} onpointerleave={handleHover}>
{#if entry.children?.length}
<button
type="button"
popovertarget={panelId}
aria-expanded="false"
aria-controls={panelId}
class={item}
onclick={handleClick}
onkeydown={handleTriggerKeyDown}
>{entry.label}{@render icon("m6 9 6 6 6-6", chevron)}</button
>
<div
id={panelId}
popover="auto"
class={panel}
onbeforetoggle={handleToggle}
ontoggle={handleToggle}
>
<ul class={panelList}>
{#each entry.children as child, childIndex (childIndex)}
<li>
<a href={safeHref(child.href)} class={panelLink}>
{#if child.icon}{@render icon(
child.icon,
iconClass,
)}{/if}
<span class={linkBody}>
<span class={linkTitle}>{child.label}</span>
{#if child.description}
<span class={linkDescription}
>{child.description}</span
>
{/if}
</span>
</a>
</li>
{/each}
</ul>
</div>
{:else}
{@render link(entry)}
{/if}
</li>
{/each}
</ul>
</nav>
<div class={actionsClass}>
{@render actions?.()}
<button
bind:this={toggleButton}
type="button"
aria-label={menuLabel}
aria-expanded={open}
aria-controls={menuId}
onclick={() => (open = !open)}
class={toggle}
>
{@render icon("M4 6h16M4 12h16M4 18h16", openIcon)}
{@render icon("M18 6 6 18M6 6l12 12", closeIcon)}
</button>
</div>
</div>
<div
id={menuId}
data-state={open ? "open" : "closed"}
hidden={!open}
class={mobilePanel}
>
<nav aria-label={mobileNavLabel} class={mobileList}>
{#each links as entry, index (index)}
{#if entry.children?.length}
<details>
<summary class={item}
>{entry.label}{@render icon("m6 9 6 6 6-6", chevron)}</summary
>
<div class={groupList}>
{#each entry.children as child, childIndex (childIndex)}
{@render link(child)}
{/each}
</div>
</details>
{:else}
{@render link(entry)}
{/if}
{/each}
</nav>
</div>
</header>- Pastikan Tailwind CSS v4 dan markas.css sudah terpasang. Lihat Instalasi.
- Salin source komponen di bawah ini ke
src/components/markas/Navbar.astro.
---
import type { HTMLAttributes } from "astro/types";
export type NavbarChild = {
label: string;
href: string;
description?: string;
/** SVG path data (d attribute) for a 24x24 stroke icon. */
icon?: string;
};
export type NavbarLink = {
label: string;
/** Plain link target. Ignored when the item has children. */
href?: string;
active?: boolean;
/** Dropdown links. An item with children becomes a dropdown trigger. */
children?: NavbarChild[];
};
const root =
"@container w-full **:focus-visible:outline-2 **:focus-visible:outline-offset-2 **:focus-visible:outline-primary motion-reduce:**:transition-none";
const variants = {
default: "top-0 border-b border-line bg-surface",
floating: "top-3 rounded-2xl border border-line bg-surface shadow-overlay",
blur: "top-0 border-b border-line/60 bg-surface/70 backdrop-blur-md",
};
const stickyClass = "sticky z-40";
const bar = "flex h-14 items-center gap-4 px-3 @sm:px-4";
const brandClass =
"flex shrink-0 items-center gap-2 text-sm font-semibold text-ink";
const desktopNav = "relative hidden items-center @2xl:flex";
const indicator =
"absolute inset-y-0 left-0 rounded-md bg-subtle transition-[translate,width] duration-200 ease-out";
const list = "relative flex items-center";
const item =
"flex h-9 cursor-pointer items-center justify-between gap-1 rounded-md px-3 text-sm font-medium whitespace-nowrap text-muted transition-colors duration-150 ease-out hover:text-ink aria-expanded:text-ink aria-[current]:bg-subtle aria-[current]:text-ink @max-2xl:hover:bg-subtle [&::-webkit-details-marker]:hidden";
const chevron =
"size-3.5 text-faint transition-transform duration-200 ease-out in-aria-expanded:rotate-180 in-open:rotate-180";
const panel =
"inset-auto m-0 rounded-xl border border-line bg-surface p-2 text-ink shadow-overlay transition-[opacity,translate] duration-200 ease-out starting:open:translate-y-1.5 starting:open:opacity-0";
const panelList = "grid grid-flow-col grid-rows-3 gap-1";
const panelLink =
"flex w-64 items-start gap-3 rounded-lg p-3 text-sm transition-colors duration-150 ease-out hover:bg-subtle focus-visible:bg-subtle";
const iconClass =
"size-9 shrink-0 rounded-md border border-line bg-canvas p-[7px]";
const linkBody = "grid gap-0.5";
const linkTitle = "font-medium";
const linkDescription = "text-muted";
const actionsClass = "ml-auto flex items-center gap-2";
const toggle =
"inline-flex size-9 shrink-0 items-center justify-center rounded-md text-ink transition-colors duration-150 ease-out hover:bg-subtle @2xl:hidden";
const openIcon = "size-5 in-aria-expanded:hidden";
const closeIcon = "hidden size-5 in-aria-expanded:block";
const mobilePanel =
"border-t border-line px-4 py-2 transition-[opacity,translate] duration-200 ease-out starting:-translate-y-1 starting:opacity-0 @2xl:hidden";
const mobileList = "grid gap-1";
const groupList =
"my-1 ml-3 grid gap-1 border-l border-line pl-2 transition-[opacity,translate] duration-200 ease-out starting:-translate-y-1 starting:opacity-0";
/** Hrefs with a scheme other than http, https, mailto, and tel (javascript: for one) become "#". Spaces and control characters are ignored like browsers do. */
const safeHref = (href = "#") =>
/^(?!https?:|mailto:|tel:)[a-z][\w+.-]*:/i.test(href.replace(/[\0- ]/g, ""))
? "#"
: href;
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;
type Props = HTMLAttributes<"header"> & {
links?: NavbarLink[];
/** default: hairline bottom border, floating: rounded and floating, blur: translucent background. */
variant?: keyof typeof variants;
sticky?: boolean;
/** Accessible label of the mobile menu button. */
menuLabel?: string;
/** Accessible label of the desktop nav element. */
navLabel?: string;
/** Accessible label of the mobile nav element. */
mobileNavLabel?: string;
};
const {
links = [],
variant = "default",
sticky = false,
menuLabel = "Menu",
navLabel = "Main",
mobileNavLabel = "Main mobile",
id,
class: className,
...rest
} = Astro.props;
const navbarId = id ?? `markas-navbar-${crypto.randomUUID().slice(0, 8)}`;
const menuId = `${navbarId}-menu`;
---
<header
id={navbarId}
data-markas-navbar
class:list={[root, variants[variant], sticky && stickyClass, className]}
{...rest}
>
<div class={bar}>
{
Astro.slots.has("brand") && (
<div class={brandClass}>
<slot name="brand" />
</div>
)
}
<nav aria-label={navLabel} class={desktopNav}>
<span aria-hidden="true" hidden class={indicator}></span>
<ul class={list}>
{
links.map((entry, index) => {
const panelId = `${navbarId}-panel-${index}`;
return (
<li data-markas-navbar-item>
{entry.children?.length ? (
<>
<button
type="button"
popovertarget={panelId}
aria-expanded="false"
aria-controls={panelId}
data-markas-navbar-trigger
class={item}
>
{entry.label}<svg class={chevron} {...svg}><path d="m6 9 6 6 6-6" /></svg>
</button>
<div
id={panelId}
popover="auto"
data-markas-navbar-panel
class={panel}
>
<ul class={panelList}>
{entry.children.map((child) => (
<li>
<a href={safeHref(child.href)} class={panelLink}>
{child.icon && (
<svg class={iconClass} {...svg}>
<path d={child.icon} />
</svg>
)}
<span class={linkBody}>
<span class={linkTitle}>{child.label}</span>
{child.description && (
<span class={linkDescription}>
{child.description}
</span>
)}
</span>
</a>
</li>
))}
</ul>
</div>
</>
) : (
<a
href={safeHref(entry.href)}
aria-current={entry.active ? "page" : undefined}
class={item}
>
{entry.label}
</a>
)}
</li>
);
})
}
</ul>
</nav>
<div class={actionsClass}>
<slot name="actions" />
<button
type="button"
aria-label={menuLabel}
aria-expanded="false"
aria-controls={menuId}
data-markas-navbar-toggle
class={toggle}
>
<svg class={openIcon} {...svg}>
<path d="M4 6h16M4 12h16M4 18h16"></path>
</svg>
<svg class={closeIcon} {...svg}>
<path d="M18 6 6 18M6 6l12 12"></path>
</svg>
</button>
</div>
</div>
<div id={menuId} data-state="closed" hidden class={mobilePanel}>
<nav aria-label={mobileNavLabel} class={mobileList}>
{
links.map((entry) =>
entry.children?.length ? (
<details>
<summary class={item}>
{entry.label}<svg class={chevron} {...svg}><path d="m6 9 6 6 6-6" /></svg>
</summary>
<div class={groupList}>
{entry.children.map((child) => (
<a href={safeHref(child.href)} class={item}>
{child.label}
</a>
))}
</div>
</details>
) : (
<a
href={safeHref(entry.href)}
aria-current={entry.active ? "page" : undefined}
class={item}
>
{entry.label}
</a>
),
)
}
</nav>
</div>
</header>
<script>
// One set of listeners per page serves every navbar, including markup added later and pages
// reached through view transitions.
/** Delay before a panel opens when the pointer lingers, and before it closes when the pointer leaves. */
const OPEN_DELAY = 120;
const CLOSE_DELAY = 180;
/** Distance of the panel from its trigger and from the viewport edge. */
const GAP = 8;
let timer: ReturnType<typeof setTimeout> | undefined;
const closest = (node: EventTarget | null, selector: string) =>
node instanceof Element ? node.closest<HTMLElement>(selector) : null;
/**
* Slide the indicator to the hovered item, the open panel, or the active item, then place the
* open panel under its trigger. The indicator is the nav's first child, the panel is the trigger's next sibling.
*/
function sync(nav: Element) {
const find = (selector: string) => nav.querySelector<HTMLElement>(selector);
const open = find("[aria-expanded=true]");
const target =
find(":scope>ul>li:hover>:first-child") ?? open ?? find("[aria-current]");
const pill = nav.firstElementChild as HTMLElement;
pill.hidden = !target;
if (target) {
pill.style.width = `${target.offsetWidth}px`;
pill.style.translate = `${target.offsetLeft}px 0`;
}
const popover = open?.nextElementSibling as HTMLElement | undefined;
if (!popover) return;
const box = open!.getBoundingClientRect();
const maxLeft = innerWidth - popover.offsetWidth - GAP;
popover.style.top = `${box.bottom + GAP}px`;
popover.style.left = `${Math.max(GAP, Math.min(box.left, maxLeft))}px`;
}
/** Opens or closes the mobile panel of a navbar. */
function setMobile(toggle: HTMLElement, open: boolean) {
const menu = document.getElementById(toggle.getAttribute("aria-controls")!);
toggle.setAttribute("aria-expanded", String(open));
if (!menu) return;
menu.hidden = !open;
menu.dataset.state = open ? "open" : "closed";
}
document.addEventListener("click", (event) => {
const toggle = closest(event.target, "[data-markas-navbar-toggle]");
if (toggle) {
setMobile(toggle, toggle.getAttribute("aria-expanded") !== "true");
return;
}
// A mouse click on a trigger that is already open (usually by hover) does not close it.
const trigger = closest(event.target, "[data-markas-navbar-trigger]");
if (trigger && event.detail && trigger.matches("[aria-expanded=true]"))
event.preventDefault();
});
document.addEventListener("keydown", (event) => {
// ArrowDown on a trigger opens the panel and focuses the first link.
const trigger = closest(event.target, "[data-markas-navbar-trigger]");
if (trigger && event.key === "ArrowDown") {
const popover = trigger.nextElementSibling as HTMLElement;
event.preventDefault();
popover.showPopover();
popover.querySelector("a")?.focus();
return;
}
// Escape closes the mobile panel and returns focus to the menu button.
const header = closest(event.target, "[data-markas-navbar]");
const toggle = header?.querySelector<HTMLElement>(
"[data-markas-navbar-toggle][aria-expanded=true]",
);
if (event.key !== "Escape" || !toggle) return;
setMobile(toggle, false);
toggle.focus();
});
// pointerenter, pointerleave, beforetoggle, and toggle do not bubble, so listen in the capture phase.
// Mouse hover: entering a dropdown item opens it after a delay, leaving closes it after a delay.
// Items without a dropdown do not cancel the close delay.
const hover = (event: Event) => {
const entry = event.target;
if (!(entry instanceof HTMLElement) || !entry.hasAttribute("data-markas-navbar-item"))
return;
const popover = entry.querySelector<HTMLElement>("[popover]");
sync(entry.closest("nav")!);
if ((event as PointerEvent).pointerType !== "mouse" || !popover) return;
const enter = event.type === "pointerenter";
clearTimeout(timer);
timer = setTimeout(
() => popover.togglePopover(enter),
enter ? OPEN_DELAY : CLOSE_DELAY,
);
};
document.addEventListener("pointerenter", hover, true);
document.addEventListener("pointerleave", hover, true);
// beforetoggle runs synchronously so aria-expanded is always current; toggle places the panel once it shows.
const toggled = (event: Event) => {
const popover = event.target;
if (!(popover instanceof HTMLElement) || !popover.hasAttribute("data-markas-navbar-panel"))
return;
popover.previousElementSibling!.setAttribute(
"aria-expanded",
String((event as ToggleEvent).newState === "open"),
);
sync(popover.closest("nav")!);
};
document.addEventListener("beforetoggle", toggled, true);
document.addEventListener("toggle", toggled, true);
</script>- Pastikan Tailwind CSS v4 dan markas.css sudah terpasang. Lihat Instalasi.
- Salin source komponen di bawah ini ke
src/app/markas/navbar.component.ts.
import {
afterNextRender,
booleanAttribute,
ChangeDetectionStrategy,
Component,
computed,
DestroyRef,
type ElementRef,
inject,
input,
signal,
viewChild,
} from "@angular/core";
const root =
"@container w-full **:focus-visible:outline-2 **:focus-visible:outline-offset-2 **:focus-visible:outline-primary motion-reduce:**:transition-none";
const variants = {
default: "top-0 border-b border-line bg-surface",
floating: "top-3 rounded-2xl border border-line bg-surface shadow-overlay",
blur: "top-0 border-b border-line/60 bg-surface/70 backdrop-blur-md",
};
const stickyClass = "sticky z-40";
const bar = "flex h-14 items-center gap-4 px-3 @sm:px-4";
const brandClass =
"flex shrink-0 items-center gap-2 text-sm font-semibold text-ink";
const desktopNav = "relative hidden items-center @2xl:flex";
const indicator =
"absolute inset-y-0 left-0 rounded-md bg-subtle transition-[translate,width] duration-200 ease-out";
const list = "relative flex items-center";
const item =
"flex h-9 cursor-pointer items-center justify-between gap-1 rounded-md px-3 text-sm font-medium whitespace-nowrap text-muted transition-colors duration-150 ease-out hover:text-ink aria-expanded:text-ink aria-[current]:bg-subtle aria-[current]:text-ink @max-2xl:hover:bg-subtle [&::-webkit-details-marker]:hidden";
const chevron =
"size-3.5 text-faint transition-transform duration-200 ease-out in-aria-expanded:rotate-180 in-open:rotate-180";
const panel =
"inset-auto m-0 rounded-xl border border-line bg-surface p-2 text-ink shadow-overlay transition-[opacity,translate] duration-200 ease-out starting:open:translate-y-1.5 starting:open:opacity-0";
const panelList = "grid grid-flow-col grid-rows-3 gap-1";
const panelLink =
"flex w-64 items-start gap-3 rounded-lg p-3 text-sm transition-colors duration-150 ease-out hover:bg-subtle focus-visible:bg-subtle";
const iconClass =
"size-9 shrink-0 rounded-md border border-line bg-canvas p-[7px]";
const linkBody = "grid gap-0.5";
const linkTitle = "font-medium";
const linkDescription = "text-muted";
const actionsClass = "ml-auto flex items-center gap-2";
const toggle =
"inline-flex size-9 shrink-0 items-center justify-center rounded-md text-ink transition-colors duration-150 ease-out hover:bg-subtle @2xl:hidden";
const openIcon = "size-5 in-aria-expanded:hidden";
const closeIcon = "hidden size-5 in-aria-expanded:block";
const mobilePanel =
"border-t border-line px-4 py-2 transition-[opacity,translate] duration-200 ease-out starting:-translate-y-1 starting:opacity-0 @2xl:hidden";
const mobileList = "grid gap-1";
const groupList =
"my-1 ml-3 grid gap-1 border-l border-line pl-2 transition-[opacity,translate] duration-200 ease-out starting:-translate-y-1 starting:opacity-0";
/** Hrefs with a scheme other than http, https, mailto, and tel (javascript: for one) become "#". Spaces and control characters are ignored like browsers do. */
const safeHref = (href = "#") =>
/^(?!https?:|mailto:|tel:)[a-z][\w+.-]*:/i.test(href.replace(/[\0- ]/g, ""))
? "#"
: href;
/** Delay before a panel opens when the pointer lingers, and before it closes when the pointer leaves. */
const OPEN_DELAY = 120;
const CLOSE_DELAY = 180;
/** Distance of the panel from its trigger and from the viewport edge. */
const GAP = 8;
/**
* Slide the indicator to the hovered item, the open panel, or the active item, then place the
* open panel under its trigger. The indicator is the nav's first child, the panel is the trigger's next sibling.
*/
function sync(nav: Element) {
const find = (selector: string) => nav.querySelector<HTMLElement>(selector);
const open = find("[aria-expanded=true]");
const target =
find(":scope>ul>li:hover>:first-child") ?? open ?? find("[aria-current]");
const pill = nav.firstElementChild as HTMLElement;
pill.hidden = !target;
if (target) {
pill.style.width = `${target.offsetWidth}px`;
pill.style.translate = `${target.offsetLeft}px 0`;
}
const popover = open?.nextElementSibling as HTMLElement | undefined;
if (!popover) return;
const box = open!.getBoundingClientRect();
const maxLeft = innerWidth - popover.offsetWidth - GAP;
popover.style.top = `${box.bottom + GAP}px`;
popover.style.left = `${Math.max(GAP, Math.min(box.left, maxLeft))}px`;
}
export type NavbarChild = {
label: string;
href: string;
description?: string;
/** SVG path data (d attribute) for a 24x24 stroke icon. */
icon?: string;
};
export type NavbarLink = {
label: string;
/** Plain link target. Ignored when the item has children. */
href?: string;
active?: boolean;
/** Dropdown links. An item with children becomes a dropdown trigger. */
children?: NavbarChild[];
};
export type NavbarVariant = keyof typeof variants;
let nextId = 0;
/**
* Attribute selector on the native header: id, class, data-*, and aria-* stay on the header.
* Slots: an element with the `brand` attribute fills the left side, an element with the
* `actions` attribute (an ng-container works) fills the right side.
*/
@Component({
selector: "header[markas-navbar]",
changeDetection: ChangeDetectionStrategy.OnPush,
host: {
"[attr.id]": "navbarId()",
"[class]": "classes()",
"(keydown)": "handleKeyDown($event)",
},
template: `
<div [class]="bar">
<div #brand [class]="brandClass" [hidden]="!hasBrand()">
<ng-content select="[brand]" />
</div>
<nav [attr.aria-label]="navLabel()" [class]="desktopNav">
<span aria-hidden="true" hidden [class]="indicator"></span>
<ul [class]="list">
@for (entry of links(); track $index) {
@let panelId = navbarId() + "-panel-" + $index;
<li
(pointerenter)="handleHover($event)"
(pointerleave)="handleHover($event)"
>
@if (entry.children?.length) {
<button
type="button"
[attr.popovertarget]="panelId"
aria-expanded="false"
[attr.aria-controls]="panelId"
[class]="item"
(click)="handleClick($event)"
(keydown)="handleTriggerKeyDown($event)"
>
{{ entry.label
}}<svg
[attr.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="m6 9 6 6 6-6" />
</svg>
</button>
<div
[id]="panelId"
popover="auto"
[class]="panel"
(beforetoggle)="handleToggle($event)"
(toggle)="handleToggle($event)"
>
<ul [class]="panelList">
@for (child of entry.children; track $index) {
<li>
<a [href]="safeHref(child.href)" [class]="panelLink">
@if (child.icon) {
<svg
[attr.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]="child.icon" />
</svg>
}
<span [class]="linkBody">
<span [class]="linkTitle">{{ child.label }}</span>
@if (child.description) {
<span [class]="linkDescription">{{
child.description
}}</span>
}
</span>
</a>
</li>
}
</ul>
</div>
} @else {
<a
[href]="safeHref(entry.href)"
[attr.aria-current]="entry.active ? 'page' : null"
[class]="item"
>{{ entry.label }}</a
>
}
</li>
}
</ul>
</nav>
<div [class]="actionsClass">
<ng-content select="[actions]" />
<button
#toggleButton
type="button"
[attr.aria-label]="menuLabel()"
[attr.aria-expanded]="open()"
[attr.aria-controls]="menuId()"
[class]="toggle"
(click)="open.set(!open())"
>
<svg
[attr.class]="openIcon"
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>
<svg
[attr.class]="closeIcon"
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>
</button>
</div>
</div>
<div
[id]="menuId()"
[attr.data-state]="open() ? 'open' : 'closed'"
[hidden]="!open()"
[class]="mobilePanel"
>
<nav [attr.aria-label]="mobileNavLabel()" [class]="mobileList">
@for (entry of links(); track $index) {
@if (entry.children?.length) {
<details>
<summary [class]="item">
{{ entry.label
}}<svg
[attr.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="m6 9 6 6 6-6" />
</svg>
</summary>
<div [class]="groupList">
@for (child of entry.children; track $index) {
<a [href]="safeHref(child.href)" [class]="item">{{
child.label
}}</a>
}
</div>
</details>
} @else {
<a
[href]="safeHref(entry.href)"
[attr.aria-current]="entry.active ? 'page' : null"
[class]="item"
>{{ entry.label }}</a
>
}
}
</nav>
</div>
`,
})
export class Navbar {
readonly links = input<NavbarLink[]>([]);
/** default: hairline bottom border, floating: rounded and floating, blur: translucent background. */
readonly variant = input<NavbarVariant>("default");
readonly sticky = input(false, { transform: booleanAttribute });
readonly id = input<string>();
/** Accessible label of the mobile menu button. */
readonly menuLabel = input("Menu");
/** Accessible label of the desktop nav element. */
readonly navLabel = input("Main");
/** Accessible label of the mobile nav element. */
readonly mobileNavLabel = input("Main mobile");
protected readonly bar = bar;
protected readonly brandClass = brandClass;
protected readonly desktopNav = desktopNav;
protected readonly indicator = indicator;
protected readonly list = list;
protected readonly item = item;
protected readonly chevron = chevron;
protected readonly panel = panel;
protected readonly panelList = panelList;
protected readonly panelLink = panelLink;
protected readonly iconClass = iconClass;
protected readonly linkBody = linkBody;
protected readonly linkTitle = linkTitle;
protected readonly linkDescription = linkDescription;
protected readonly actionsClass = actionsClass;
protected readonly toggle = toggle;
protected readonly openIcon = openIcon;
protected readonly closeIcon = closeIcon;
protected readonly mobilePanel = mobilePanel;
protected readonly mobileList = mobileList;
protected readonly groupList = groupList;
protected readonly safeHref = safeHref;
protected readonly open = signal(false);
protected readonly hasBrand = signal(false);
private readonly generatedId = `markas-navbar-${nextId++}`;
protected readonly navbarId = computed(() => this.id() ?? this.generatedId);
protected readonly menuId = computed(() => `${this.navbarId()}-menu`);
protected readonly classes = computed(() =>
[root, variants[this.variant()], this.sticky() && stickyClass]
.filter(Boolean)
.join(" "),
);
private readonly brand = viewChild.required<ElementRef<HTMLElement>>("brand");
private readonly toggleButton =
viewChild.required<ElementRef<HTMLButtonElement>>("toggleButton");
private timer: ReturnType<typeof setTimeout> | undefined;
constructor() {
// Projected content is only known after the first render.
afterNextRender(() =>
this.hasBrand.set(this.brand().nativeElement.hasChildNodes()),
);
inject(DestroyRef).onDestroy(() => clearTimeout(this.timer));
}
protected handleKeyDown(event: KeyboardEvent) {
if (event.key !== "Escape" || !this.open()) return;
this.open.set(false);
this.toggleButton().nativeElement.focus();
}
/** Mouse hover: entering a dropdown item opens it after a delay, leaving closes it after a delay. Items without a dropdown do not cancel the close delay. */
protected handleHover(event: PointerEvent) {
const entry = event.currentTarget as HTMLElement;
const popover = entry.querySelector<HTMLElement>("[popover]");
sync(entry.closest("nav")!);
if (event.pointerType !== "mouse" || !popover) return;
const enter = event.type === "pointerenter";
clearTimeout(this.timer);
this.timer = setTimeout(
() => popover.togglePopover(enter),
enter ? OPEN_DELAY : CLOSE_DELAY,
);
}
/** A mouse click on a trigger that is already open (usually by hover) does not close it. */
protected handleClick(event: MouseEvent) {
const trigger = event.currentTarget as HTMLElement;
if (event.detail && trigger.matches("[aria-expanded=true]"))
event.preventDefault();
}
/** ArrowDown on a trigger opens the panel and focuses the first link. */
protected handleTriggerKeyDown(event: KeyboardEvent) {
const trigger = event.currentTarget as HTMLElement;
const popover = trigger.nextElementSibling as HTMLElement;
if (event.key !== "ArrowDown") return;
event.preventDefault();
popover.showPopover();
popover.querySelector("a")?.focus();
}
/** beforetoggle runs synchronously so aria-expanded is always current; toggle places the panel once it shows. */
protected handleToggle(event: Event) {
const popover = event.currentTarget as HTMLElement;
popover.previousElementSibling!.setAttribute(
"aria-expanded",
String((event as ToggleEvent).newState === "open"),
);
sync(popover.closest("nav")!);
}
}Pemakaian
<x-markas.navbar
nav-label="Utama"
mobile-nav-label="Utama seluler"
variant="blur"
:sticky="true"
:links="[
['label' => 'Beranda', 'href' => '/', 'active' => true],
['label' => 'Produk', 'children' => [
[
'label' => 'Analitik',
'href' => '/analitik',
'description' => 'Pantau pemakaian secara langsung',
'icon' => 'M3 3v18h18M7 15l4-4 3 3 5-6',
],
['label' => 'Otomasi', 'href' => '/otomasi'],
]],
['label' => 'Harga', 'href' => '/harga'],
]"
>
<x-slot:brand>MarkasUI</x-slot:brand>
<x-slot:actions>
<x-markas.button size="sm">Masuk</x-markas.button>
</x-slot:actions>
</x-markas.navbar>Butuh Alpine.js untuk dropdown dan menu seluler.
import { Button } from "@/components/markas/Button";
import { Navbar } from "@/components/markas/Navbar";
<Navbar
variant="blur"
sticky
brand="MarkasUI"
navLabel="Utama"
mobileNavLabel="Utama seluler"
links={[
{ label: "Beranda", href: "/", active: true },
{
label: "Produk",
children: [
{
label: "Analitik",
href: "/analitik",
description: "Pantau pemakaian secara langsung",
icon: "M3 3v18h18M7 15l4-4 3 3 5-6",
},
{ label: "Otomasi", href: "/otomasi" },
],
},
{ label: "Harga", href: "/harga" },
]}
actions={<Button size="sm">Masuk</Button>}
/>;<script setup lang="ts">
const links = [
{ label: "Beranda", href: "/", active: true },
{
label: "Produk",
children: [
{
label: "Analitik",
href: "/analitik",
description: "Pantau pemakaian secara langsung",
icon: "M3 3v18h18M7 15l4-4 3 3 5-6",
},
{ label: "Otomasi", href: "/otomasi" },
],
},
{ label: "Harga", href: "/harga" },
];
</script>
<template>
<Navbar
variant="blur"
sticky
nav-label="Utama"
mobile-nav-label="Utama seluler"
:links="links"
>
<template #brand>MarkasUI</template>
<template #actions>
<Button size="sm">Masuk</Button>
</template>
</Navbar>
</template><script lang="ts">
import Button from "$lib/components/markas/Button.svelte";
import Navbar from "$lib/components/markas/Navbar.svelte";
const links = [
{ label: "Beranda", href: "/", active: true },
{
label: "Produk",
children: [
{
label: "Analitik",
href: "/analitik",
description: "Pantau pemakaian secara langsung",
icon: "M3 3v18h18M7 15l4-4 3 3 5-6",
},
{ label: "Otomasi", href: "/otomasi" },
],
},
{ label: "Harga", href: "/harga" },
];
</script>
<Navbar
variant="blur"
sticky
navLabel="Utama"
mobileNavLabel="Utama seluler"
{links}
>
{#snippet brand()}MarkasUI{/snippet}
{#snippet actions()}
<Button size="sm">Masuk</Button>
{/snippet}
</Navbar>---
import Button from "@/components/markas/Button.astro";
import Navbar from "@/components/markas/Navbar.astro";
const links = [
{ label: "Beranda", href: "/", active: true },
{
label: "Produk",
children: [
{
label: "Analitik",
href: "/analitik",
description: "Pantau pemakaian secara langsung",
icon: "M3 3v18h18M7 15l4-4 3 3 5-6",
},
{ label: "Otomasi", href: "/otomasi" },
],
},
{ label: "Harga", href: "/harga" },
];
---
<Navbar
variant="blur"
sticky
navLabel="Utama"
mobileNavLabel="Utama seluler"
links={links}
>
<Fragment slot="brand">MarkasUI</Fragment>
<Button slot="actions" size="sm">Masuk</Button>
</Navbar>Satu script kecil yang dibundel menjalankan dropdown dan menu seluler semua navbar di halaman. Tetap jalan setelah view transition.
import { Component } from "@angular/core";
import { Button } from "./markas/button.component";
import { Navbar, type NavbarLink } from "./markas/navbar.component";
@Component({
selector: "app-header",
imports: [Button, Navbar],
template: `
<header
markas-navbar
variant="blur"
sticky
navLabel="Utama"
mobileNavLabel="Utama seluler"
[links]="links"
>
<ng-container brand>MarkasUI</ng-container>
<button markas-button actions size="sm">Masuk</button>
</header>
`,
})
export class AppHeader {
readonly links: NavbarLink[] = [
{ label: "Beranda", href: "/", active: true },
{
label: "Produk",
children: [
{
label: "Analitik",
href: "/analitik",
description: "Pantau pemakaian secara langsung",
icon: "M3 3v18h18M7 15l4-4 3 3 5-6",
},
{ label: "Otomasi", href: "/otomasi" },
],
},
{ label: "Harga", href: "/harga" },
];
}Komponen dipasang di elemen header native (header[markas-navbar]), jadi atribut id, class, dan data-* tetap di header.
- Link biasa dari versi sebelumnya tetap jalan. Tambahkan
childrenpada item untuk menjadikannya dropdown;hrefitem itu lalu diabaikan. - Panel dropdown memakai Popover API native, jadi tampil di top layer di atas konten lain dan tertutup saat klik di luar atau Escape. Panel dengan lebih dari tiga link mengalir ke kolom kedua.
variant:defaultmemberi garis bawah tipis,floatingberupa bar membulat dengan border dan bayangan halus,blursemi transparan dengan backdrop blur. Pasangkanblurdenganstickydi atas konten yang tergulir di bawah header.- Tata letak mengikuti lebar header lewat container query (
@containerdan@2xl:), bukan lebar layar. Menu desktop tampil saat header selebar 42rem atau lebih, di bawah itu muncul tombol menu dan dropdown menjadi grup yang bisa dibuka dan ditutup. - Label bawaan dalam bahasa Inggris: tombol “Menu”, nav “Main” dan “Main mobile”. Isi
navLabeldanmobileNavLabel(Blade:nav-label,mobile-nav-label) untuk situs berbahasa Indonesia.menuLabel(Blade:menu-label) juga bisa diubah, walau “Menu” sudah cocok.
Props
| Nama | Tipe | Default | Keterangan |
|---|---|---|---|
links | { label, href?, active?, children?: { label, href, description?, icon? }[] }[] | [] | Menu utama. Link dengan active diberi aria-current=page. Item dengan children menjadi pemicu dropdown; icon adalah path SVG (d) untuk ikon garis 24px. |
brand | slot / ReactNode | - | Logo atau nama situs di kiri. |
actions | slot / ReactNode | - | Area kanan, misalnya tombol Masuk. |
variant | "default" | "floating" | "blur" | "default" | default: garis bawah tipis. floating: bar membulat berborder dengan bayangan halus. blur: latar semi transparan dengan backdrop blur untuk konten yang tergulir di bawahnya. |
sticky | boolean | false | Header tetap di atas saat halaman digulir (floating menyisakan jarak kecil). |
menuLabel | string | Menu | Label aksesibel tombol menu seluler. Default "Menu" sudah cocok untuk Bahasa Indonesia. |
navLabel | string | Main | Label aksesibel nav desktop. Isi "Utama" untuk situs berbahasa Indonesia. |
mobileNavLabel | string | Main mobile | Label aksesibel nav seluler. Isi "Utama seluler" untuk situs berbahasa Indonesia. |
Aksesibilitas
- Tombol menu seluler memakai aria-expanded dan aria-controls yang menunjuk ke panel menu.
- Escape menutup panel seluler dan fokus kembali ke tombol menu.
- Menu desktop dan seluler masing-masing dibungkus nav dengan label berbeda (navLabel dan mobileNavLabel).
- Tata letak mengikuti lebar header (container query), menu desktop tampil mulai lebar 42rem.
- Dropdown mengikuti pola WAI-ARIA disclosure navigation: tombol dengan aria-expanded dan aria-controls membuka popover native. Klik, Enter, Spasi, dan ArrowDown membukanya, ArrowDown juga memfokuskan link pertama, Escape menutupnya dan mengembalikan fokus ke tombol.
- Hover membuka dropdown setelah 120ms dan menutupnya 180ms setelah mouse pergi; sentuhan dan pena mengabaikan hover.
- Di seluler, item dengan children menjadi grup details dan summary yang dibuka dengan Enter atau Spasi.
- Animasi dimatikan dengan prefers-reduced-motion.
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.
- Navigation MenuNavigasi situs desktop dengan panel mega menu berbasis Popover API, indikator aktif yang meluncur, jeda hover, dan keyboard pola disclosure WAI-ARIA.