Navigation
Simple Navmenu
The plainest drop-down site menu: a column of links with no blurbs or pictures, with the name attribute on details doing the mutual closing.
- navmenu
- dropdown
- details
- no-js
Preview
Use it with AI
- 1. Copy the link.
- 2. Write to your agent in your own words and drop the link into the sentence.
- 3. The agent opens the link and installs the component from the registry.
put this in the header: https://vibeui.ru/c/navmenu-003?lang=en
Show the full instructions
What the link says, spelled out. Use it when your agent cannot open links — paste this text instead.
# Install and place "navmenu-003" (Simple Navmenu) from VibeUI
## 1. Install first — do not skip, do not recreate
Run this exact command before writing any code:
npx shadcn@latest add https://vibeui.ru/r/navmenu-003.json
Registry item: https://vibeui.ru/r/navmenu-003.json
Installs to: components/vibeui/navmenu-003.tsx (the exact path follows this project's components.json aliases).
npm dependencies: none.
Registry dependencies: none.
Install it from the registry. Do not recreate it from the description,
do not substitute a similar component from another library, and do not
rewrite it to match the project's existing style.
## 2. What it is
The plainest drop-down site menu: a column of links with no blurbs or pictures, with the name attribute on details doing the mutual closing.
An ordinary site menu: sections with a drop-down column of links, and link-only sections without a list. Opening and mutual closing come from <details> with a shared name, so the menu works before hydration and with scripts disabled. Zero dependencies, one file, no client JS.
## 3. How to use it
import { Navmenu003 } from "@/components/vibeui/navmenu-003"
<Navmenu003
groups={[
{ label: "Product", items: ["Editor", "Templates"] },
{ label: "Pricing", href: "/pricing" },
]}
/>
Read the installed file for the full prop list.
## 4. Where to place it
This is a small inline component. Put it exactly where the user asked,
inside the existing markup. Do not create a new page, section or
wrapper for it. If a similar control already sits in that spot,
replace it instead of adding a second one.
Placement: ___
(The user fills this line in. If it is still blank, ask where to put it
instead of guessing.)
## 5. Keep exactly as installed
- the local --vibeui-navmenu-003-* palette — do not swap it for your theme tokens (bg-popover, border-border and the like)
- the shared name attribute on <details>: without it every section opens at once
- flipping the caret from the open attribute — a button's state must read on the button itself
- plain links for sections without children: a button instead of a link removes opening in a new tab
- the <ul> markup inside the menu: a set of links is a list, not a pile of divs
- the visible focus ring on the buttons and links: the menu has to be walkable with Tab
## 6. You may change
- the groups array: sections, their items and hrefs
- the width of the drop-down column
- the accent through the accent prop — it colours the focus rings
- the height of the nav bar
## 7. Rules
- Escape does not close a <details>: that is the element's behaviour. If you need Escape, take the popover-based variant.
- An outside click does not close it either: nothing in <details> handles that.
- The drop-down covers whatever is beneath it: the nav bar has to sit higher in the stacking order.
- Do not lift the CSS variables into globals.css: the component has to stay a single file.
## 8. Verify
- it renders with no console errors;
- it looks like the preview on the VibeUI page you copied this from;
- if it does not, you changed something listed in section 5 — put it back.For developers
npx shadcn@latest add https://vibeui.ru/r/navmenu-003.jsonhttps://vibeui.ru/r/navmenu-003.jsonКомпонент самодостаточен: один файл, без зависимостей, собственная палитра в локальных переменных --vibeui-navmenu-003-*. Серверный: хуков нет. Раздел с подпунктами — <details> с общим атрибутом name, поэтому браузер сам следит, что раскрыт только один. Меню позиционируется абсолютно от своей обёртки, anchor positioning не требуется. Галочка на кнопке переворачивается по атрибуту open, поэтому состояние видно на самой кнопке. Разделы без подпунктов — обычные ссылки.
Component source
The same file your agent installs. Here in case you would rather copy it by hand.
import type { CSSProperties } from "react"
export type Navmenu003Group = {
label: string
items?: string[]
href?: string
}
export type Navmenu003Props = {
groups?: Navmenu003Group[]
accent?: string
className?: string
style?: CSSProperties
}
// Идея компонента: самое простое выпадающее меню разделов — один столбик ссылок
// без описаний, картинок и колонок. Открытие и взаимное закрытие держит атрибут
// name у <details>: браузер сам следит, что раскрыт только один раздел. JS нет,
// значит меню работает и до гидратации, и при отключённых скриптах.
const STYLES = `
:where([data-vibeui-block="navmenu-003"]){
--vibeui-navmenu-003-bg:oklch(1 0 0);
--vibeui-navmenu-003-fg:oklch(0.22 0.014 265);
--vibeui-navmenu-003-muted:oklch(0.55 0.014 265);
--vibeui-navmenu-003-border:oklch(0.91 0.006 265);
--vibeui-navmenu-003-hover:oklch(0.55 0.02 265 / 8%);
--vibeui-navmenu-003-accent:oklch(0.55 0.2 262);
--vibeui-navmenu-003-font:ui-sans-serif,system-ui,-apple-system,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif;
}
[data-vibeui-block="navmenu-003"]{
box-sizing:border-box;width:100%;max-width:32rem;padding:0.375rem;
display:flex;align-items:center;gap:0.125rem;
background:var(--vibeui-navmenu-003-bg);color:var(--vibeui-navmenu-003-fg);
border:1px solid var(--vibeui-navmenu-003-border);border-radius:0.75rem;
font-family:var(--vibeui-navmenu-003-font);
}
[data-vibeui-block="navmenu-003"] [data-part="slot"]{position:relative}
[data-vibeui-block="navmenu-003"] [data-part="trigger"],
[data-vibeui-block="navmenu-003"] [data-part="plain"]{
list-style:none;cursor:pointer;text-decoration:none;color:inherit;
display:inline-flex;align-items:center;gap:0.375rem;
height:2rem;padding:0 0.75rem;border-radius:0.5rem;font-size:0.875rem;
}
[data-vibeui-block="navmenu-003"] [data-part="trigger"]::-webkit-details-marker{display:none}
[data-vibeui-block="navmenu-003"] [data-part="trigger"]:hover,
[data-vibeui-block="navmenu-003"] [data-part="plain"]:hover{background:var(--vibeui-navmenu-003-hover)}
[data-vibeui-block="navmenu-003"] [data-part="trigger"]:focus-visible,
[data-vibeui-block="navmenu-003"] [data-part="plain"]:focus-visible{outline:2px solid var(--vibeui-navmenu-003-accent);outline-offset:-2px}
[data-vibeui-block="navmenu-003"] [data-part="slot"][open] > [data-part="trigger"]{background:var(--vibeui-navmenu-003-hover)}
/* Галочка переворачивается вместе с раскрытием: состояние видно на самой кнопке. */
[data-vibeui-block="navmenu-003"] [data-part="caret"]{
width:0.375rem;height:0.375rem;margin-top:-0.1875rem;
border:1.5px solid var(--vibeui-navmenu-003-muted);border-left:0;border-top:0;
transform:rotate(45deg);transition:transform .16s ease;
}
[data-vibeui-block="navmenu-003"] [data-part="slot"][open] [data-part="caret"]{transform:rotate(-135deg);margin-top:0.125rem}
[data-vibeui-block="navmenu-003"] [data-part="menu"]{
position:absolute;top:calc(100% + 0.5rem);left:0;z-index:30;
min-width:12rem;margin:0;padding:0.25rem;box-sizing:border-box;list-style:none;
background:var(--vibeui-navmenu-003-bg);
border:1px solid var(--vibeui-navmenu-003-border);border-radius:0.75rem;
box-shadow:0 20px 40px -22px oklch(0.2 0.03 265 / 42%);
}
[data-vibeui-block="navmenu-003"] [data-part="link"]{
display:block;padding:0.4375rem 0.5rem;border-radius:0.5rem;
text-decoration:none;color:inherit;font-size:0.875rem;
}
[data-vibeui-block="navmenu-003"] [data-part="link"]:hover{background:var(--vibeui-navmenu-003-hover)}
[data-vibeui-block="navmenu-003"] [data-part="link"]:focus-visible{outline:2px solid var(--vibeui-navmenu-003-accent);outline-offset:-2px}
@media (prefers-reduced-motion:reduce){[data-vibeui-block="navmenu-003"] *{animation:none!important;transition:none!important}}
`
const DEFAULT_GROUPS: Navmenu003Group[] = [
{
label: "Продукт",
items: ["Редактор", "Шаблоны", "Аналитика", "Интеграции"],
},
{
label: "Компания",
items: ["О нас", "Вакансии", "Контакты"],
},
{ label: "Цены", href: "#" },
{ label: "Блог", href: "#" },
]
/**
* Простое выпадающее меню разделов: один столбик ссылок, без JS.
* Один файл, ноль зависимостей, собственная палитра.
*/
export function Navmenu003({
groups = DEFAULT_GROUPS,
accent,
className,
style,
}: Navmenu003Props) {
const palette = {
...(accent ? { "--vibeui-navmenu-003-accent": accent } : null),
...style,
} as CSSProperties
return (
<>
<style href="vibeui-navmenu-003" precedence="medium">
{STYLES}
</style>
<nav
data-vibeui-block="navmenu-003"
aria-label="Основная навигация"
className={className}
style={palette}
>
{groups.map((group) =>
group.items ? (
<details
key={group.label}
data-part="slot"
name="vibeui-navmenu-003"
>
<summary data-part="trigger">
{group.label}
<span data-part="caret" aria-hidden="true" />
</summary>
<ul data-part="menu" aria-label={group.label}>
{group.items.map((item) => (
<li key={item}>
<a data-part="link" href="#">
{item}
</a>
</li>
))}
</ul>
</details>
) : (
<a key={group.label} data-part="plain" href={group.href ?? "#"}>
{group.label}
</a>
),
)}
</nav>
</>
)
}