# Inline

Lays out children in a horizontal row.

[View source and API](https://github.com/tempoxyz/ds/blob/main/src/web/components/Inline.tsx)

## Overview

Inline applies a spacing token `gap` between its children and centers them vertically by default.

## Examples

### Basic

```tsx
import { Inline, style } from '@tempoxyz/ds'

export function Demo() {
  return (
    <Inline gap="8">
      <span {...styles.chip()}>Public</span>
      <span {...styles.chip()}>Private</span>
    </Inline>
  )
}

namespace styles {
  export const chip = style({
    backgroundColor: 'container.regular',
    borderRadius: 'full',
    cornerShape: 'round',
    paddingBlock: '4',
    paddingInline: '12',
  })
}
```

[View example source](https://github.com/tempoxyz/ds/blob/main/docs/src/examples/demos/Inline/Basic.tsx)

### Justify

Set `justify` to `start` (default), `center`, `end`, or `between`.

```tsx
import { Inline, Stack, style } from '@tempoxyz/ds'

export const fill = true
export function Demo() {
  return (
    <Stack gap="16">
      {(['start', 'center', 'end', 'between'] as const).map((justify) => (
        <Inline justify={justify} key={justify}>
          <span>{justify}</span>
          <Inline gap="8">
            <span {...styles.chip()}>Public</span>
            <span {...styles.chip()}>Private</span>
          </Inline>
        </Inline>
      ))}
    </Stack>
  )
}

namespace styles {
  export const chip = style({
    backgroundColor: 'container.regular',
    borderRadius: 'full',
    cornerShape: 'round',
    paddingBlock: '4',
    paddingInline: '12',
  })
}
```

[View example source](https://github.com/tempoxyz/ds/blob/main/docs/src/examples/demos/Inline/Justify.tsx)

### Wrap

Set `wrap` to reflow items onto new lines instead of overflowing.

```tsx
import { Inline, style } from '@tempoxyz/ds'

export function Demo() {
  return (
    <Inline gap="8" wrap>
      {['Stablecoins', 'Payments', 'Payroll', 'Remittance', 'Treasury', 'Settlement'].map(
        (label) => (
          <span key={label} {...styles.chip()}>
            {label}
          </span>
        ),
      )}
    </Inline>
  )
}

namespace styles {
  export const chip = style({
    backgroundColor: 'container.regular',
    borderRadius: 'full',
    cornerShape: 'round',
    paddingBlock: '4',
    paddingInline: '12',
  })
}
```

[View example source](https://github.com/tempoxyz/ds/blob/main/docs/src/examples/demos/Inline/Wrap.tsx)

## Anatomy

Import the component and assemble its parts.

```tsx
import { Inline } from '@tempoxyz/ds'

<Inline />
```

## Guidelines

### When to Use

* Place related items in a row, such as buttons, badges, or an icon beside its label.
* Put a label and its value on one line, such as Network fee and 0.01 USDC.

### When Not to Use

* Use [Stack](/docs/components/stack) for a vertical column.
* Use [Grid](/docs/components/grid) to align items in rows and columns.
* Use `Frame.Actions` of [Frame](/docs/components/frame) for the actions at the bottom of a card or dialog.

### Set Wrap When Content Varies

If a row can outgrow a 320px screen, such as badges, filters, or button groups, set `wrap`.

**Do:** Set `wrap` so badges reflow onto a new line.

```tsx
/**
 * Do example for "Set Wrap When Content Varies" on the Inline page.
 * Set `wrap` so badges reflow onto a new line.
 * @module
 */
import { Badge, Inline } from '@tempoxyz/ds'

const labels = ['Payments', 'Payouts', 'Webhooks', 'Fee payer', 'Treasury', 'Settlement']

/** Renders the static preview, which the guideline card shows inert. */
export function Demo() {
  return (
    <Inline gap="8" wrap>
      {labels.map((label) => (
        <Badge key={label}>{label}</Badge>
      ))}
    </Inline>
  )
}
```

**Don't:** Let a row of badges run past its container.

```tsx
/**
 * Don't example for "Set Wrap When Content Varies" on the Inline page.
 * Don't let a row of badges run past its container.
 * @module
 */
import { Badge, Inline, style } from '@tempoxyz/ds'

const labels = ['Payments', 'Payouts', 'Webhooks', 'Fee payer', 'Treasury', 'Settlement']

/** Renders the static preview, which the guideline card shows inert. */
export function Demo() {
  return (
    <div {...styles.frame()}>
      <Inline gap="8">
        {labels.map((label) => (
          <Badge key={label}>{label}</Badge>
        ))}
      </Inline>
    </div>
  )
}

namespace styles {
  export const frame = style({ width: '100% !custom' })
}
```

### Align by Content

* **Center (align="center"):** The default, for icons, buttons, and badges.
* **Baseline (align="baseline"):** For text in different sizes, such as an amount and its symbol.
* **Between (justify="between"):** Pushes a value or action to the far end of the row.

### Pick a Gap From the Scale

* **Tags and Icons (8):** The default, for badges and icons with labels.
* **Buttons (12):** Between buttons.
* **Clusters (24 or 32):** Between separate clusters in a toolbar.

## Accessibility

Inline has no role, name, or keyboard behavior.

### Semantics

* **Default Element (div):** Has no role. Screen readers pass over it.
* **Semantic Element (render):** If the row holds items or links, render a list or nav, such as `render={<ul />}`.

### Your Responsibilities

* **Match DOM and Visual Order (Tab):** Don't reorder children with CSS or reversed directions. Reading and focus follow the DOM ([SC 1.3.2](https://www.w3.org/WAI/WCAG22/Understanding/meaningful-sequence.html), [SC 2.4.3](https://www.w3.org/WAI/WCAG22/Understanding/focus-order.html)).

## Related

[Stack](/docs/components/stack)

Use for vertical spacing.

[Button](/docs/components/button)

Use for ordering actions in a row.

[Badge](/docs/components/badge)

Use for status labels.

[Layout](/docs/foundations/layout)

Covers the spacing scale.
