Fill Link
Full-width link row that fills on hover, inverts its text and nudges its content inward.
$npx shadcn@latest add https://framebrick.co/r/fill-link.jsonFrom the Nitip template, see it in context.
import { FillLink } from "@/components/ui/fill-link";
const links = [
{ label: "Instagram", meta: "@studio", href: "#" },
{ label: "Dribbble", meta: "/studio", href: "#" },
{ label: "LinkedIn", meta: "/company/studio", href: "#" },
];
export default function FillLinkDemo() {
return (
<div className="w-full max-w-sm">
{links.map((link) => (
<FillLink key={link.label} href={link.href} meta={link.meta}>
{link.label}
</FillLink>
))}
</div>
);
}Examples
With a photo
A small photo before the label: on hover the row fills, the photo shrinks away and a round arrow takes its place.
import { FillLink } from "@/components/ui/fill-link";
// Demo photos from Unsplash (free under the Unsplash License), served by this site so no request leaves it.
const programs = [
{ label: "Strength basics", photo: "/demo/media-accordion-build.webp" },
{ label: "Morning mobility", photo: "/demo/media-accordion-design.webp" },
{ label: "Endurance", photo: "/demo/media-accordion-strategy.webp" },
];
/* Point at a row: it fills, its photo shrinks away and a round arrow takes its place at the end. */
export default function FillLinkThumbDemo() {
return (
<div className="w-full max-w-sm">
{programs.map((program) => (
<FillLink key={program.label} href="#" thumb={<img src={program.photo} alt="" />} className="py-2">
{program.label}
</FillLink>
))}
</div>
);
}<FillLink href="/programs/strength" thumb={<img src="/programs/strength.jpg" alt="" />}>Strength basics</FillLink>Installation
$ npx shadcn@latest add https://framebrick.co/r/fill-link.json1. Install the dependencies.
npm install motion clsx tailwind-merge2. Add
cn()tolib/utils.ts(skip if shadcn already created it).import { clsx, type ClassValue } from "clsx"; import { extendTailwindMerge } from "tailwind-merge"; /* tailwind-merge must know the site's type scale (globals.css) is a font size, not a text color — otherwise cn("text-h6 text-muted-foreground") drops text-h6. */ const twMerge = extendTailwindMerge({ extend: { classGroups: { "font-size": [{ text: ["display", "h1", "h2", "h3", "h4", "h5", "h6"] }] } }, }); export function cn(...inputs: ClassValue[]) { return twMerge(clsx(inputs)); }3. Copy the component into
components/ui/fill-link.tsx."use client"; import * as React from "react"; import Link from "next/link"; import { motion, useReducedMotion, type HTMLMotionProps, type Transition } from "motion/react"; import { cn } from "@/lib/utils"; /* * Fill Link — a full-width row that fills on hover, inverts its text and nudges its content inward * (from the Nitip "Social Media" rows). Use it for lists of links: socials, contact details, big menus. * The arrow rotates -45° so it points right, with Framer's button spring. * * `thumb` (the Fitbricks program links in its sidebar) puts a small photo before the label: on hover the row fills and takes 10px at * each side, the photo (64 x 44, 12px from the label) shrinks to width 0 and fades, and a round 24px arrow comes in at the end in its place, * all on a 0.4s tween, cubic-bezier(0.44, 0, 0.56, 1). The photo is decoration (alt=""), the arrow too; the link is named by its text. * Width is a size key, so with <MotionConfig reducedMotion="user"> the photo goes at once and the arrow still fades in. * * Deviation from Framer: the fill and the text color are a CSS transition rather than a Motion animation, so the row * follows the theme (bg-foreground / text-background) instead of fixed black and white. */ const spring: Transition = { type: "spring", bounce: 0.2, duration: 0.4 }; /* The tween of the photo and the arrow: Fitbricks' card tween. */ const tween: Transition = { duration: 0.4, ease: [0.44, 0, 0.56, 1] }; const MotionLink = motion.create(Link); export type FillLinkProps = Omit<HTMLMotionProps<"a">, "href" | "children"> & { href: string; /** Shown at the right of the row before the arrow (a handle, a value, a date). */ meta?: React.ReactNode; arrow?: boolean; /** A small photo before the label (an image with an empty alt text): on hover it shrinks away and a round arrow takes its place at the end. */ thumb?: React.ReactNode; children?: React.ReactNode; }; export function FillLink({ href, meta, arrow = true, thumb, className, children, ...props }: FillLinkProps) { const external = /^https?:\/\//.test(href); /* Padding is neither a transform nor a size key, so MotionConfig leaves it running: hold it still here. */ const shift = useReducedMotion() ? 0 : thumb ? 10 : 12; return ( <MotionLink href={href} {...(external ? { target: "_blank", rel: "noopener noreferrer" } : {})} {...props} initial="rest" animate="rest" whileHover="hover" whileFocus="hover" className={cn( "flex w-full items-center justify-between gap-4 border-b py-3 text-sm text-foreground transition-colors duration-300", "hover:bg-foreground hover:text-background focus-visible:bg-foreground focus-visible:text-background focus-visible:outline-none", className, )} > <motion.span variants={{ rest: { paddingLeft: 0 }, hover: { paddingLeft: shift } }} transition={spring} className={thumb ? "flex min-w-0 items-center font-medium" : "min-w-0 truncate font-medium"} > {thumb && ( <motion.span aria-hidden variants={{ rest: { width: 76, opacity: 1 }, hover: { width: 0, opacity: 0 } }} transition={tween} className="flex shrink-0 overflow-hidden"> <span className="mr-3 block h-11 w-16 shrink-0 overflow-hidden rounded-md bg-muted [&>*]:size-full [&>*]:object-cover">{thumb}</span> </motion.span> )} {thumb ? <span className="truncate">{children}</span> : children} </motion.span> <motion.span variants={{ rest: { paddingRight: 0 }, hover: { paddingRight: shift } }} transition={spring} className="flex shrink-0 items-center gap-2" > {meta && <span className="opacity-65">{meta}</span>} {arrow && thumb && ( <motion.span aria-hidden variants={{ rest: { opacity: 0, scale: 0.6 }, hover: { opacity: 1, scale: 1 } }} transition={tween} className="grid size-6 place-items-center rounded-full bg-background text-foreground" > <svg viewBox="0 0 16 16" fill="none" stroke="currentColor" strokeWidth={1.5} strokeLinecap="round" strokeLinejoin="round" className="size-3.5"> <path d="M3 8h10M9 4l4 4-4 4" /> </svg> </motion.span> )} {arrow && !thumb && ( <motion.svg aria-hidden viewBox="0 0 16 16" fill="none" stroke="currentColor" strokeWidth={1.5} strokeLinecap="round" strokeLinejoin="round" className="size-4" variants={{ rest: { rotate: 0 }, hover: { rotate: -45 } }} transition={spring} > <path d="M4.5 4.5l7 7M11.5 5.5v6h-6" /> </motion.svg> )} </motion.span> </MotionLink> ); }
Usage
import { FillLink } from "@/components/ui/fill-link";
<FillLink href="https://instagram.com/studio" meta="@studio">Instagram</FillLink>Props
| Prop | Type | Default | Description |
|---|---|---|---|
| href | string | — | Link target. http(s) links open in a new tab. |
| meta | ReactNode | — | Shown at the right of the row before the arrow (a handle, a value, a date). |
| arrow | boolean | true | Show the arrow that turns from ↘ to → on hover. |
| thumb | ReactNode | — | A small photo (an image with an empty alt text) before the label: on hover it shrinks away and a round 24 px arrow takes its place at the end (Fitbricks). |
| …props | anchor props | — | Passed to the link. |
- thumb is the Fitbricks program link in its sidebar: on hover the row fills and takes 10 px at each side, the photo (64 × 44, 12 px from the label) shrinks to width 0 and fades, and a round 24 px arrow comes in at the end in its place, all on a 0.4 s tween, cubic-bezier(0.44, 0, 0.56, 1). The photo and the arrow are decoration: the link is named by its text. Width is a size key, so with <MotionConfig reducedMotion="user"> the photo goes at once and the arrow still fades in. Without thumb the row is as it was, with its turning arrow.
- Keyboard focus fills the row too, so it never looks inert while tabbing.
- With reduced motion the content does not shift; padding is neither a transform nor a size key, so MotionConfig leaves it running.
AI prompt
Paste into v0, Lovable, Bolt or Claude to rebuild this component in your own project.
Create a React + Tailwind CSS + Motion (motion/react) component called FillLink using Next.js Link. - A full-width row: label on the left, optional meta and an arrow on the right, border-b, py-3, text-sm, text-foreground. - On hover and on keyboard focus the row fills: bg-foreground with text-background, as a 300ms CSS color transition (theme colors, not fixed black and white). - The label slides 12px right and the right-hand group slides 12px left, with a spring (bounce 0.2, duration 0.4s); with useReducedMotion() the shift is 0, since padding is neither a transform nor a size key. - The arrow (down-right) rotates -45° on hover so it points right, same spring. - External http(s) links open in a new tab with rel noopener noreferrer. - thumb (a node, an image with an empty alt text): before the label a motion.span (aria-hidden, overflow hidden, flex) animates width 76 to 0 and opacity 1 to 0 on a 0.4s tween with ease [0.44, 0, 0.56, 1]; inside it a 64 x 44 rounded-md box with mr-3. The side padding shift is 10px, not 12. At the end, in place of the turning arrow, a size-6 rounded-full bg-background text-foreground circle holding a right arrow animates opacity 0 to 1 and scale 0.6 to 1 on the same tween.














