Skip to content

An open source design system that's fully customizable and agent ready

TypeScript

fix(list): distinguish spacious density (#2781)

Cindy Zhangd0269e615ec6
diff --git a/.changeset/list-item-spacious-density.md b/.changeset/list-item-spacious-density.md
new file mode 100644
index 0000000000..b2a330eb35
--- /dev/null
+++ b/.changeset/list-item-spacious-density.md
@@ -0,0 +1,5 @@
+---
+'@xds/core': patch
+---
+
+Align `XDSItem` with list-like component APIs by using `compact`/`balanced`/`spacious` density and `startContent`/`endContent` slots, then pass `XDSListItem` density through directly. Previously List’s `balanced` and `spacious` densities both fell back to the same item padding after `XDSListItem` was refactored to compose `XDSItem`.
diff --git a/apps/docsite/src/components/ThemeCardShowcase.tsx b/apps/docsite/src/components/ThemeCardShowcase.tsx
index 596d2e6224..ff6a26a060 100644
--- a/apps/docsite/src/components/ThemeCardShowcase.tsx
+++ b/apps/docsite/src/components/ThemeCardShowcase.tsx
@@ -654,7 +654,7 @@ function ChatCard() {
Here’s everything I have on order #1043:
</XDSText>
{/* Compact order-summary block — XDSItem rows give
- a label/description + trailing value pair without
+ a label/description + endContent value pair without
any custom layout code. Wrapped in XDSCard so the
block reads as a distinct artifact within the
prose, similar to a Copilot tool-call result. */}
@@ -663,7 +663,7 @@ function ChatCard() {
<XDSItem
label="Items"
description="Minimalist Watch · Linen Throw"
- trailing={
+ endContent={
<XDSText type="body" weight="bold">
$248
</XDSText>
@@ -672,7 +672,7 @@ function ChatCard() {
<XDSItem
label="Shipping"
description="UPS Ground"
- trailing={
+ endContent={
<XDSText type="body" weight="bold">
$12
</XDSText>
@@ -681,12 +681,12 @@ function ChatCard() {
<XDSItem
label="Estimated arrival"
description="Tomorrow by 8pm"
- trailing={<XDSBadge variant="green" label="On time" />}
+ endContent={<XDSBadge variant="green" label="On time" />}
/>
<XDSItem
label="Tracking"
description="UPS 1Z 999 AA1 0123 4567 84"
- trailing={<XDSLink href="#">Track →</XDSLink>}
+ endContent={<XDSLink href="#">Track →</XDSLink>}
/>
</XDSVStack>
</XDSCard>
@@ -875,14 +875,14 @@ function LatestActivityCard() {
{ACTIVITY.map(item => (
<XDSItem
key={item.id}
- media={
+ startContent={
<div {...stylex.props(styles.activityIcon)} aria-hidden="true">
{item.icon}
</div>
}
label={item.label}
description={item.detail}
- trailing={
+ endContent={
<XDSText
type="body"
weight="bold"
diff --git a/apps/storybook/stories/Item.stories.tsx b/apps/storybook/stories/Item.stories.tsx
index 386c12535f..0f9a094aa9 100644
--- a/apps/storybook/stories/Item.stories.tsx
+++ b/apps/storybook/stories/Item.stories.tsx
@@ -37,7 +37,7 @@ const meta: Meta<typeof XDSItem> = {
tags: ['autodocs'],
argTypes: {
align: {control: 'select', options: ['center', 'start']},
- density: {control: 'select', options: ['default', 'compact']},
+ density: {control: 'select', options: ['compact', 'balanced', 'spacious']},
},
};
@@ -48,10 +48,10 @@ type Story = StoryObj<typeof XDSItem>;
export const Default: Story = {
render: () => (
<XDSItem
- media={<XDSIcon icon={UserIcon} size="sm" />}
+ startContent={<XDSIcon icon={UserIcon} size="sm" />}
label="Alice Johnson"
description="Software Engineer"
- trailing={<XDSBadge label="Admin" />}
+ endContent={<XDSBadge label="Admin" />}
/>
),
};
@@ -61,23 +61,23 @@ export const ContactList: Story = {
render: () => (
<XDSStack gap={0}>
<XDSItem
- media={<XDSAvatar name="Alice Johnson" size={40} />}
+ startContent={<XDSAvatar name="Alice Johnson" size={40} />}
label="Alice Johnson"
description="Engineering Lead"
- trailing={<XDSBadge label="Admin" />}
+ endContent={<XDSBadge label="Admin" />}
onClick={() => {}}
/>
<XDSItem
- media={<XDSAvatar name="Bob Smith" size={40} />}
+ startContent={<XDSAvatar name="Bob Smith" size={40} />}
label="Bob Smith"
description="Product Designer"
onClick={() => {}}
/>
<XDSItem
- media={<XDSAvatar name="Carol Williams" size={40} />}
+ startContent={<XDSAvatar name="Carol Williams" size={40} />}
label="Carol Williams"
description="Data Scientist"
- trailing={<XDSText color="secondary">Away</XDSText>}
+ endContent={<XDSText color="secondary">Away</XDSText>}
onClick={() => {}}
/>
</XDSStack>
@@ -89,26 +89,26 @@ export const Notifications: Story = {
render: () => (
<XDSStack gap={0}>
<XDSItem
- media={<XDSAvatar name="Alice" size={40} />}
+ startContent={<XDSAvatar name="Alice" size={40} />}
label={
<>
<b>Alice</b> commented on your PR
</>
}
description="Looks good, one nit on the error handling..."
- trailing={<XDSText color="secondary">2h ago</XDSText>}
+ endContent={<XDSText color="secondary">2h ago</XDSText>}
descriptionLines={1}
onClick={() => {}}
/>
<XDSItem
- media={
+ startContent={
<div {...stylex.props(storyStyles.iconCircle)}>
<XDSIcon icon={BellIcon} size="sm" />
</div>
}
label="Build completed successfully"
description="Pipeline #4521 — all 42 tests passed"
- trailing={<XDSText color="secondary">5h ago</XDSText>}
+ endContent={<XDSText color="secondary">5h ago</XDSText>}
descriptionLines={1}
onClick={() => {}}
/>
@@ -121,29 +121,50 @@ export const CompactMenu: Story = {
render: () => (
<XDSStack gap={0}>
<XDSItem
- media={<XDSIcon icon={PencilSquareIcon} size="sm" />}
+ startContent={<XDSIcon icon={PencilSquareIcon} size="sm" />}
label="Edit"
density="compact"
onClick={() => {}}
/>
<XDSItem
- media={<XDSIcon icon={Cog6ToothIcon} size="sm" />}
+ startContent={<XDSIcon icon={Cog6ToothIcon} size="sm" />}
label="Settings"
description="Manage your preferences"
density="compact"
onClick={() => {}}
/>
<XDSItem
- media={<XDSIcon icon={ChatBubbleLeftIcon} size="sm" />}
+ startContent={<XDSIcon icon={ChatBubbleLeftIcon} size="sm" />}
label="Messages"
density="compact"
- trailing={<XDSBadge label="12" />}
+ endContent={<XDSBadge label="12" />}
onClick={() => {}}
/>
</XDSStack>
),
};
+/** Spacious item rows for roomy layouts. */
+export const SpaciousRows: Story = {
+ render: () => (
+ <XDSStack gap={0}>
+ <XDSItem
+ startContent={<XDSIcon icon={BellIcon} size="sm" />}
+ label="Product updates"
+ description="Major announcements and release notes"
+ density="spacious"
+ />
+ <XDSItem
+ startContent={<XDSIcon icon={ChatBubbleLeftIcon} size="sm" />}
+ label="Team messages"
+ description="Direct messages, mentions, and thread replies"
+ endContent={<XDSBadge label="4" />}
+ density="spacious"
+ />
+ </XDSStack>
+ ),
+};
+
/** File browser with selection state. */
export const FileBrowser: Story = {
render: function FileBrowserStory() {
@@ -162,26 +183,26 @@ export const FileBrowser: Story = {
return (
<XDSStack gap={0}>
<XDSItem
- media={<XDSIcon icon={DocumentIcon} size="sm" />}
+ startContent={<XDSIcon icon={DocumentIcon} size="sm" />}
label="design-spec.pdf"
description="Modified 2 hours ago"
- trailing={<XDSText color="secondary">2.4 MB</XDSText>}
+ endContent={<XDSText color="secondary">2.4 MB</XDSText>}
isSelected={selected.has('doc1')}
onClick={() => toggle('doc1')}
/>
<XDSItem
- media={<XDSIcon icon={DocumentIcon} size="sm" />}
+ startContent={<XDSIcon icon={DocumentIcon} size="sm" />}
label="architecture-diagram.png"
description="Modified yesterday"
- trailing={<XDSText color="secondary">1.2 MB</XDSText>}
+ endContent={<XDSText color="secondary">1.2 MB</XDSText>}
isSelected={selected.has('doc2')}
onClick={() => toggle('doc2')}
/>
<XDSItem
- media={<XDSIcon icon={DocumentIcon} size="sm" />}
+ startContent={<XDSIcon icon={DocumentIcon} size="sm" />}
label="meeting-notes.md"
description="Modified 3 days ago"
- trailing={<XDSText color="secondary">48 KB</XDSText>}
+ endContent={<XDSText color="secondary">48 KB</XDSText>}
isSelected={selected.has('doc3')}
onClick={() => toggle('doc3')}
/>
@@ -195,7 +216,7 @@ export const SearchResults: Story = {
render: () => (
<XDSStack gap={0}>
<XDSItem
- media={<XDSIcon icon={MagnifyingGlassIcon} size="sm" />}
+ startContent={<XDSIcon icon={MagnifyingGlassIcon} size="sm" />}
label={
<>
XDS <b>Button</b> Component
@@ -206,7 +227,7 @@ export const SearchResults: Story = {
href="/docs/button"
/>
<XDSItem
- media={<XDSIcon icon={MagnifyingGlassIcon} size="sm" />}
+ startContent={<XDSIcon icon={MagnifyingGlassIcon} size="sm" />}
label={
<>
XDS <b>Button</b>Group
@@ -225,13 +246,13 @@ export const Disabled: Story = {
render: () => (
<XDSStack gap={0}>
<XDSItem
- media={<XDSIcon icon={UserIcon} size="sm" />}
+ startContent={<XDSIcon icon={UserIcon} size="sm" />}
label="Active item"
description="This item is interactive"
onClick={() => {}}
/>
<XDSItem
- media={<XDSIcon icon={UserIcon} size="sm" />}
+ startContent={<XDSIcon icon={UserIcon} size="sm" />}
label="Disabled item"
description="This item cannot be interacted with"
onClick={() => {}}
@@ -246,10 +267,10 @@ export const AlignStart: Story = {
render: () => (
<XDSItem
align="start"
- media={<XDSAvatar name="Alice" size={40} />}
+ startContent={<XDSAvatar name="Alice" size={40} />}
label="Alice Johnson"
- description="This is a longer description that wraps across multiple lines to demonstrate the align=start behavior, which positions the media and trailing content at the top rather than vertically centering them."
- trailing={<XDSText color="secondary">Just now</XDSText>}
+ description="This is a longer description that wraps across multiple lines to demonstrate the align=start behavior, which positions the start and end content at the top rather than vertically centering them."
+ endContent={<XDSText color="secondary">Just now</XDSText>}
/>
),
};
diff --git a/packages/cli/templates/blocks/components/Item/ItemBasicItem.doc.mjs b/packages/cli/templates/blocks/components/Item/ItemBasicItem.doc.mjs
index 4beddbd2bb..b513bac591 100644
--- a/packages/cli/templates/blocks/components/Item/ItemBasicItem.doc.mjs
+++ b/packages/cli/templates/blocks/components/Item/ItemBasicItem.doc.mjs
@@ -7,7 +7,7 @@ export const doc = {
name: 'Item — Basic',
displayName: 'Item — Basic',
description:
- 'A basic item with a label, supporting description, and trailing timestamp. Use this for simple rows that need consistent text alignment and spacing.',
+ 'A basic item with a label, supporting description, and end-aligned timestamp. Use this for simple rows that need consistent text alignment and spacing.',
isReady: true,
aspectRatio: 16 / 9,
componentsUsed: ['Item', 'Text', 'Layout'],
diff --git a/packages/cli/templates/blocks/components/Item/ItemBasicItem.tsx b/packages/cli/templates/blocks/components/Item/ItemBasicItem.tsx
index 102397f3ed..d74adc2896 100644
--- a/packages/cli/templates/blocks/components/Item/ItemBasicItem.tsx
+++ b/packages/cli/templates/blocks/components/Item/ItemBasicItem.tsx
@@ -12,17 +12,17 @@ export default function ItemBasicItem() {
<XDSItem
label="Quarterly planning"
description="Agenda, notes, and action items"
- trailing={<XDSText color="secondary">Today</XDSText>}
+ endContent={<XDSText color="secondary">Today</XDSText>}
/>
<XDSItem
label="Customer research"
description="Interview notes from the latest study"
- trailing={<XDSText color="secondary">Yesterday</XDSText>}
+ endContent={<XDSText color="secondary">Yesterday</XDSText>}
/>
<XDSItem
label="Launch checklist"
description="Remaining tasks before release"
- trailing={<XDSText color="secondary">Fri</XDSText>}
+ endContent={<XDSText color="secondary">Fri</XDSText>}
/>
</XDSStack>
);
diff --git a/packages/cli/templates/blocks/components/Item/ItemShowcase.tsx b/packages/cli/templates/blocks/components/Item/ItemShowcase.tsx
index de07ca6614..ce20886e7d 100644
--- a/packages/cli/templates/blocks/components/Item/ItemShowcase.tsx
+++ b/packages/cli/templates/blocks/components/Item/ItemShowcase.tsx
@@ -14,30 +14,30 @@ export default function ItemShowcase() {
return (
<XDSStack gap={0}>
<XDSItem
- media={<XDSAvatar name="Alice Johnson" size={40} />}
+ startContent={<XDSAvatar name="Alice Johnson" size={40} />}
label="Alice Johnson"
description="Engineering Lead"
- trailing={<XDSBadge label="Admin" />}
+ endContent={<XDSBadge label="Admin" />}
onClick={() => {}}
/>
<XDSItem
- media={<XDSIcon icon={BellIcon} size="sm" />}
+ startContent={<XDSIcon icon={BellIcon} size="sm" />}
label="Build completed successfully"
description="Pipeline #4521 — all 42 tests passed"
- trailing={<XDSText color="secondary">5h ago</XDSText>}
+ endContent={<XDSText color="secondary">5h ago</XDSText>}
descriptionLines={1}
onClick={() => {}}
/>
<XDSItem
- media={<XDSIcon icon={DocumentIcon} size="sm" />}
+ startContent={<XDSIcon icon={DocumentIcon} size="sm" />}
label="design-spec.pdf"
description="Modified 2 hours ago"
- trailing={<XDSText color="secondary">2.4 MB</XDSText>}
+ endContent={<XDSText color="secondary">2.4 MB</XDSText>}
isSelected
onClick={() => {}}
/>
<XDSItem
- media={<XDSIcon icon={UserIcon} size="sm" />}
+ startContent={<XDSIcon icon={UserIcon} size="sm" />}
label="Compact menu item"
density="compact"
onClick={() => {}}
diff --git a/packages/cli/templates/blocks/components/Item/ItemWithMedia.doc.mjs b/packages/cli/templates/blocks/components/Item/ItemWithMedia.doc.mjs
index f04338b2a2..326b467463 100644
--- a/packages/cli/templates/blocks/components/Item/ItemWithMedia.doc.mjs
+++ b/packages/cli/templates/blocks/components/Item/ItemWithMedia.doc.mjs
@@ -4,10 +4,10 @@
export const doc = {
type: 'block',
exampleFor: 'Item',
- name: 'Item — Media',
- displayName: 'Item — Media',
+ name: 'Item — Start Content',
+ displayName: 'Item — Start Content',
description:
- 'Items with leading avatars and icons in the media slot. Keep media small so the row stays compact and easy to scan.',
+ 'Items with leading avatars and icons in the startContent slot. Keep start content small so the row stays compact and easy to scan.',
isReady: true,
aspectRatio: 16 / 9,
componentsUsed: ['Item', 'Avatar', 'Badge', 'Icon', 'Text', 'Layout'],
diff --git a/packages/cli/templates/blocks/components/Item/ItemWithMedia.tsx b/packages/cli/templates/blocks/components/Item/ItemWithMedia.tsx
index 120ea467ba..c742b54b69 100644
--- a/packages/cli/templates/blocks/components/Item/ItemWithMedia.tsx
+++ b/packages/cli/templates/blocks/components/Item/ItemWithMedia.tsx
@@ -13,24 +13,24 @@ export default function ItemWithMedia() {
return (
<XDSStack gap={0}>
<XDSItem
- media={<XDSAvatar name="Ada Lovelace" size="xsmall" />}
+ startContent={<XDSAvatar name="Ada Lovelace" size="xsmall" />}
label="Ada Lovelace"
description="Design systems engineer"
- trailing={<XDSBadge label="Owner" variant="purple" />}
+ endContent={<XDSBadge label="Owner" variant="purple" />}
onClick={() => {}}
/>
<XDSItem
- media={<XDSAvatar name="Grace Hopper" size="xsmall" />}
+ startContent={<XDSAvatar name="Grace Hopper" size="xsmall" />}
label="Grace Hopper"
description="Compiler platform"
- trailing={<XDSText color="secondary">Online</XDSText>}
+ endContent={<XDSText color="secondary">Online</XDSText>}
onClick={() => {}}
/>
<XDSItem
- media={<XDSIcon icon="info" size="sm" color="secondary" />}
+ startContent={<XDSIcon icon="info" size="sm" color="secondary" />}
label="Review handoff notes"
description="Updated guidance is ready for the team"
- trailing={<XDSBadge label="New" variant="blue" />}
+ endContent={<XDSBadge label="New" variant="blue" />}
onClick={() => {}}
/>
</XDSStack>
diff --git a/packages/cli/templates/blocks/components/Item/ItemWithMetadata.doc.mjs b/packages/cli/templates/blocks/components/Item/ItemWithMetadata.doc.mjs
index 23a9b7246e..e57eb103a1 100644
--- a/packages/cli/templates/blocks/components/Item/ItemWithMetadata.doc.mjs
+++ b/packages/cli/templates/blocks/components/Item/ItemWithMetadata.doc.mjs
@@ -7,7 +7,7 @@ export const doc = {
name: 'Item — Metadata',
displayName: 'Item — Metadata',
description:
- 'Items with end-aligned metadata and badges. Use the trailing slot for counts, status, timestamps, and other secondary row information.',
+ 'Items with end-aligned metadata and badges. Use the endContent slot for counts, status, timestamps, and other secondary row information.',
isReady: true,
aspectRatio: 16 / 9,
componentsUsed: ['Item', 'Badge', 'Icon', 'Text', 'Layout'],
diff --git a/packages/cli/templates/blocks/components/Item/ItemWithMetadata.tsx b/packages/cli/templates/blocks/components/Item/ItemWithMetadata.tsx
index 52883bc8a0..c5a9d4649d 100644
--- a/packages/cli/templates/blocks/components/Item/ItemWithMetadata.tsx
+++ b/packages/cli/templates/blocks/components/Item/ItemWithMetadata.tsx
@@ -12,23 +12,23 @@ export default function ItemWithMetadata() {
return (
<XDSStack gap={0}>
<XDSItem
- media={<XDSIcon icon="check" size="sm" color="success" />}
+ startContent={<XDSIcon icon="check" size="sm" color="success" />}
label="Build passed"
description="Production deploy completed"
- trailing={<XDSText color="secondary">2m ago</XDSText>}
+ endContent={<XDSText color="secondary">2m ago</XDSText>}
/>
<XDSItem
- media={<XDSIcon icon="warning" size="sm" color="warning" />}
+ startContent={<XDSIcon icon="warning" size="sm" color="warning" />}
label="High memory usage"
description="Worker pool is above the warning threshold"
- trailing={<XDSBadge label="Warning" variant="warning" />}
+ endContent={<XDSBadge label="Warning" variant="warning" />}
isHighlighted
/>
<XDSItem
- media={<XDSIcon icon="error" size="sm" color="error" />}
+ startContent={<XDSIcon icon="error" size="sm" color="error" />}
label="Sync failed"
description="Retry after checking service credentials"
- trailing={<XDSBadge label="Action" variant="error" />}
+ endContent={<XDSBadge label="Action" variant="error" />}
isSelected
/>
</XDSStack>
diff --git a/packages/cli/templates/pages/theme-showcase/page.tsx b/packages/cli/templates/pages/theme-showcase/page.tsx
index 3170cd7ab1..33ab29cdc8 100644
--- a/packages/cli/templates/pages/theme-showcase/page.tsx
+++ b/packages/cli/templates/pages/theme-showcase/page.tsx
@@ -717,7 +717,7 @@ function ChatCard() {
<XDSItem
label="Items"
description="Minimalist Watch · Linen Throw"
- trailing={
+ endContent={
<XDSText type="body" weight="bold">
$248
</XDSText>
@@ -726,7 +726,7 @@ function ChatCard() {
<XDSItem
label="Shipping"
description="UPS Ground"
- trailing={
+ endContent={
<XDSText type="body" weight="bold">
$12
</XDSText>
@@ -735,12 +735,12 @@ function ChatCard() {
<XDSItem
label="Estimated arrival"
description="Tomorrow by 8pm"
- trailing={<XDSBadge variant="green" label="On time" />}
+ endContent={<XDSBadge variant="green" label="On time" />}
/>
<XDSItem
label="Tracking"
description="UPS 1Z 999 AA1 0123 4567 84"
- trailing={<XDSLink href="#">Track →</XDSLink>}
+ endContent={<XDSLink href="#">Track →</XDSLink>}
/>
</XDSVStack>
</XDSCard>
@@ -899,14 +899,14 @@ function LatestActivityCard({isMobile}: {isMobile: boolean}) {
{ACTIVITY.map(item => (
<XDSItem
key={item.id}
- media={
+ startContent={
<div style={inlineStyles.activityIcon} aria-hidden="true">
{item.icon}
</div>
}
label={item.label}
description={item.detail}
- trailing={
+ endContent={
<XDSText
type="body"
weight="bold"
diff --git a/packages/core/src/CheckboxList/XDSCheckboxList.test.tsx b/packages/core/src/CheckboxList/XDSCheckboxList.test.tsx
index 0e6f8ca35f..0a94b3ad29 100644
--- a/packages/core/src/CheckboxList/XDSCheckboxList.test.tsx
+++ b/packages/core/src/CheckboxList/XDSCheckboxList.test.tsx
@@ -201,6 +201,19 @@ describe('XDSCheckboxList', () => {
expect(screen.getByTestId('my-checkbox-list')).toBeInTheDocument();
});
+ it('passes spacious density through to checkbox list items', () => {
+ render(
+ <XDSCheckboxList
+ label="Preferences"
+ density="spacious"
+ value={[]}
+ onChange={() => {}}>
+ <XDSCheckboxListItem label="Option A" value="a" />
+ </XDSCheckboxList>,
+ );
+ expect(screen.getByRole('listitem').className).toContain('spacious');
+ });
+
it('supports data-testid on CheckboxListItem', () => {
render(
<XDSCheckboxList label="Preferences" value={[]} onChange={() => {}}>
diff --git a/packages/core/src/DropdownMenu/XDSDropdownMenuItem.tsx b/packages/core/src/DropdownMenu/XDSDropdownMenuItem.tsx
index 770c82cc8b..a513cd21f7 100644
--- a/packages/core/src/DropdownMenu/XDSDropdownMenuItem.tsx
+++ b/packages/core/src/DropdownMenu/XDSDropdownMenuItem.tsx
@@ -10,7 +10,7 @@
* Interactive menu item with role="menuitem". Keyboard navigation
* is handled by useListFocus on the parent menu container.
*
- * Composes XDSItem for the shared media + label + description + trailing layout.
+ * Composes XDSItem for the shared start content + label + description + end content layout.
* Passes role="menuitem" so XDSItem puts onClick on the root div instead of
* creating an invisible button (keyboard access is provided by the parent menu).
*
@@ -143,14 +143,14 @@ export function XDSDropdownMenuItem({
<XDSItem
role="menuitem"
tabIndex={isDisabled ? undefined : -1}
- media={
+ startContent={
icon
? renderIconSlot(icon, {size: 'sm', color: 'secondary'})
: undefined
}
label={label}
description={description}
- trailing={children}
+ endContent={children}
onClick={handleClick}
isDisabled={isDisabled}
xstyle={[
diff --git a/packages/core/src/Item/Item.doc.mjs b/packages/core/src/Item/Item.doc.mjs
index 3c7364bf53..a558c5a8e1 100644
--- a/packages/core/src/Item/Item.doc.mjs
+++ b/packages/core/src/Item/Item.doc.mjs
@@ -24,16 +24,16 @@ export const docs = {
{
name: 'XDSItem',
displayName: 'Item',
- description: 'A universal item primitive that unifies the "media + label + description + trailing content" layout pattern. Use as a building block for list items, menu items, contact rows, notifications, and more.',
+ description: 'A universal item primitive that unifies the "start content + label + description + end content" layout pattern. Use as a building block for list items, menu items, contact rows, notifications, and more.',
props: [
{name: 'label', type: 'ReactNode', description: 'Primary text identifying this item. Accepts string (auto-truncated) or ReactNode (for rich content).', required: true},
- {name: 'media', type: 'ReactNode', description: 'Leading visual — avatar, icon, image, or any ReactNode.', slotElements: [{__element: 'XDSAvatar', props: {name: 'Ada Lovelace', size: 'xsmall'}}, {__element: 'XDSIcon', props: {icon: 'info', size: 'sm', color: 'secondary'}}]},
+ {name: 'marker', type: 'ReactNode', description: 'Marker rendered before startContent as a direct flex child. Use for list bullets/counters that need custom baseline alignment.'},
+ {name: 'startContent', type: 'ReactNode', description: 'Content rendered before the label/description area, such as an icon, avatar, or checkbox.', slotElements: [{__element: 'XDSAvatar', props: {name: 'Ada Lovelace', size: 'xsmall'}}, {__element: 'XDSIcon', props: {icon: 'info', size: 'sm', color: 'secondary'}}]},
{name: 'description', type: 'ReactNode', description: 'Secondary text — subtitle, description, or supporting info.'},
- {name: 'trailing', type: 'ReactNode', description: 'Trailing content — badges, metadata, timestamps, action buttons. Positioned at the end, flex-shrink: 0.', slotElements: [{__element: 'XDSBadge', props: {label: 3}}, {__element: 'XDSText', props: {color: 'secondary'}, children: '2h ago'}]},
+ {name: 'endContent', type: 'ReactNode', description: 'Content rendered after the label/description area, such as badges, metadata, timestamps, or action buttons.', slotElements: [{__element: 'XDSBadge', props: {label: 3}}, {__element: 'XDSText', props: {color: 'secondary'}, children: '2h ago'}]},
{name: 'as', type: "'div' | 'li' | 'span'", description: 'HTML element to render as the root.', default: "'div'"},
- {name: 'startAdornment', type: 'ReactNode', description: 'Content rendered before the media slot as a direct flex child, without a wrapper element.'},
- {name: 'align', type: "'center' | 'start'", description: 'Vertical alignment of media and trailing slots.', default: "'center'"},
- {name: 'density', type: "'default' | 'compact'", description: 'Spacing density. "default" uses 8px block padding, "compact" uses 4px.', default: "'default'"},
+ {name: 'align', type: "'center' | 'start'", description: 'Vertical alignment of start/end content slots.', default: "'center'"},
+ {name: 'density', type: "'compact' | 'balanced' | 'spacious'", description: 'Spacing density. "compact" uses 4px block padding, "balanced" uses 8px, and "spacious" uses 12px block and inline padding.', default: "'balanced'"},
{name: 'labelLines', type: 'number', description: 'Max lines before label truncates with ellipsis.'},
{name: 'descriptionLines', type: 'number', description: 'Max lines before description truncates with ellipsis.'},
{name: 'onClick', type: '(event: MouseEvent) => void', description: 'Click handler. Makes the item clickable with button semantics.'},
@@ -51,21 +51,22 @@ export const docs = {
],
usage: {
description:
- 'A single, flexible item primitive that unifies the "media + label + description + trailing content" pattern across XDS. Use it wherever you need a structured row: dropdown menus, selectors, contact lists, notifications, file browsers, and activity feeds.',
+ 'A single, flexible item primitive that unifies the "start content + label + description + end content" pattern across XDS. Use it wherever you need a structured row: dropdown menus, selectors, contact lists, notifications, file browsers, and activity feeds.',
bestPractices: [
- {guidance: true, description: 'Use named slots (media, label, description, trailing) for the common layout. These cover the 80% case.'},
- {guidance: true, description: 'Use density="compact" for menus and dense lists, "default" for standalone items and spacious layouts.'},
+ {guidance: true, description: 'Use named slots (startContent, label, description, endContent) for the common layout. These cover the 80% case.'},
+ {guidance: true, description: 'Use density="compact" for menus and dense lists, "balanced" for standard rows, and "spacious" for roomier layouts.'},
{guidance: true, description: 'Set labelLines and descriptionLines to control truncation when content length varies.'},
- {guidance: true, description: 'Use align="start" when media or trailing content is taller than a single line of text.'},
+ {guidance: true, description: 'Use align="start" when start or end content is taller than a single line of text.'},
{guidance: false, description: "Don't nest interactive elements (buttons, links) inside an interactive XDSItem; it creates confusing focus and click targets."},
{guidance: false, description: "Don't use XDSItem for navigation between views; use proper navigation components instead."},
{guidance: false, description: "Don't add read/unread or inbox-specific behavior directly; compose a thin wrapper like XDSPreviewItem instead."},
],
anatomy: [
- {name: 'Media', required: false, description: 'Leading visual: avatar, icon, image, or status indicator.'},
+ {name: 'Marker', required: false, description: 'Optional list bullet/counter rendered before start content.'},
+ {name: 'Start content', required: false, description: 'Leading visual: avatar, icon, image, or checkbox.'},
{name: 'Label', required: true, description: 'Primary text identifying the item.'},
{name: 'Description', required: false, description: 'Secondary supporting text below the label.'},
- {name: 'Trailing', required: false, description: 'End-aligned content: badges, timestamps, or action buttons.'},
+ {name: 'End content', required: false, description: 'End-aligned content: badges, timestamps, or action buttons.'},
],
},
};
@@ -76,16 +77,16 @@ export const docsZh = {
{
name: 'XDSItem',
displayName: 'Item',
- description: '通用项目原语,统一 "媒体 + 标签 + 描述 + 尾部内容" 布局模式。用作列表项、菜单项、联系人行、通知等的构建块。',
+ description: '通用项目原语,统一 "起始内容 + 标签 + 描述 + 结束内容" 布局模式。用作列表项、菜单项、联系人行、通知等的构建块。',
propDescriptions: {
label: '标识此项目的主要文本。接受字符串(自动截断)或 ReactNode(用于富内容)。',
- media: '前导视觉:头像、图标、图片或任何 ReactNode。',
+ marker: '在 startContent 之前渲染的标记,作为直接 flex 子元素。用于需要自定义基线对齐的列表项目符号/计数器。',
+ startContent: '在标签/描述区域之前渲染的内容,例如图标、头像或复选框。',
description: '次要文本:副标题、描述或辅助信息。',
- trailing: '尾部内容:徽章、元数据、时间戳、操作按钮。定位在末端。',
+ endContent: '在标签/描述区域之后渲染的内容,例如徽章、元数据、时间戳或操作按钮。',
as: '根元素的 HTML 元素。',
- startAdornment: '在媒体插槽之前渲染的内容,作为直接 flex 子元素,无包装元素。',
- align: '媒体和尾部插槽的垂直对齐方式。',
- density: '间距密度。"default" 使用 8px 块内距,"compact" 使用 4px。',
+ align: '起始/结束内容插槽的垂直对齐方式。',
+ density: '间距密度。"compact" 使用 4px 块内距,"balanced" 使用 8px,"spacious" 使用 12px 块内距和内联内距。',
labelLines: '标签截断前的最大行数。',
descriptionLines: '描述截断前的最大行数。',
onClick: '点击处理函数。使项目可点击,具有按钮语义。',
@@ -103,36 +104,37 @@ export const docsZh = {
],
usage: {
description:
- '通用项目原语,统一 XDS 中 "媒体 + 标签 + 描述 + 尾部内容" 的布局模式。适用于下拉菜单、选择器、联系人列表、通知、文件浏览器和活动流等场景。',
+ '通用项目原语,统一 XDS 中 "起始内容 + 标签 + 描述 + 结束内容" 的布局模式。适用于下拉菜单、选择器、联系人列表、通知、文件浏览器和活动流等场景。',
bestPractices: [
- {guidance: true, description: '使用命名插槽(media、label、description、trailing)处理常见布局。'},
- {guidance: true, description: '菜单和密集列表使用 density="compact",独立项目使用 "default"。'},
+ {guidance: true, description: '使用命名插槽(startContent、label、description、endContent)处理常见布局。'},
+ {guidance: true, description: '菜单和密集列表使用 density="compact",标准行使用 "balanced",宽松布局使用 "spacious"。'},
{guidance: true, description: '设置 labelLines 和 descriptionLines 控制内容长度不定时的截断。'},
- {guidance: true, description: '当媒体或尾部内容高于单行文本时使用 align="start"。'},
+ {guidance: true, description: '当起始或结束内容高于单行文本时使用 align="start"。'},
{guidance: false, description: '不要在交互式 XDSItem 内嵌套交互元素(按钮、链接)。'},
{guidance: false, description: '不要使用 XDSItem 进行视图间导航:使用适当的导航组件。'},
{guidance: false, description: '不要直接添加已读/未读行为:组合一个薄包装器如 XDSPreviewItem。'},
],
anatomy: [
- {name: '媒体', required: false, description: '前导视觉:头像、图标、图片或状态指示器。'},
+ {name: '标记', required: false, description: '在起始内容之前渲染的可选列表项目符号/计数器。'},
+ {name: '起始内容', required: false, description: '前导视觉:头像、图标、图片或复选框。'},
{name: '标签', required: true, description: '标识项目的主要文本。'},
{name: '描述', required: false, description: '标签下方的次要辅助文本。'},
- {name: '尾部', required: false, description: '末端对齐内容:徽章、时间戳或操作按钮。'},
+ {name: '结束内容', required: false, description: '末端对齐内容:徽章、时间戳或操作按钮。'},
],
},
};
/** @type {import('../docs-types').TranslationDoc} */
export const docsDense = {
- description: 'universal item primitive w/ media+label+description+trailing layout. building block for list items, menu items, contacts, notifications',
+ description: 'universal item primitive w/ startContent+label+description+endContent layout. building block for list items, menu items, contacts, notifications',
usage: {
description:
- 'Flexible item primitive unifying the "media + label + description + trailing" pattern. Use for structured rows in menus, lists, contacts, notifications, file browsers.',
+ 'Flexible item primitive unifying the "start content + label + description + end content" pattern. Use for structured rows in menus, lists, contacts, notifications, file browsers.',
bestPractices: [
- {guidance: true, description: 'Named slots (media, label, description, trailing) for the 80% case.'},
- {guidance: true, description: 'density="compact" for menus/dense lists, "default" for spacious layouts.'},
+ {guidance: true, description: 'Named slots (startContent, label, description, endContent) for the 80% case.'},
+ {guidance: true, description: 'density="compact" for menus/dense lists, "balanced" for standard rows, "spacious" for roomier layouts.'},
{guidance: true, description: 'labelLines/descriptionLines for truncation control.'},
- {guidance: true, description: 'align="start" when media/trailing is taller than one text line.'},
+ {guidance: true, description: 'align="start" when start/end content is taller than one text line.'},
{guidance: false, description: "Don't nest interactive elements inside interactive XDSItem."},
{guidance: false, description: "Don't use for view navigation; use nav components."},
{guidance: false, description: "Don't add inbox-specific behavior; compose a wrapper."},
@@ -142,16 +144,16 @@ export const docsDense = {
{
name: 'XDSItem',
displayName: 'Item',
- description: 'universal item primitive w/ media+label+description+trailing layout',
+ description: 'universal item primitive w/ startContent+label+description+endContent layout',
propDescriptions: {
label: 'Primary text. String auto-truncates; ReactNode for rich content.',
- media: 'Leading visual: avatar, icon, image, ReactNode.',
+ marker: 'List bullet/counter before startContent as direct flex child.',
+ startContent: 'Content before label/description: avatar, icon, checkbox, ReactNode.',
description: 'Secondary text below label.',
- trailing: 'End-aligned content: badges, timestamps, actions.',
+ endContent: 'Content after label/description: badges, timestamps, actions.',
as: 'Root HTML element.',
- startAdornment: 'Content before media slot as direct flex child, no wrapper.',
- align: 'Vertical alignment of media/trailing slots.',
- density: 'Spacing: "default" (8px) or "compact" (4px).',
+ align: 'Vertical alignment of start/end content slots.',
+ density: 'Spacing: "compact" (4px), "balanced" (8px), or "spacious" (12px).',
labelLines: 'Max label lines before truncation.',
descriptionLines: 'Max description lines before truncation.',
onClick: 'Click handler; enables button semantics.',
diff --git a/packages/core/src/Item/XDSItem.test.tsx b/packages/core/src/Item/XDSItem.test.tsx
index e617d6f29f..8506467bc9 100644
--- a/packages/core/src/Item/XDSItem.test.tsx
+++ b/packages/core/src/Item/XDSItem.test.tsx
@@ -30,16 +30,26 @@ describe('XDSItem', () => {
expect(screen.getByText('Manage your preferences')).toBeInTheDocument();
});
- it('renders media content', () => {
+ it('renders marker', () => {
render(
- <XDSItem label="Item" media={<span data-testid="avatar">A</span>} />,
+ <XDSItem label="Item" marker={<span data-testid="marker">•</span>} />,
+ );
+ expect(screen.getByTestId('marker')).toBeInTheDocument();
+ });
+
+ it('renders startContent', () => {
+ render(
+ <XDSItem
+ label="Item"
+ startContent={<span data-testid="avatar">A</span>}
+ />,
);
expect(screen.getByTestId('avatar')).toBeInTheDocument();
});
- it('renders trailing content', () => {
+ it('renders endContent', () => {
render(
- <XDSItem label="Item" trailing={<span data-testid="badge">3</span>} />,
+ <XDSItem label="Item" endContent={<span data-testid="badge">3</span>} />,
);
expect(screen.getByTestId('badge')).toBeInTheDocument();
});
@@ -47,16 +57,18 @@ describe('XDSItem', () => {
it('renders all slots together', () => {
render(
<XDSItem
- media={<span data-testid="media">M</span>}
+ marker={<span data-testid="marker">•</span>}
+ startContent={<span data-testid="start">S</span>}
label="Label"
description="Description"
- trailing={<span data-testid="trailing">T</span>}
+ endContent={<span data-testid="end">E</span>}
/>,
);
- expect(screen.getByTestId('media')).toBeInTheDocument();
+ expect(screen.getByTestId('marker')).toBeInTheDocument();
+ expect(screen.getByTestId('start')).toBeInTheDocument();
expect(screen.getByText('Label')).toBeInTheDocument();
expect(screen.getByText('Description')).toBeInTheDocument();
- expect(screen.getByTestId('trailing')).toBeInTheDocument();
+ expect(screen.getByTestId('end')).toBeInTheDocument();
});
it('supports data-testid', () => {
@@ -114,14 +126,14 @@ describe('XDSItem', () => {
label="Clickable"
onClick={onClick}
data-testid="item"
- media={<span data-testid="media">M</span>}
+ startContent={<span data-testid="start">S</span>}
/>,
);
- await user.click(screen.getByTestId('media'));
+ await user.click(screen.getByTestId('start'));
expect(onClick).toHaveBeenCalledTimes(1);
});
- it('does not fire item onClick when trailing interactive element is clicked', async () => {
+ it('does not fire item onClick when endContent interactive element is clicked', async () => {
const user = userEvent.setup();
const itemClick = vi.fn();
const buttonClick = vi.fn();
@@ -129,7 +141,7 @@ describe('XDSItem', () => {
<XDSItem
label="Item"
onClick={itemClick}
- trailing={
+ endContent={
<button type="button" onClick={buttonClick}>
Action
</button>
@@ -141,6 +153,26 @@ describe('XDSItem', () => {
expect(itemClick).not.toHaveBeenCalled();
});
+ it('does not fire item onClick when startContent interactive element is clicked', async () => {
+ const user = userEvent.setup();
+ const itemClick = vi.fn();
+ const buttonClick = vi.fn();
+ render(
+ <XDSItem
+ label="Item"
+ onClick={itemClick}
+ startContent={
+ <button type="button" onClick={buttonClick}>
+ Open
+ </button>
+ }
+ />,
+ );
+ await user.click(screen.getByText('Open'));
+ expect(buttonClick).toHaveBeenCalledTimes(1);
+ expect(itemClick).not.toHaveBeenCalled();
+ });
+
it('invisible button is focusable via keyboard', async () => {
const user = userEvent.setup();
render(<XDSItem label="Focusable" onClick={() => {}} />);
@@ -264,27 +296,32 @@ describe('XDSItem', () => {
});
// ===========================================================================
- // Media and trailing slot positions
+ // Marker, start, and end slot positions
// ===========================================================================
- it('media and trailing are siblings to invisible button', () => {
+ it('marker, startContent, and endContent are siblings to invisible button', () => {
const {container} = render(
<XDSItem
label="Item"
onClick={() => {}}
- media={<span data-testid="media">M</span>}
- trailing={<span data-testid="trailing">T</span>}
+ marker={<span data-testid="marker">•</span>}
+ startContent={<span data-testid="start">S</span>}
+ endContent={<span data-testid="end">E</span>}
/>,
);
const button = container.querySelector('button');
const root = container.firstElementChild;
- expect(root?.querySelector('[data-testid="media"]')).toBeInTheDocument();
- expect(root?.querySelector('[data-testid="trailing"]')).toBeInTheDocument();
+ expect(root?.querySelector('[data-testid="marker"]')).toBeInTheDocument();
+ expect(root?.querySelector('[data-testid="start"]')).toBeInTheDocument();
+ expect(root?.querySelector('[data-testid="end"]')).toBeInTheDocument();
+ expect(
+ button?.querySelector('[data-testid="marker"]'),
+ ).not.toBeInTheDocument();
expect(
- button?.querySelector('[data-testid="media"]'),
+ button?.querySelector('[data-testid="start"]'),
).not.toBeInTheDocument();
expect(
- button?.querySelector('[data-testid="trailing"]'),
+ button?.querySelector('[data-testid="end"]'),
).not.toBeInTheDocument();
});
@@ -292,9 +329,10 @@ describe('XDSItem', () => {
// Density variants
// ===========================================================================
- it('renders with default density', () => {
+ it('renders with balanced density by default', () => {
render(<XDSItem label="Item" data-testid="item" />);
expect(screen.getByTestId('item')).toBeInTheDocument();
+ expect(screen.getByTestId('item').className).toContain('balanced');
});
it('renders with compact density', () => {
@@ -302,6 +340,12 @@ describe('XDSItem', () => {
expect(screen.getByTestId('item')).toBeInTheDocument();
});
+ it('renders with spacious density', () => {
+ render(<XDSItem label="Item" density="spacious" data-testid="item" />);
+ expect(screen.getByTestId('item')).toBeInTheDocument();
+ expect(screen.getByTestId('item').className).toContain('spacious');
+ });
+
// ===========================================================================
// Alignment
// ===========================================================================
diff --git a/packages/core/src/Item/XDSItem.tsx b/packages/core/src/Item/XDSItem.tsx
index ce3a8b7513..16a629d8f1 100644
--- a/packages/core/src/Item/XDSItem.tsx
+++ b/packages/core/src/Item/XDSItem.tsx
@@ -36,7 +36,7 @@ import {useXDSLinkComponent} from '../Link/useXDSLinkComponent';
// =============================================================================
export type XDSItemAlign = 'center' | 'start';
-export type XDSItemDensity = 'default' | 'compact';
+export type XDSItemDensity = 'compact' | 'balanced' | 'spacious';
export interface XDSItemProps extends XDSBaseProps<HTMLElement> {
/** Ref forwarded to the root element. */
@@ -49,16 +49,16 @@ export interface XDSItemProps extends XDSBaseProps<HTMLElement> {
as?: 'div' | 'li' | 'span';
/**
- * Content rendered as a direct flex child before the media slot,
- * without a wrapper element. Use for list markers or other content
- * that needs its own flex alignment (e.g. alignSelf: 'baseline').
+ * Marker rendered before startContent as a direct flex child.
+ * Use for list bullets/counters that need custom baseline alignment.
*/
- startAdornment?: ReactNode;
+ marker?: ReactNode;
/**
- * Leading visual — avatar, icon, image, or any ReactNode.
+ * Content rendered before the label/description area.
+ * Use for leading icons, avatars, or checkboxes.
*/
- media?: ReactNode;
+ startContent?: ReactNode;
/**
* Primary text identifying this item. Required.
@@ -72,20 +72,21 @@ export interface XDSItemProps extends XDSBaseProps<HTMLElement> {
description?: ReactNode;
/**
- * Trailing content — badges, metadata, timestamps, action buttons.
- * Positioned at the end, flex-shrink: 0.
+ * Content rendered after the label/description area.
+ * Use for badges, metadata, timestamps, or action buttons.
*/
- trailing?: ReactNode;
+ endContent?: ReactNode;
/**
- * Vertical alignment of the media and trailing slots.
+ * Vertical alignment of the start/end content slots.
* @default 'center'
*/
align?: XDSItemAlign;
/**
- * Density: "default" (8px padding) or "compact" (4px block padding).
- * @default 'default'
+ * Density: "compact" (4px block padding), "balanced" (8px block padding),
+ * or "spacious" (12px block and inline padding).
+ * @default 'balanced'
*/
density?: XDSItemDensity;
@@ -262,11 +263,11 @@ const styles = stylex.create({
display: '-webkit-box',
WebkitBoxOrient: 'vertical' as const,
},
- media: {
+ startContent: {
flex: '0 0 auto',
display: 'flex',
},
- trailing: {
+ endContent: {
flex: '0 0 auto',
display: 'flex',
marginInlineStart: 'auto',
@@ -280,12 +281,16 @@ const dynamicStyles = stylex.create({
});
const densityStyles = stylex.create({
- default: {
- paddingBlock: spacingVars['--spacing-2'],
- },
compact: {
paddingBlock: spacingVars['--spacing-1'],
},
+ balanced: {
+ paddingBlock: spacingVars['--spacing-2'],
+ },
+ spacious: {
+ paddingBlock: spacingVars['--spacing-3'],
+ paddingInline: spacingVars['--spacing-3'],
+ },
});
// =============================================================================
@@ -293,30 +298,30 @@ const densityStyles = stylex.create({
// =============================================================================
/**
- * A universal item primitive that unifies the "media + label + description +
- * trailing content" layout pattern. Use as a building block for list items,
+ * A universal item primitive that unifies the "start content + label +
+ * description + end content" layout pattern. Use as a building block for list items,
* menu items, contact rows, notification items, and more.
*
* @example
* ```
* <XDSItem
- * media={<XDSAvatar src={user.avatar} size="sm" />}
+ * startContent={<XDSAvatar src={user.avatar} size="sm" />}
* label={user.name}
* description={user.role}
- * trailing={<XDSBadge>Admin</XDSBadge>}
+ * endContent={<XDSBadge>Admin</XDSBadge>}
* onClick={() => navigate(`/users/${user.id}`)}
* />
* ```
*/
export function XDSItem({
as: Component = 'div',
- startAdornment,
- media,
+ marker,
+ startContent,
label,
description,
- trailing,
+ endContent,
align = 'center',
- density = 'default',
+ density = 'balanced',
labelLines,
descriptionLines,
onClick,
@@ -402,8 +407,10 @@ export function XDSItem({
const innerContent = (
<>
- {startAdornment}
- {media != null && <span {...stylex.props(styles.media)}>{media}</span>}
+ {marker}
+ {startContent != null && (
+ <span {...stylex.props(styles.startContent)}>{startContent}</span>
+ )}
{hasParentRole ? (
<span
@@ -447,13 +454,13 @@ export function XDSItem({
</span>
)}
- {trailing != null && (
+ {endContent != null && (
<span
{...stylex.props(
- styles.trailing,
+ styles.endContent,
isDisabled && styles.disabledContent,
)}>
- {trailing}
+ {endContent}
</span>
)}
</>
diff --git a/packages/core/src/List/XDSList.test.tsx b/packages/core/src/List/XDSList.test.tsx
index 42a12f7176..9fee104001 100644
--- a/packages/core/src/List/XDSList.test.tsx
+++ b/packages/core/src/List/XDSList.test.tsx
@@ -239,7 +239,9 @@ describe('XDSList', () => {
<XDSListItem label="Item" />
</XDSList>,
);
- expect(container.querySelector('li')).toBeInTheDocument();
+ const item = container.querySelector('li');
+ expect(item).toBeInTheDocument();
+ expect(item?.className).toContain('compact');
});
it('renders with balanced density (default)', () => {
@@ -248,7 +250,10 @@ describe('XDSList', () => {
<XDSListItem label="Item" />
</XDSList>,
);
- expect(container.querySelector('li')).toBeInTheDocument();
+ const item = container.querySelector('li');
+ expect(item).toBeInTheDocument();
+ expect(item?.className).toContain('balanced');
+ expect(item?.className).not.toContain('spacious');
});
it('renders with spacious density', () => {
@@ -257,7 +262,9 @@ describe('XDSList', () => {
<XDSListItem label="Item" />
</XDSList>,
);
- expect(container.querySelector('li')).toBeInTheDocument();
+ const item = container.querySelector('li');
+ expect(item).toBeInTheDocument();
+ expect(item?.className).toContain('spacious');
});
// ===========================================================================
diff --git a/packages/core/src/List/XDSListItem.tsx b/packages/core/src/List/XDSListItem.tsx
index 66b3b6e288..f82188c42d 100644
--- a/packages/core/src/List/XDSListItem.tsx
+++ b/packages/core/src/List/XDSListItem.tsx
@@ -8,7 +8,7 @@
* @output Exports XDSListItem component, XDSListItemProps type
* @position Core implementation; consumed by XDSList, index.ts, tested by XDSList.test.tsx
*
- * Composes XDSItem for the shared media + label + description + trailing layout
+ * Composes XDSItem for the shared start content + label + description + end content layout
* and the invisible button/anchor interactive pattern.
*
* SYNC: When modified, update these files to stay in sync:
@@ -228,24 +228,22 @@ export function XDSListItem({
<span {...stylex.props(markerStyles.number)} />
) : null;
- const itemDensity = density === 'compact' ? 'compact' : 'default';
-
return (
<XDSItem
as="li"
ref={ref}
- startAdornment={marker}
- media={startContent}
+ marker={marker}
+ startContent={startContent}
label={label}
description={description}
- trailing={endContent}
+ endContent={endContent}
onClick={onClick}
href={href}
target={target as '_blank' | '_self'}
rel={rel}
isDisabled={isDisabled}
isSelected={isSelected}
- density={itemDensity}
+ density={density}
xstyle={[
hasMarkers && styles.withCounter,
hasDividers && styles.withDivider,
diff --git a/packages/core/src/RadioList/XDSRadioListItem.tsx b/packages/core/src/RadioList/XDSRadioListItem.tsx
index cc28afca48..05eee26852 100644
--- a/packages/core/src/RadioList/XDSRadioListItem.tsx
+++ b/packages/core/src/RadioList/XDSRadioListItem.tsx
@@ -8,7 +8,7 @@
* @output Exports XDSRadioListItem component, XDSRadioListItemProps
* @position Core implementation; consumed by index.ts, tested by XDSRadioList.test.tsx
*
- * Composes XDSItem for the shared media + label + description + trailing layout.
+ * Composes XDSItem for the shared start content + label + description + end content layout.
*
* SYNC: When modified, update these files to stay in sync:
* - /packages/core/src/RadioList/RadioList.doc.mjs
@@ -302,7 +302,7 @@ export function XDSRadioListItem({
stylex.props(styles.container, !isDisabled && radioScope),
)}>
<XDSItem
- media={mediaContent}
+ startContent={mediaContent}
label={
<label
htmlFor={id}
@@ -315,7 +315,7 @@ export function XDSRadioListItem({
<span id={descriptionID}>{description}</span>
) : undefined
}
- trailing={endContent}
+ endContent={endContent}
xstyle={embeddedStyles.root}
/>
</div>
diff --git a/packages/core/src/Selector/XDSSelectorOption.tsx b/packages/core/src/Selector/XDSSelectorOption.tsx
index 4f33ffed97..2610caa6af 100644
--- a/packages/core/src/Selector/XDSSelectorOption.tsx
+++ b/packages/core/src/Selector/XDSSelectorOption.tsx
@@ -5,7 +5,7 @@
* @output Exports XDSSelectorOption component for custom option rendering
* @position Sub-component; used by XDSSelector and consumers for custom options
*
- * Composes XDSItem for the shared media + label + description + trailing layout.
+ * Composes XDSItem for the shared start content + label + description + end content layout.
*/
import type {ReactNode} from 'react';
@@ -101,14 +101,14 @@ export function XDSSelectorOption({
}: XDSSelectorOptionProps) {
return (
<XDSItem
- media={
+ startContent={
icon
? renderIconSlot(icon, {size: 'sm', color: 'secondary'})
: undefined
}
label={label}
description={description}
- trailing={children}
+ endContent={children}
xstyle={[embeddedStyles.root, xstyle]}
className={[xdsClassName('selector-option'), className]
.filter(Boolean)