Rendyn

Component library

189 components

Interaction

Shared Layout Background

Shared Layout Background adds a moving highlight behind its children.

Interactive exampleReact Tailwind CSS

Practical React example

Highlight the currently selected item in a short navigation list without changing the links’ semantics.

Before you copy and paste

Keep the example in the React rendering environment required by the imported component. Copy components/motion/shared-layout-bg.tsx and its returned support files from the Code tab; preserve the project-relative paths.

Listed package dependencies: clsx, lucide-react, motion, react, tailwind-merge.

Use the Code tab for the component files and installation instructions, then adapt the imports in this example to your project.

Highlight the currently selected item in a short navigation list without changing the links’ semantics

// Usage adapted from beUI's pinned MIT source.
// Copyright (c) 2026 Saurabh Chauhan. See ./LICENSES.md.
"use client";

import { ArrowUpRight } from "lucide-react";
import { SharedLayoutBg } from "@/components/motion/shared-layout-bg";

const items = [
  { title: "Inbox", body: "12 unread threads, 3 mentions today." },
  { title: "Drafts", body: "4 posts waiting for a final pass." },
  { title: "Releases", body: "Last shipped 2 days ago, v0.4.1." },
  { title: "Billing", body: "Plan renews on the 1st of next month." },
];

export function SharedLayoutBgPreview() {
  return (
    <div className="w-full max-w-lg px-2">
      <SharedLayoutBg>
        {items.map((it) => (
          <button
            type="button"
            key={it.title}
            className="group flex flex-col gap-1 px-2 py-3 text-left"
          >
            <div className="flex items-center justify-between gap-3">
              <span className="text-sm font-medium text-foreground">{it.title}</span>
              <ArrowUpRight className="h-3.5 w-3.5 text-muted-foreground transition-transform group-hover:translate-x-0.5 group-hover:-translate-y-0.5" />
            </div>
            <p className="text-sm text-muted-foreground">{it.body}</p>
          </button>
        ))}
      </SharedLayoutBg>
    </div>
  );
}

Usage example adapted from beUI's pinned MIT source. Retain the source licence notices when copying.

Keep each destination as a real link or button and let your router or parent selection state determine which item is active. The highlight should follow meaning rather than supply it.

Customization

SharedLayoutBgProps.children
Required; ReactNode.
SharedLayoutBgProps.as
Optional; "div" | "ul". Semantic container used for the children.
SharedLayoutBgProps.pillClassName
Optional; string. Tailwind class applied to the moving pill. Defaults to a subtle foreground tint.
SharedLayoutBgProps.inset
Optional; number. Horizontal inset of the pill relative to each row (px). Default 20.
SharedLayoutBgProps.pillContainerClassName
Optional; string. Optional positioning override for the pill wrapper inside each item.

Integration notes

  • Use as="ul" only when its children preserve valid list markup.
  • Keep focus styling visible independently of the moving background.

Component source: beUI documentation . These examples describe the version imported into Rendyn. Upstream APIs may have changed; retain the source licence notices when adapting the code.

Better with your agent

Give your agent taste.

The best way to use Rendyn is through MCP. Let your agent find the right component, compare previews and bring the source into your project.

All components are free. Sign up only to connect MCP.

Connect to MCP