Skip to content

Underline Link

Text link with a line that draws in from the left and leaves to the right.

$npx shadcn@latest add https://framebrick.co/r/underline-link.json

From the Nitip template, see it in context.

Examples

Roll and two lines

The label rolls up, a faint line draws at once and the solid one follows half a second later.

<UnderlineLink href="/portfolio" arrow={false} roll twoStep>Portfolio</UnderlineLink>

Two lines with an arrow

A faint line, the solid one half a second later, and the arrow turns with the second.

<UnderlineLink href="/portfolio" twoStep>See my portfolio</UnderlineLink>

Line that leaves at once

The line grows from the left and is gone the moment the pointer leaves.

<UnderlineLink href="/about" exit="instant">More about me</UnderlineLink>

Turning arrow

An arrow pointing up-right that turns 45° to point right while the line draws.

<UnderlineLink href="/contact" arrow="turn">Contact me</UnderlineLink>

Sliding arrow

The line draws in and the arrow slides 4 px to the right; the line is gone at once when the pointer leaves.

<UnderlineLink href="/services" arrow="nudge" exit="instant">More details</UnderlineLink>

Installation

$ npx shadcn@latest add https://framebrick.co/r/underline-link.json

Usage

import { UnderlineLink } from "@/components/ui/underline-link";

<UnderlineLink href="/projects">All projects</UnderlineLink>

Props

PropTypeDefaultDescription
hrefstring—Link target. http(s) links open in a new tab.
arrowboolean | "nudge" | "turn"trueThe arrow after the label: true turns it from ↘ to → on hover; "nudge" draws a right arrow that slides 4 px to the right instead (Compose Digi); "turn" draws an up-right arrow that turns 45° to point right (Brickfolio, Marai Neesu); false has none.
thickness1 | 21Line thickness in px.
trackbooleanfalseA faint resting line under the label for the drawn one to pass over (Titen's text line links).
currentbooleanfalseMarks the page you are on: the line stays drawn and the link carries aria-current.
rollbooleanfalseThe label rolls up as a copy of it comes from below, 28 px on the bounce-0 spring — the roll of Flip Button (Lookis' menu).
exit"right" | "instant""right"How the line goes when the pointer leaves: out to the right, or at once (Marai Neesu's menu).
twoStepbooleanfalseA faint line (30%) draws as the hover starts and the solid one half a second later over it; both go at once. The arrow's turn waits for the second step too (Lookis' menu). Replaces track.
…propsanchor props—Passed to the link.
  • arrow="turn" is Brickfolio's "Contact Me" (and Marai Neesu's Button/Secondary, the same Framer component): an up-right arrow 5 px after the label that turns 45° to point right while the line draws. Framer runs both on spring 500 / 60 / 1; here the arrow rides the line's own spring (bounce 0.2, 0.4 s), nearly without overshoot like the original, so it stays in step with twoStep and exit. It is the glyph and angle of Flip Button's arrow="turn", so the two mean the same. true is still the arrow that turns from ↘ to →. Rotate is a transform, so MotionConfig stops it for reduced motion.
  • The line also draws in on keyboard focus.
  • twoStep runs on a timer, not a gesture: leaving before the half second removes the faint line at once and the solid one never starts. The current page shows its solid line straight away.
  • roll copies the label, and the second copy is aria-hidden, so the link is named by the label once (a test that reads textContent sees it twice).
  • arrow="nudge" is the Compose Digi "Button/Secondary": the arrow rests at the left of a 20 px box and slides 4 px right while the line draws, both on the bounce-0.2 spring. The line spans the whole link, arrow box included (measured on the live site: 159.1 px for a 134.1 px label). With exit="instant" it is Compose Digi's link exactly.

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 UnderlineLink using Next.js Link.
- Inline-flex, text-sm font-medium text-foreground (shadcn defaults), 2px bottom padding.
- An absolutely positioned line at the bottom (1px or 2px, bg-current). At rest scaleX 0; on hover scaleX 1.
  Grow from the left (transform-origin left) and shrink out to the right (transform-origin right) — switch the origin instantly.
- Optional down-right arrow after the label that rotates -45° on hover so it points right. arrow="nudge" draws a right arrow
  (path "M3 8h10M9 4l4 4-4 4") in a 20px box, 1px after the gap, which slides x 0 → 4 on the same spring instead of turning.
- Spring for both: bounce 0.2, duration 0.4s. The same animation runs on keyboard focus.
- External http(s) links open in a new tab with rel noopener noreferrer. Colors from the theme (text-foreground).
- Options. roll: the label sits in a one-line box (h-5, overflow-hidden) holding two copies 8px apart (the second aria-hidden),
  and the column moves -28px on hover, spring bounce 0, duration 0.4s. exit "instant": the line vanishes at once on leave
  (duration 0) instead of shrinking to the right. twoStep: a line at 30% opacity draws as the hover starts and the solid line
  draws over it with a 0.5s delay on its scaleX (and on the arrow's rotation), both vanishing instantly on leave, all on the
  bounce-0 spring; the current page draws only the solid line, with no delay.

Be the first to know

Get new templates and components first

One short email when we release a template or a free component. No spam — unsubscribe anytime.

We use your email only for Framebrick updates. Privacy policy