# Text Link Row

A line of text followed by a link, like “Don't have an account? Sign up”, or a back link with an arrow.

- Category: Forms
- Page: https://wunderui.com/components/text-link-row
- Tier: Free

## Install

```bash
npx wunderui-cli add text-link-row
```

## Import

```tsx
import { TextLinkRow, TextLinkRowProps } from "@/components/blocks/auth"
```

## Minimal usage

Then use it:

```tsx
import { TextLinkRow } from "@wunderui/react"

export function SignInFooter() {
  return <TextLinkRow text="Don't have an account?" link="Sign up" href="/sign-up" />
}
```

Expected result: One line of grey text followed by a semibold indigo link. The link is underlined on hover and goes to /sign-up.

## Usage

```tsx
import { TextLinkRow } from "@wunderui/react"

export function Example() {
  // Inline: 14 px, one line, the link in the link colour.
  return (
    <TextLinkRow
      text="Don't have an account?"
      link="Sign up"
      href="/sign-up"
    />
  )
}
```

## When to use

### Use Text Link Row for

- The line under a sign-in or sign-up form that names the other way in, such as Don't have an account? Sign up
- A second line of help next to a field or a button, such as Resend, Change email or Contact support
- The way back on a verification, reset or code screen

### Use something else

- [Button](https://wunderui.com/components/button) for the main step of a screen, such as Sign in or Continue
- [Alert](https://wunderui.com/components/alert) for a hint or a warning without a link (size inline), or a message about the screen that needs attention

## Keyboard

The row itself handles no keys. The link and the back link are native anchors and work the way the browser makes them work.

| Key | Action |
|---|---|
| `Tab` or `Shift+Tab` | Moves focus to the link, or to the back link, and away from it again. The text is skipped. |
| `Enter` | Follows the focused link to its `href`. With `onLinkClick` the handler runs first; call `preventDefault` there to stay on the page. |
| `Space` | Does nothing on a link. The browser may scroll the page. |

A link follows on Enter only. Space doesn't follow a link, as with any link, and the browser may scroll the page instead.

## Behavior

What the row does with its parts and its width, and what it leaves to you.

- **Variants:** Inline is the 14 px line, small is 12 px tertiary, stacked puts text over the link, icon is small with a help icon, and back is one link with an arrow (an anchor, not a paragraph).
- **Link:** The link goes to the href you pass, or to the top of the page by default. The click handler doesn't prevent the default, so app routes call preventDefault, and in back the whole row is the anchor.
- **Hover:** The link is underlined on hover, and the back link turns from secondary to full text colour. Neither change is animated.
- **Focus:** The back link takes the library's focus ring. The inline link shows the browser's default outline, which the docs theme draws in indigo, and both are visible.
- **Width and alignment:** The row fills its container and starts at the left, and justify-center or justify-end moves it. The back variant is as wide as its content, and with items-center on a flex parent the row shrinks.
- **Long text:** The text wraps inside its own box and the link keeps what is left, so a long sentence squeezes the link into a word-by-word column. Letting the row wrap moves the whole link under the text.
- **Semantics:** The row reads as text followed by a link, and the icon is hidden from assistive technology. Choose link text that makes sense out of context, and wrap changing text in a status region.
- **Where it is used:** Sign-in, sign-up, forgot-password, verification, OTP, onboarding and team-invite blocks use it for the line under the form and for the way back.
- **Motion and reduced motion:** None. The underline and the back link colour change at once, and reduced motion changes nothing.

## Anatomy

- `TextLinkRow`: A paragraph that lays its children out in one flex line, centred, 4 px apart. It is as wide as its container, starts at the left and has no border or background.
- `Icon`: A 16 px help icon in front of the text, only in the icon variant. It sits 8 px from the text.
- `Text`: The text in a span: 14 px secondary for inline, 12 px tertiary for small and icon, 14 px tertiary for stacked.
- `Link`: The link, semibold in the link colour, 14 px (12 px in small and icon) and underlined on hover. Without a link no anchor is rendered.

## Best practices

### When to use

- Use it for the quiet line that points to the other way through an auth screen: sign up instead of sign in, resend, change the address, contact support, go back. The main step stays a Button.

### Do

- Keep the text to one short sentence and the link to one or two words. The text states the situation and the link names where it leads, such as Don't have an account, then Sign up.
- Give the link a real href when it goes somewhere, since the default scrolls to the top. For an action that stays on screen, like Resend, handle the click and change the text so people see it worked.
- Centre the row under a centred card with justify-center. By default the row fills its container and starts at the left.
- Use the back variant for the way out of a step, last on the screen. It carries only text, so a link passed with it is ignored.

### Don't

- Don't put a long sentence in the text. It wraps in its own column and squeezes the link, so in a narrow container let the link wrap under the text.
- Don't use it for the main or a destructive action. A text link is easy to miss and has no pressed or loading state, so use a Button.
- Don't leave the href at the default for a link you don't handle. The page jumps to the top and the history gets an entry.

## API reference

### TextLinkRow

| Prop | Type | Default | Description |
|---|---|---|---|
| text* | React.ReactNode |  | The lead-in text, or the label of the back link. Any node; a string is the usual case. Required. |
| className | string |  | Extra classes for the root: the paragraph, or the anchor in the back variant. For example `justify-center` or `flex-wrap`. |
| href | string | "#" | Where the link, or the back link, goes. Default `#`. |
| link | React.ReactNode |  | The label of the link after the text. Any node. Without it no anchor is rendered, and the back variant ignores it. |
| onLinkClick | React.MouseEventHandler<HTMLAnchorElement> |  | Called when the link, or the back link, is clicked. The default action is not prevented. |
| variant | "inline" \| "small" \| "stacked" \| "icon" \| "back" | "inline" | `inline` is one 14 px line, `small` one 12 px line, `stacked` two centred lines, `icon` a help icon and a 12 px line, `back` an arrow and one link. Default `inline`. |

## Examples

### Link: a route, an action or none

```tsx
import { TextLinkRow } from "@wunderui/react"

export function Example() {
  // A route: the link is a real anchor with an href.
  return (
    <TextLinkRow
      text="Don't have an account?"
      link="Sign up"
      href="/sign-up"
    />
  )
}
```

### Alignment: start, centre or end

```tsx
import { TextLinkRow } from "@wunderui/react"

export function Example() {
  return (
    <TextLinkRow
      text="Don't have an account?"
      link="Sign up"
      href="/sign-up"
      className="justify-start"
    />
  )
}
```

### Content: short, long and narrow

```tsx
import { TextLinkRow } from "@wunderui/react"

export function Example() {
  return (
    <TextLinkRow
      text="Don't have an account?"
      link="Sign up"
      href="/sign-up"
    />
  )
}
```

## In context

### Sign-in card: one link switches to sign-up

The row at the bottom of the card names the other way in. Pressing the link, or choosing a mode in the strip, swaps the heading, the fields and the row itself.

```tsx
import { useState } from "react"
import { AuthHeading, Button, Input, TextLinkRow } from "@wunderui/react"

const COPY = {
  "sign-in": {
    title: "Sign in to WunderUI",
    subtitle: "Use the email address of your workspace.",
    action: "Sign in",
    text: "Don't have an account?",
    link: "Sign up",
    href: "/sign-up",
  },
  "sign-up": {
    title: "Create your account",
    subtitle: "It takes a minute and needs no card.",
    action: "Create account",
    text: "Already have an account?",
    link: "Sign in",
    href: "/sign-in",
  },
}

export function AuthCard() {
  const [mode, setMode] = useState<"sign-in" | "sign-up">("sign-in")
  const copy = COPY[mode]

  return (
    <form className="flex w-full max-w-sm flex-col gap-6 rounded-xl border border-border bg-card p-6">
      <AuthHeading as="h2" title={copy.title} subtitle={copy.subtitle} />
      <div className="flex flex-col gap-4">
        {mode === "sign-up" && <Input label="Full name" placeholder="Nora Lindgren" />}
        <Input label="Email" type="email" placeholder="you@wunderui.com" />
      </div>
      <Button type="submit" variant="gradient">
        {copy.action}
      </Button>
      <TextLinkRow
        text={copy.text}
        link={copy.link}
        href={copy.href}
        className="justify-center"
        onLinkClick={(event) => {
          event.preventDefault()
          setMode(mode === "sign-in" ? "sign-up" : "sign-in")
        }}
      />
    </form>
  )
}
```

### Check your email: resend, change the address, go back

Three rows, three jobs. Resend changes the text to say what happened and drops the link so it cannot be pressed twice, Change email opens a field in place, and the back row leaves the screen.

```tsx
import { useState } from "react"
import { AuthHeading, Button, Input, TextLinkRow } from "@wunderui/react"

export function CheckEmail() {
  const [email, setEmail] = useState("info@wunderui.com")
  const [editing, setEditing] = useState(false)
  const [sent, setSent] = useState(false)

  return (
    <div className="flex w-full max-w-sm flex-col items-center gap-6 rounded-xl border border-border bg-card p-6 text-center">
      <AuthHeading as="h2" align="center" title="Check your email" subtitle={`We sent a sign-in link to ${email}.`} />
      {editing ? (
        <form className="flex w-full flex-col gap-3 text-left" onSubmit={(event) => { event.preventDefault(); setEditing(false); setSent(true) }}>
          <Input label="Email" type="email" value={email} onChange={(event) => setEmail(event.target.value)} />
          <Button type="submit" variant="gradient">Send link</Button>
        </form>
      ) : (
        <div role="status" className="flex flex-col items-center gap-2">
          <TextLinkRow
            variant="small"
            text={sent ? "A new email is on its way." : "Didn't get the email?"}
            link={sent ? undefined : "Resend"}
            className="justify-center"
            onLinkClick={(event) => {
              event.preventDefault()
              setSent(true)
            }}
          />
        </div>
      )}
      {!editing && (
        <TextLinkRow
          variant="small"
          text="Wrong address?"
          link="Change email"
          className="justify-center"
          onLinkClick={(event) => {
            event.preventDefault()
            setEditing(true)
          }}
        />
      )}
      <TextLinkRow variant="back" text="Back to sign in" href="/sign-in" />
    </div>
  )
}
```

## For AI agents

`get_component("text-link-row")`

Hand your agent this page as Markdown or the WunderUI MCP server, not a screenshot.
