<!-- index: /slotted/llms.txt -->
# inline

`data-ui="inline"` · Row of items with gaps that wraps.

## Minimal example

Example

```tsx
import { Avatar } from '@slotted/react/avatar';
import { Badge } from '@slotted/react/badge';
import { Inline } from '@slotted/react/inline';
import { Text } from '@slotted/react/typography';

export default function InlineBasic() {
  return (
    <Inline>
      <Avatar name="Maria Chen" />
      <Text weight="semibold">Maria Chen</Text>
      <Badge tone="success">Approver</Badge>
      <Badge tone="info">Finance</Badge>
    </Inline>
  );
}
```

## Props

| Name | Type | Default | Applies to | Description |
| --- | --- | --- | --- | --- |
| `gap` | `0 \| 1 \| … \| 12` | 4 | Inline | Sets the separation between items as a step on the space scale. |
| `align` | `'start' \| 'center' \| 'end' \| 'stretch' \| 'baseline'` | center | Inline | Positions items across the row, along the block axis. baseline puts their text on one line. |
| `justify` | `'start' \| 'center' \| 'end' \| 'between' \| 'around' \| 'evenly'` | — | Inline | Positions items along the row and distributes the free space between them. |
| `wrap` | `'wrap' \| 'nowrap'` | wrap | Inline | Decides what happens when the row is full. nowrap keeps one line and overflows a container narrower than it. |
| `render` | `(props) => ReactNode` | — | Inline | Renders a different root element from the props it receives. |

## Axes and defaults

| Axis | Values | Default |
| --- | --- | --- |
| `gap` | `0`, `1`, `2`, `3`, `4`, `5`, `6`, `7`, `8`, `9`, `10`, `11`, `12` | `4` |
| `align` | `start`, `center`, `end`, `stretch`, `baseline` | `center` |
| `justify` | `start`, `center`, `end`, `between`, `around`, `evenly` | — |
| `wrap` | `wrap`, `nowrap` | `wrap` |

## Rules

- Inline has no role and no ARIA. It arranges what you write inside it, and the items keep whatever semantics they already had.
- There is no axis that reverses the items. Visual order stays DOM order, which is what WCAG 2.2 SC 1.3.2 asks for (technique C27, failure F1) and what keeps the Tab order matching the page.
- Wrapping is the default because a row that cannot wrap has one answer to a narrow container: overflow it. nowrap accepts that overflow, so check WCAG 1.4.10 Reflow before choosing it.
- baseline is the alignment for items that carry text of different sizes. It puts the type on one line where centering only puts the boxes there.
- Alignment and distribution use the logical keywords, so a right-to-left document is the same row mirrored.

## Tokens

`--slotted-space-1`, `--slotted-space-10`, `--slotted-space-11`, `--slotted-space-12`, `--slotted-space-2`, `--slotted-space-3`, `--slotted-space-4`, `--slotted-space-5`, `--slotted-space-6`, `--slotted-space-7`, `--slotted-space-8`, `--slotted-space-9`

## Examples

### Cancel and confirm, pushed apart

Excerpt — not a complete module

```tsx
<Inline gap={4} justify="between">
  <Button tone="secondary" variant="outline">
    Cancel
  </Button>
  <Button>Save changes</Button>
</Inline>;
```

### A list of tags that wraps

Excerpt — not a complete module

```tsx
<Inline gap={2} render={(props) => <ul {...props} />}>
  {tags.map((tag) => (
    <li key={tag}>
      <Tag>{tag}</Tag>
    </li>
  ))}
</Inline>;
```

### A label and a value on one line

Excerpt — not a complete module

```tsx
<Inline align="baseline" gap={5}>
  <Text tone="muted">Status</Text>
  <Text size="lg" weight="semibold">
    Awaiting review
  </Text>
</Inline>;
```

### align.tsx

Example

```tsx
import { Badge } from '@slotted/react/badge';
import { Button } from '@slotted/react/button';
import { Card, CardBody, CardHeader } from '@slotted/react/card';
import { Inline } from '@slotted/react/inline';
import { Stack } from '@slotted/react/stack';
import { Heading, Text } from '@slotted/react/typography';

const ALIGNS = ['start', 'center', 'end', 'stretch'] as const;

export default function InlineAlign() {
  return (
    <Stack gap={4}>
      {ALIGNS.map((align) => (
        <Card key={align}>
          <CardHeader>
            <Heading level={2} size="sm">
              align {align}
            </Heading>
          </CardHeader>
          <CardBody>
            <Inline align={align}>
              <Text size="3xl" weight="semibold">
                14
              </Text>
              <Badge tone="warning">Late pickups</Badge>
              <Button tone="secondary" variant="outline">
                Review
              </Button>
            </Inline>
          </CardBody>
        </Card>
      ))}
    </Stack>
  );
}
```

### baseline.tsx

Example

```tsx
import { Card, CardBody, CardHeader } from '@slotted/react/card';
import { Inline } from '@slotted/react/inline';
import { Stack } from '@slotted/react/stack';
import { Heading, Text } from '@slotted/react/typography';

const ALIGNS = ['center', 'baseline'] as const;

export default function InlineBaseline() {
  return (
    <Stack gap={4}>
      {ALIGNS.map((align) => (
        <Card key={align}>
          <CardHeader>
            <Heading level={2} size="sm">
              align {align}
            </Heading>
          </CardHeader>
          <CardBody>
            <Inline align={align} gap={3}>
              <Text tone="muted">Open invoices</Text>
              <Text numeric="tabular" size="3xl" weight="semibold">
                $48,200
              </Text>
              <Text size="sm" tone="muted">
                across 14 customers
              </Text>
            </Inline>
          </CardBody>
        </Card>
      ))}
    </Stack>
  );
}
```

### form.tsx

Example

```tsx
import { Button } from '@slotted/react/button';
import { Field, FieldLabel } from '@slotted/react/field';
import { Inline } from '@slotted/react/inline';
import { TextField } from '@slotted/react/text-field';

export default function InlineForm() {
  return (
    <Inline
      align="end"
      gap={3}
      render={(props) => (
        <form
          {...props}
          aria-label="Find orders"
          onSubmit={(event) => {
            event.preventDefault();
          }}
        />
      )}
    >
      <Field>
        <FieldLabel>Order number</FieldLabel>
        <TextField placeholder="SO-10482" />
      </Field>
      <Field>
        <FieldLabel>Customer</FieldLabel>
        <TextField placeholder="Harbor Street store" />
      </Field>
      <Button type="submit">Search</Button>
    </Inline>
  );
}
```

### gap.tsx

Example

```tsx
import { Avatar } from '@slotted/react/avatar';
import { Grid } from '@slotted/react/grid';
import { Inline } from '@slotted/react/inline';
import { Stack } from '@slotted/react/stack';
import { Text } from '@slotted/react/typography';

const GAPS = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12] as const;
const PEOPLE = ['Maria Chen', 'Tomas Reyes', 'Priya Nair'] as const;

export default function InlineGap() {
  return (
    <Grid columns={2} gap={5} minItemWidth="sm">
      {GAPS.map((gap) => (
        <Stack key={gap} gap={1}>
          <Text size="xs" tone="muted">
            Gap {gap}
          </Text>
          <Inline gap={gap}>
            {PEOPLE.map((person) => (
              <Avatar key={person} name={person} size="sm" />
            ))}
          </Inline>
        </Stack>
      ))}
    </Grid>
  );
}
```

### justify.tsx

Example

```tsx
import { Badge } from '@slotted/react/badge';
import { Card, CardBody, CardHeader } from '@slotted/react/card';
import { Inline } from '@slotted/react/inline';
import { Stack } from '@slotted/react/stack';
import { Heading } from '@slotted/react/typography';

const JUSTIFIES = ['start', 'center', 'end', 'between', 'around', 'evenly'] as const;

export default function InlineJustify() {
  return (
    <Stack gap={4}>
      {JUSTIFIES.map((justify) => (
        <Card key={justify}>
          <CardHeader>
            <Heading level={2} size="sm">
              justify {justify}
            </Heading>
          </CardHeader>
          <CardBody>
            <Inline justify={justify}>
              <Badge tone="info">Packed</Badge>
              <Badge tone="warning">Shipped</Badge>
              <Badge tone="success">Delivered</Badge>
            </Inline>
          </CardBody>
        </Card>
      ))}
    </Stack>
  );
}
```

### wrap.tsx

Example

```tsx
import { Badge } from '@slotted/react/badge';
import { Card, CardBody, CardHeader } from '@slotted/react/card';
import { Inline } from '@slotted/react/inline';
import { Stack } from '@slotted/react/stack';
import { Heading } from '@slotted/react/typography';

const WRAPS = ['wrap', 'nowrap'] as const;
const LABELS = [
  'Wholesale',
  'Fragile',
  'Priority shipping',
  'Refrigerated',
  'Hazardous materials',
  'Signature required',
] as const;

export default function InlineWrap() {
  return (
    <Stack gap={4}>
      {WRAPS.map((wrap) => (
        <Card key={wrap}>
          <CardHeader>
            <Heading level={2} size="sm">
              wrap {wrap}
            </Heading>
          </CardHeader>
          <CardBody>
            <Inline gap={2} wrap={wrap}>
              {LABELS.map((label) => (
                <Badge key={label} tone="secondary" variant="outline">
                  {label}
                </Badge>
              ))}
            </Inline>
          </CardBody>
        </Card>
      ))}
    </Stack>
  );
}
```
