# Text Row

A label and its value on one row, as in a summary or an invoice.

A label at the start and its value at the end: the rows of a summary, an invoice or a settings card. The workhorse of every card. The label wraps when it runs out of room; the value is never truncated and keeps tabular figures.

Kind: component · Category: Display · Status: stable · Targets: React, Vue, Svelte

## Add

```bash
npx fndn add text-row
```

It writes the folder `text-row/` into the project's ui folder (`index.ts`, `text-row.tsx`, `TextRow.vue`, `TextRow.svelte`, `text-row.recipe.ts`). First time: [Installation](/installation.md).

## Usage

```tsx
import { TextRow } from "@/components/ui/text-row";
```

```vue
import { TextRow } from "@/components/ui/text-row";
```

```svelte
import { TextRow } from "$lib/components/ui/text-row";
```

## Parts

In the DOM the root carries `data-slot="text-row"` and each part `data-slot="text-row-<part>"`; in the recipe the root is the `base` slot and each part a slot named after it in camelCase.

| Part | Element | data-slot | Flags | Notes |
| --- | --- | --- | --- | --- |
| `root` | `div` | `text-row` |  |  |
| `label` | `span` | `text-row-label` |  |  |
| `values` | `span` | `text-row-values` |  | value + meta, baseline aligned |
| `value` | `span` | `text-row-value` |  |  |
| `meta` | `span` | `text-row-meta` | optional |  |

## Props

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `label` | `node (children / slot)` |  |  |
| `value` | `node (children / slot)` |  |  |
| `meta` | `node (children / slot)` |  |  |

Other attributes and `class` go to the root; `class` is merged through the recipe.

## Keyboard and accessibility

Notes:

- Plain text. For a list of rows that reads as name/value pairs, wrap them in a <dl> at the page level.

## Tokens

`color.ink`, `color.ink-2`, `text.sm`, `text.md`

## Examples

### Invoice summary

React · `invoice-summary.tsx`

```tsx
import { TextRow } from "@/components/ui/text-row";

const lines = [
  { label: "Team plan", value: "$240.00", meta: "12 seats" },
  { label: "Extra build minutes", value: "$18.00", meta: "1,200 min" },
  { label: "Total for November", value: "$258.00" },
];

export default function InvoiceSummary() {
  return (
    <div className="flex w-80 flex-col divide-y divide-line">
      {lines.map((line) => (
        <TextRow key={line.label} label={line.label} value={line.value} meta={line.meta} />
      ))}
    </div>
  );
}
```

Vue · `invoice-summary.vue`

```vue
<script setup lang="ts">
import { TextRow } from "@/components/ui/text-row";

const lines = [
  { label: "Team plan", value: "$240.00", meta: "12 seats" },
  { label: "Extra build minutes", value: "$18.00", meta: "1,200 min" },
  { label: "Total for November", value: "$258.00" },
];
</script>

<template>
  <div class="flex w-80 flex-col divide-y divide-line">
    <TextRow v-for="line in lines" :key="line.label" :label="line.label" :value="line.value" :meta="line.meta" />
  </div>
</template>
```

Svelte · `invoice-summary.svelte`

```svelte
<script lang="ts">
  import { TextRow } from "$lib/components/ui/text-row";

  const lines = [
    { label: "Team plan", value: "$240.00", meta: "12 seats" },
    { label: "Extra build minutes", value: "$18.00", meta: "1,200 min" },
    { label: "Total for November", value: "$258.00" },
  ];
</script>

<div class="flex w-80 flex-col divide-y divide-line">
  {#each lines as line (line.label)}
    <TextRow label={line.label} value={line.value} meta={line.meta} />
  {/each}
</div>
```

### Month over month

React · `month-over-month.tsx`

```tsx
import { TextRow } from "@/components/ui/text-row";

/* the note says what the value is compared with */
export default function MonthOverMonth() {
  return (
    <div className="flex w-80 flex-col">
      <TextRow label="Deploys" value="1,284" meta="+18% vs October" />
      <TextRow label="Median build time" value="48s" meta="−6s vs October" />
      <TextRow label="Failed deploys" value="3.1%" meta="+0.4 pts" />
    </div>
  );
}
```

Vue · `month-over-month.vue`

```vue
<script setup lang="ts">
import { TextRow } from "@/components/ui/text-row";
</script>

<!-- the note says what the value is compared with -->
<template>
  <div class="flex w-80 flex-col">
    <TextRow label="Deploys" value="1,284" meta="+18% vs October" />
    <TextRow label="Median build time" value="48s" meta="−6s vs October" />
    <TextRow label="Failed deploys" value="3.1%" meta="+0.4 pts" />
  </div>
</template>
```

Svelte · `month-over-month.svelte`

```svelte
<script lang="ts">
  import { TextRow } from "$lib/components/ui/text-row";
</script>

<!-- the note says what the value is compared with -->
<div class="flex w-80 flex-col">
  <TextRow label="Deploys" value="1,284" meta="+18% vs October" />
  <TextRow label="Median build time" value="48s" meta="−6s vs October" />
  <TextRow label="Failed deploys" value="3.1%" meta="+0.4 pts" />
</div>
```

### Project details in a card

React · `project-details.tsx`

```tsx
import { Card, CardBody, CardHeader, CardTitle } from "@/components/ui/card";
import { StatusPill } from "@/components/ui/status-pill";
import { TextRow } from "@/components/ui/text-row";

export default function ProjectDetails() {
  return (
    <Card className="w-80 max-w-full">
      <CardHeader>
        <CardTitle>billing-api</CardTitle>
      </CardHeader>
      <CardBody>
        <TextRow label="Status" value={<StatusPill tone="green" size="sm">Healthy</StatusPill>} />
        <TextRow label="Region" value="Frankfurt" meta="eu-central-1" />
        <TextRow label="Runtime" value="Node 22" />
        <TextRow label="Created" value="Mar 3, 2026" />
      </CardBody>
    </Card>
  );
}
```

Vue · `project-details.vue`

```vue
<script setup lang="ts">
import { Card, CardBody, CardHeader, CardTitle } from "@/components/ui/card";
import { StatusPill } from "@/components/ui/status-pill";
import { TextRow } from "@/components/ui/text-row";
</script>

<template>
  <Card class="w-80 max-w-full">
    <CardHeader>
      <CardTitle>billing-api</CardTitle>
    </CardHeader>
    <CardBody>
      <TextRow label="Status">
        <template #value><StatusPill tone="green" size="sm">Healthy</StatusPill></template>
      </TextRow>
      <TextRow label="Region" value="Frankfurt" meta="eu-central-1" />
      <TextRow label="Runtime" value="Node 22" />
      <TextRow label="Created" value="Mar 3, 2026" />
    </CardBody>
  </Card>
</template>
```

Svelte · `project-details.svelte`

```svelte
<script lang="ts">
  import { Card, CardBody, CardHeader, CardTitle } from "$lib/components/ui/card";
  import { StatusPill } from "$lib/components/ui/status-pill";
  import { TextRow } from "$lib/components/ui/text-row";
</script>

<Card class="w-80 max-w-full">
  <CardHeader>
    <CardTitle>billing-api</CardTitle>
  </CardHeader>
  <CardBody>
    <TextRow label="Status">
      {#snippet value()}<StatusPill tone="green" size="sm">Healthy</StatusPill>{/snippet}
    </TextRow>
    <TextRow label="Region" value="Frankfurt" meta="eu-central-1" />
    <TextRow label="Runtime" value="Node 22" />
    <TextRow label="Created" value="Mar 3, 2026" />
  </CardBody>
</Card>
```

### Long label on a billing form

React · `billing-contact.tsx`

```tsx
import { TextRow } from "@/components/ui/text-row";

/* a long label wraps; the value keeps its column and is never cut */
export default function BillingContact() {
  return (
    <div className="flex w-80 flex-col">
      <TextRow label="Billing email" value="billing@northwind.example" />
      <TextRow label="Tax ID for invoices issued to the Northwind workspace" value="DE 811 907 435" />
    </div>
  );
}
```

Vue · `billing-contact.vue`

```vue
<script setup lang="ts">
import { TextRow } from "@/components/ui/text-row";
</script>

<!-- a long label wraps; the value keeps its column and is never cut -->
<template>
  <div class="flex w-80 flex-col">
    <TextRow label="Billing email" value="billing@northwind.example" />
    <TextRow label="Tax ID for invoices issued to the Northwind workspace" value="DE 811 907 435" />
  </div>
</template>
```

Svelte · `billing-contact.svelte`

```svelte
<script lang="ts">
  import { TextRow } from "$lib/components/ui/text-row";
</script>

<!-- a long label wraps; the value keeps its column and is never cut -->
<div class="flex w-80 flex-col">
  <TextRow label="Billing email" value="billing@northwind.example" />
  <TextRow label="Tax ID for invoices issued to the Northwind workspace" value="DE 811 907 435" />
</div>
```

## Recipe

`text-row.recipe.ts`:

```ts
import { tv, type VariantProps } from "../lib/tv";

/* text-row — label at the start, value at the end; the workhorse of every card.
 * The label wraps when it runs out of room; the value is never truncated.
 *
 * The label, the value and its note read in their own direction ("+18%" stays "+18%" on a
 * right-to-left page, an email stays left to right); a wrapped line stays aligned to the page's
 * side (the label to the start, the values to the end), set physically from the element's own
 * direction, which plaintext does not change.
 *
 * No motion. The root slot is `base`. */

const OWN_DIRECTION = "[unicode-bidi:plaintext]";
/* aligned to the end of the page, whatever the text's own direction */
const TO_END = "[&:dir(rtl)]:text-left [&:dir(ltr)]:text-right";

export const textRow = tv({
  slots: {
    base: "flex min-w-0 min-h-11 items-center justify-between gap-4 py-2",
    label: ["flex-[1_1_0] min-w-0 text-md text-ink-2 wrap-anywhere", OWN_DIRECTION, "[&:dir(ltr)]:text-left [&:dir(rtl)]:text-right"],
    values: "flex flex-wrap items-baseline justify-end gap-x-2 min-w-0 max-w-[65%] text-end",
    value: ["text-md font-medium text-ink tabular-nums wrap-anywhere", OWN_DIRECTION, TO_END],
    meta: ["text-sm text-ink-2 whitespace-nowrap", OWN_DIRECTION, TO_END],
  },
});

export type TextRowRecipeProps = VariantProps<typeof textRow>;
```
