Skip to content
Slotted

Inline

Arranges children in one row, separated by a step of the space scale, and wraps them when the row is full.

MCMaria ChenApproverFinance

Installation

The packages are a 0.x beta on npm, and their public API changes between beta releases without deprecation. One line installs the binding and the default theme.

bash
pnpm add @slotted/react @slotted/theme @slotted/themes

Gap

gap sets the separation between items as a step on the space scale, from 0 for none to 12. The default is 4. Each row below holds the same three avatars at one step. An inline lays out one row; use Stack for a column.

Gap 0
MCTRPN
Gap 1
MCTRPN
Gap 2
MCTRPN
Gap 3
MCTRPN
Gap 4
MCTRPN
Gap 5
MCTRPN
Gap 6
MCTRPN
Gap 7
MCTRPN
Gap 8
MCTRPN
Gap 9
MCTRPN
Gap 10
MCTRPN
Gap 11
MCTRPN
Gap 12
MCTRPN

Alignment

align positions items across the row, along the block axis. The default is center. start and end put each item on the top or bottom edge of the row, and stretch makes every item as tall as the tallest one, which is visible on the badge and the button.

align start

14Late pickups

align center

14Late pickups

align end

14Late pickups

align stretch

14Late pickups

Baseline

baseline aligns items by the baseline of their text, where center aligns their boxes. Use it when items carry text of different sizes, such as a label, a figure and a note.

align center

Open invoices$48,200across 14 customers

align baseline

Open invoices$48,200across 14 customers

Justification

justify positions items along the row and distributes the free space between them: start, center, end, between, around or evenly. Without justify, items sit at the start. between pushes the first and last items to the edges.

justify start

PackedShippedDelivered

justify center

PackedShippedDelivered

justify end

PackedShippedDelivered

justify between

PackedShippedDelivered

justify around

PackedShippedDelivered

justify evenly

PackedShippedDelivered

Wrapping

wrap defaults to wrap: items that do not fit move to the next line. nowrap keeps one line: the items shrink as far as they can and overflow a container narrower than that. The badges here shorten their text, so nowrap suits items that stay readable when they shrink.

wrap wrap

WholesaleFragilePriority shippingRefrigeratedHazardous materialsSignature required

wrap nowrap

WholesaleFragilePriority shippingRefrigeratedHazardous materialsSignature required

Another element

An inline paints nothing and claims no semantics, so you choose the element. In React, render replaces the root element. In Angular, the slInline attribute goes on the element itself. A ul keeps the bullets and the indentation the browser gives it: an inline does not reset them. A row of fields with a submit button is a form, and align="end" sets the button on the bottom edge of the fields.

Accessibility

  • 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.

API

inline

Props

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

Theming

Each token is a CSS custom property: set it in a theme, or on any element to retune every inline inside it.

Theme tokens it reads

TokenDefault
--slotted-space-10.125rem
--slotted-space-102.5rem
--slotted-space-113rem
--slotted-space-124rem
--slotted-space-20.25rem
--slotted-space-30.375rem
--slotted-space-40.5rem
--slotted-space-50.75rem
--slotted-space-61rem
--slotted-space-71.25rem
--slotted-space-81.5rem
--slotted-space-92rem