Item
Pre-alphaThe registry and the CLI are not published yet.Roadmap

Item

Generic row used as the base of many interfaces.

Messages

GH

Grace HopperFound the bug. It was a moth.
09:41

2

AT

Alan TuringCan a machine think? Lunch first.
08:12
KJ
Katherine JohnsonTrajectory numbers attached.
Yesterday

LT

Linus TorvaldsJust a hobby, won’t be big.
Mon

MH

Margaret HamiltonPriority alarms are fine.
Sun

Installation

npx axiom add item
pnpm dlx axiom add item
yarn dlx axiom add item
bun x axiom add item

Also copies: tappable, slot.

Colors come from item.default.{default,pressed,selected}.{background,divider} in the component tokens.

Structure

An item has three areas:

┌─────────┬──────────────────────────┬──────────┐
│ leading │ content                  │ trailing │
└─────────┴──────────────────────────┴──────────┘

Usage

import { Item } from "@/components/ui/item";

<Item onPress={openContact}>
	<Item.Leading>
		<Avatar source={{ uri: user.photo }} fallback="JC" />
	</Item.Leading>
	<Item.Content>
		<Item.Title>Jane Cooper</Item.Title>
		<Item.Description>Product designer</Item.Description>
	</Item.Content>
	<Item.Trailing>
		<Icon name="chevron-right" />
	</Item.Trailing>
</Item>;

Props

Item

PropTypeDefaultDescription
childrenReactNodeItem.Leading, Item.Content and Item.Trailing, in that order. All three are optional.
onPress() => voidMakes the whole row pressable through Tappable, with a pressed background. Without it the row is static.
onLongPress() => voidCalled on long press. Pair it with a Menu for row actions.
size'sm' | 'md' | 'lg''md'Minimum height: 44, 52 or 64pt. Content can make the row taller.
selectedbooleanfalseTints the background with feedback.infoSubtle and sets accessibilityState.selected.
disabledbooleanfalseBlocks presses and dims title, description and icons.
dividerboolean | 'inset'falseHairline under the row. 'inset' starts it after the leading area, like iOS lists.
align'center' | 'start''center'Vertical alignment of leading and trailing, start for rows with multi-line content.
asChildbooleanfalseMerges the item into its child, for example a router Link. See Slot.
accessibilityLabelstringReplaces the text screen readers read from the row’s content.
accessibilityRoleAccessibilityRole'button' with onPressRole announced by screen readers, such as link.
accessibilityStateAccessibilityStateMerged with selected and disabled.
styleStyleProp<ViewStyle>Extra styles for the row.

Item.Leading, Item.Trailing

PropTypeDefaultDescription
childrenReactNodeAn Avatar, an Icon, a Checkbox, a Switch, a value, a Badge
styleStyleProp<ViewStyle>Extra styles for the area.

Item.Content, Item.Title, Item.Description

PropTypeDefaultDescription
childrenReactNodeItem.Title and Item.Description inside Item.Content, or anything custom.
numberOfLinesnumber1On Title and Description: lines before truncation.

Use cases

A chevron on the right says that the row opens another screen.

Account

Personal info
Payment methods

2

Addresses
<Item onPress={() => router.push("/account/payments")} divider="inset">
	<Item.Leading>
		<IconTile icon="card" color="green" />
	</Item.Leading>
	<Item.Content>
		<Item.Title>Payment methods</Item.Title>
	</Item.Content>
	<Item.Trailing>
		<Text color="muted">2</Text>
		<Icon name="chevron-right" color="subtle" />
	</Item.Trailing>
</Item>

Row with an action

The trailing area holds a button that does its own thing. The row itself stays pressable.

Suggestions

DR

Dennis Ritchie12 mutual friends

Follow

BL

Barbara LiskovFollows you

Following

ED
Edsger DijkstraNew to Axiom

Follow

<Item onPress={() => openProfile(user.id)}>
	<Item.Leading>
		<Avatar source={user.photo} fallback={user.initials} />
	</Item.Leading>
	<Item.Content>
		<Item.Title>{user.name}</Item.Title>
		<Item.Description>{user.mutuals} mutual friends</Item.Description>
	</Item.Content>
	<Item.Trailing>
		<Button
			size="sm"
			variant={user.following ? "outline" : "solid"}
			onPress={() => toggleFollow(user.id)}
		>
			{user.following ? "Following" : "Follow"}
		</Button>
	</Item.Trailing>
</Item>

Multi-line content

align="start" keeps the avatar at the top when the description wraps.

Activity

GH

Grace Hopper commented on compiler.md

“Let’s call it a debugger. Nobody will remember why.”

2 min ago

MH

Margaret Hamilton approved your pull request

1 h ago
<Item align="start">
  <Item.Leading><Avatar /></Item.Leading>
  <Item.Content>
    <Item.Title numberOfLines={2}>…</Item.Title>
    <Item.Description numberOfLines={3}>…</Item.Description>
  </Item.Content>
</Item>