Skip to Content
NarakUI

Active Bar

The sliding highlight behind the active item in a vertical navigation list.

Example

Place it inside a relative list that sets --item-height. Move it by changing top; the bar animates between items.

Installation

pnpm dlx shadcn@latest add @narakui/active-bar

Add "@narakui": "https://ui.narakcode.dev/r/{name}.json" to components.json, or install directly from https://ui.narakcode.dev/r/active-bar.json.

Usage

import { ActiveBar } from '@/components/ui/active-bar';
components/nav-list.tsx
<nav className="relative flex flex-col [--item-height:32px]">
  <ActiveBar top={activeIndex * 32} />
</nav>

Properties

PropTypeDefaultDescription
topnumberRequiredVertical offset in pixels of the active item.
leftOffsetnumber0Inset from the left edge in pixels.
rightOffsetnumber0Inset from the right edge in pixels.
classNamestring—Additional classes, for example a z-index or custom transition.