@cdx-ui/components 0.2.3 → 0.2.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.md +24 -0
- package/README.md +2 -0
- package/coverage.svg +1 -1
- package/docs/components/accordion/content.md +538 -0
- package/docs/components/alert/content.md +203 -0
- package/docs/components/alert-dialog/content.md +319 -0
- package/docs/components/avatar/content.md +368 -0
- package/docs/components/avatar/design.md +202 -0
- package/docs/components/badge/content.md +225 -0
- package/docs/components/bottom-sheet/content.md +353 -0
- package/docs/components/bottom-sheet/design.md +249 -0
- package/docs/components/box/content.md +141 -0
- package/docs/components/breadcrumbs/content.md +169 -0
- package/docs/components/button/content.md +398 -0
- package/docs/components/button/design.md +258 -0
- package/docs/components/calendar/content.md +137 -0
- package/docs/components/card/content.md +283 -0
- package/docs/components/carousel/content.md +417 -0
- package/docs/components/checkbox/content.md +236 -0
- package/docs/components/checkbox/design.md +214 -0
- package/docs/components/chip/content.md +439 -0
- package/docs/components/chip/design.md +418 -0
- package/docs/components/color-area/content.md +84 -0
- package/docs/components/color-field/content.md +132 -0
- package/docs/components/color-picker/content.md +209 -0
- package/docs/components/color-slider/content.md +118 -0
- package/docs/components/color-swatch/content.md +62 -0
- package/docs/components/color-swatch-picker/content.md +124 -0
- package/docs/components/content.md +98 -0
- package/docs/components/currency-input/content.md +205 -0
- package/docs/components/data-grid/content.md +521 -0
- package/docs/components/date-field/content.md +147 -0
- package/docs/components/date-picker/content.md +360 -0
- package/docs/components/date-range-picker/content.md +301 -0
- package/docs/components/date-time-field/content.md +157 -0
- package/docs/components/date-time-list/content.md +105 -0
- package/docs/components/date-time-picker/content.md +272 -0
- package/docs/components/dialog/content.md +436 -0
- package/docs/components/dialog/design.md +192 -0
- package/docs/components/divider/content.md +112 -0
- package/docs/components/drawer/content.md +428 -0
- package/docs/components/field/content.md +277 -0
- package/docs/components/form/content.md +62 -0
- package/docs/components/full-screen-dialog/content.md +881 -0
- package/docs/components/heading/content.md +55 -0
- package/docs/components/icon/content.md +190 -0
- package/docs/components/icon-button/content.md +200 -0
- package/docs/components/icon-button/design.md +165 -0
- package/docs/components/image/content.md +104 -0
- package/docs/components/input/content.md +346 -0
- package/docs/components/input/design.md +389 -0
- package/docs/components/insurance-disclosure/content.md +103 -0
- package/docs/components/link/content.md +180 -0
- package/docs/components/link/design.md +160 -0
- package/docs/components/list-item/content.md +695 -0
- package/docs/components/menu/content.md +1254 -0
- package/docs/components/month-calendar/content.md +84 -0
- package/docs/components/month-picker/content.md +273 -0
- package/docs/components/otp-input/content.md +327 -0
- package/docs/components/progress-bar/content.md +87 -0
- package/docs/components/progress-circle/content.md +176 -0
- package/docs/components/progress-segmented/content.md +119 -0
- package/docs/components/quick-action-button/content.md +154 -0
- package/docs/components/quick-action-button/design.md +170 -0
- package/docs/components/radio/content.md +224 -0
- package/docs/components/range-calendar/content.md +123 -0
- package/docs/components/reorderable-list/content.md +311 -0
- package/docs/components/scoped-theme/content.md +47 -0
- package/docs/components/scroll-shadow/content.md +693 -0
- package/docs/components/select/content.md +473 -0
- package/docs/components/select/design.md +301 -0
- package/docs/components/skeleton/content.md +104 -0
- package/docs/components/slider/content.md +423 -0
- package/docs/components/stack/content.md +161 -0
- package/docs/components/switch/content.md +150 -0
- package/docs/components/switch/design.md +208 -0
- package/docs/components/table/content.md +548 -0
- package/docs/components/table-pagination/content.md +177 -0
- package/docs/components/tabs/content.md +297 -0
- package/docs/components/text/content.md +142 -0
- package/docs/components/textarea/content.md +222 -0
- package/docs/components/tile/content.md +702 -0
- package/docs/components/toast/content.md +456 -0
- package/docs/components/toggle-button/content.md +505 -0
- package/docs/components/tooltip/content.md +350 -0
- package/docs/components/virtualized-list/content.md +250 -0
- package/docs/foundations/content.md +9 -0
- package/docs/foundations/expressions/icons/content.md +19 -0
- package/docs/foundations/styles/tokens/all-tokens/content.md +192 -0
- package/docs/foundations/styles/tokens/what-are-tokens/content.md +33 -0
- package/docs/foundations/styles/tokens/what-are-tokens/design.md +33 -0
- package/docs/getting-started/content.md +4 -0
- package/docs/getting-started/designers/content.md +13 -0
- package/docs/getting-started/designers/design.md +13 -0
- package/docs/getting-started/developers/accessibility/content.md +31 -0
- package/docs/getting-started/developers/content.md +612 -0
- package/docs/getting-started/developers/styling/content.md +195 -0
- package/docs/llms.txt +195 -0
- package/docs/patterns/account-management/content.md +75 -0
- package/docs/patterns/authentication/content.md +50 -0
- package/docs/patterns/content.md +10 -0
- package/docs/patterns/dashboard/content.md +34 -0
- package/docs/patterns/empty-states/content.md +32 -0
- package/docs/patterns/forms/content.md +108 -0
- package/docs/patterns/onboarding/content.md +69 -0
- package/docs/patterns/payments/content.md +35 -0
- package/docs/patterns/settings/content.md +72 -0
- package/docs/resources/content.md +9 -0
- package/docs/resources/figma-libraries/content.md +42 -0
- package/docs/resources/release-notes/0.0.1-beta.118/content.md +27 -0
- package/docs/resources/release-notes/0.0.1-beta.122/content.md +21 -0
- package/docs/resources/release-notes/0.0.1-beta.124/content.md +16 -0
- package/docs/resources/release-notes/0.0.1-beta.126/content.md +10 -0
- package/docs/resources/release-notes/0.0.1-beta.127/content.md +14 -0
- package/docs/resources/release-notes/0.0.1-beta.128/content.md +9 -0
- package/docs/resources/release-notes/0.0.1-beta.129/content.md +18 -0
- package/docs/resources/release-notes/0.0.1-beta.130/content.md +18 -0
- package/docs/resources/release-notes/0.0.1-beta.133/content.md +7 -0
- package/docs/resources/release-notes/0.0.1-beta.134/content.md +17 -0
- package/docs/resources/release-notes/0.0.1-beta.136/content.md +7 -0
- package/docs/resources/release-notes/0.0.1-beta.137/content.md +10 -0
- package/docs/resources/release-notes/0.0.1-beta.138/content.md +7 -0
- package/docs/resources/release-notes/0.0.1-beta.139/content.md +13 -0
- package/docs/resources/release-notes/0.0.1-beta.140/content.md +26 -0
- package/docs/resources/release-notes/0.0.1-beta.141/content.md +63 -0
- package/docs/resources/release-notes/0.0.1-beta.142/content.md +7 -0
- package/docs/resources/release-notes/0.0.1-beta.143/content.md +12 -0
- package/docs/resources/release-notes/0.0.1-beta.144/content.md +7 -0
- package/docs/resources/release-notes/0.0.1-beta.145/content.md +7 -0
- package/docs/resources/release-notes/0.0.1-beta.147/content.md +10 -0
- package/docs/resources/release-notes/0.0.1-beta.149/content.md +10 -0
- package/docs/resources/release-notes/0.0.1-beta.150/content.md +13 -0
- package/docs/resources/release-notes/0.0.1-beta.152/content.md +7 -0
- package/docs/resources/release-notes/0.0.1-beta.154/content.md +15 -0
- package/docs/resources/release-notes/0.0.1-beta.156/content.md +7 -0
- package/docs/resources/release-notes/0.0.1-beta.158/content.md +9 -0
- package/docs/resources/release-notes/0.0.1-beta.159/content.md +11 -0
- package/docs/resources/release-notes/0.0.1-beta.160/content.md +7 -0
- package/docs/resources/release-notes/0.0.1-beta.161/content.md +7 -0
- package/docs/resources/release-notes/0.0.1-beta.163/content.md +7 -0
- package/docs/resources/release-notes/0.0.1-beta.164/content.md +9 -0
- package/docs/resources/release-notes/0.0.1-beta.166/content.md +17 -0
- package/docs/resources/release-notes/0.0.1-beta.167/content.md +7 -0
- package/docs/resources/release-notes/0.0.1-beta.168/content.md +7 -0
- package/docs/resources/release-notes/0.0.1-beta.169/content.md +7 -0
- package/docs/resources/release-notes/0.0.1-beta.171/content.md +16 -0
- package/docs/resources/release-notes/0.0.1-beta.172/content.md +24 -0
- package/docs/resources/release-notes/0.0.1-beta.173/content.md +15 -0
- package/docs/resources/release-notes/0.0.1-beta.174/content.md +7 -0
- package/docs/resources/release-notes/0.0.1-beta.176/content.md +32 -0
- package/docs/resources/release-notes/0.0.1-beta.179/content.md +11 -0
- package/docs/resources/release-notes/0.0.1-beta.182/content.md +13 -0
- package/docs/resources/release-notes/0.0.1-beta.185/content.md +7 -0
- package/docs/resources/release-notes/0.0.1-beta.187/content.md +27 -0
- package/docs/resources/release-notes/0.1.1/content.md +23 -0
- package/docs/resources/release-notes/0.1.2/content.md +7 -0
- package/docs/resources/release-notes/0.1.4/content.md +19 -0
- package/docs/resources/release-notes/0.1.5/content.md +7 -0
- package/docs/resources/release-notes/0.1.6/content.md +7 -0
- package/docs/resources/release-notes/0.2.0/content.md +31 -0
- package/docs/resources/release-notes/0.2.1/content.md +17 -0
- package/docs/resources/release-notes/0.2.2/content.md +11 -0
- package/docs/resources/release-notes/0.2.3/content.md +15 -0
- package/docs/resources/release-notes/0.2.4/content.md +17 -0
- package/docs/resources/release-notes/content.md +65 -0
- package/lib/commonjs/components/Box/Box.js +9 -1
- package/lib/commonjs/components/Box/Box.js.map +1 -1
- package/lib/commonjs/components/Breadcrumbs/index.js +28 -3
- package/lib/commonjs/components/Breadcrumbs/index.js.map +1 -1
- package/lib/commonjs/components/Breadcrumbs/styles.js +27 -0
- package/lib/commonjs/components/Breadcrumbs/styles.js.map +1 -1
- package/lib/commonjs/components/DateTimeList/index.js +11 -26
- package/lib/commonjs/components/DateTimeList/index.js.map +1 -1
- package/lib/commonjs/components/DateTimeList/styles.js +2 -12
- package/lib/commonjs/components/DateTimeList/styles.js.map +1 -1
- package/lib/commonjs/components/ListItem/index.js.map +1 -1
- package/lib/commonjs/components/ListItem/styles.js +2 -1
- package/lib/commonjs/components/ListItem/styles.js.map +1 -1
- package/lib/commonjs/components/Menu/index.js +11 -5
- package/lib/commonjs/components/Menu/index.js.map +1 -1
- package/lib/commonjs/components/ScrollShadow/gradient.js +29 -0
- package/lib/commonjs/components/ScrollShadow/gradient.js.map +1 -0
- package/lib/commonjs/components/ScrollShadow/index.js +171 -44
- package/lib/commonjs/components/ScrollShadow/index.js.map +1 -1
- package/lib/commonjs/components/ScrollShadow/styles.js +58 -14
- package/lib/commonjs/components/ScrollShadow/styles.js.map +1 -1
- package/lib/commonjs/components/ScrollShadow/useComposedScrollHandler.js +63 -0
- package/lib/commonjs/components/ScrollShadow/useComposedScrollHandler.js.map +1 -0
- package/lib/commonjs/components/ScrollShadow/useScrollShadow.js +48 -8
- package/lib/commonjs/components/ScrollShadow/useScrollShadow.js.map +1 -1
- package/lib/commonjs/components/Stack/HStack.js +6 -2
- package/lib/commonjs/components/Stack/HStack.js.map +1 -1
- package/lib/commonjs/components/Stack/VStack.js +6 -2
- package/lib/commonjs/components/Stack/VStack.js.map +1 -1
- package/lib/commonjs/components/Tabs/index.js +16 -23
- package/lib/commonjs/components/Tabs/index.js.map +1 -1
- package/lib/commonjs/components/Tabs/styles.js +1 -10
- package/lib/commonjs/components/Tabs/styles.js.map +1 -1
- package/lib/commonjs/figma/ListItem.SectionHeader.figma.js +20 -5
- package/lib/commonjs/figma/ListItem.SectionHeader.figma.js.map +1 -1
- package/lib/commonjs/index.js +10 -10
- package/lib/commonjs/index.js.map +1 -1
- package/lib/module/components/Box/Box.js +9 -1
- package/lib/module/components/Box/Box.js.map +1 -1
- package/lib/module/components/Breadcrumbs/index.js +29 -4
- package/lib/module/components/Breadcrumbs/index.js.map +1 -1
- package/lib/module/components/Breadcrumbs/styles.js +26 -0
- package/lib/module/components/Breadcrumbs/styles.js.map +1 -1
- package/lib/module/components/DateTimeList/index.js +12 -27
- package/lib/module/components/DateTimeList/index.js.map +1 -1
- package/lib/module/components/DateTimeList/styles.js +1 -11
- package/lib/module/components/DateTimeList/styles.js.map +1 -1
- package/lib/module/components/ListItem/index.js.map +1 -1
- package/lib/module/components/ListItem/styles.js +2 -1
- package/lib/module/components/ListItem/styles.js.map +1 -1
- package/lib/module/components/Menu/index.js +11 -5
- package/lib/module/components/Menu/index.js.map +1 -1
- package/lib/module/components/ScrollShadow/gradient.js +24 -0
- package/lib/module/components/ScrollShadow/gradient.js.map +1 -0
- package/lib/module/components/ScrollShadow/index.js +170 -48
- package/lib/module/components/ScrollShadow/index.js.map +1 -1
- package/lib/module/components/ScrollShadow/styles.js +57 -13
- package/lib/module/components/ScrollShadow/styles.js.map +1 -1
- package/lib/module/components/ScrollShadow/useComposedScrollHandler.js +57 -0
- package/lib/module/components/ScrollShadow/useComposedScrollHandler.js.map +1 -0
- package/lib/module/components/ScrollShadow/useScrollShadow.js +46 -8
- package/lib/module/components/ScrollShadow/useScrollShadow.js.map +1 -1
- package/lib/module/components/Stack/HStack.js +6 -2
- package/lib/module/components/Stack/HStack.js.map +1 -1
- package/lib/module/components/Stack/VStack.js +6 -2
- package/lib/module/components/Stack/VStack.js.map +1 -1
- package/lib/module/components/Tabs/index.js +17 -24
- package/lib/module/components/Tabs/index.js.map +1 -1
- package/lib/module/components/Tabs/styles.js +0 -9
- package/lib/module/components/Tabs/styles.js.map +1 -1
- package/lib/module/figma/ListItem.SectionHeader.figma.js +20 -5
- package/lib/module/figma/ListItem.SectionHeader.figma.js.map +1 -1
- package/lib/module/index.js +6 -1
- package/lib/module/index.js.map +1 -1
- package/lib/typescript/animation/hooks/usePopupDialogContentAnimation.d.ts +2 -2
- package/lib/typescript/animation/hooks/usePopupOverlayAnimation.d.ts +2 -2
- package/lib/typescript/components/Box/Box.d.ts +4 -0
- package/lib/typescript/components/Box/Box.d.ts.map +1 -1
- package/lib/typescript/components/Breadcrumbs/index.d.ts +3 -1
- package/lib/typescript/components/Breadcrumbs/index.d.ts.map +1 -1
- package/lib/typescript/components/Breadcrumbs/styles.d.ts +2 -0
- package/lib/typescript/components/Breadcrumbs/styles.d.ts.map +1 -1
- package/lib/typescript/components/DateTimeList/index.d.ts.map +1 -1
- package/lib/typescript/components/DateTimeList/styles.d.ts +1 -4
- package/lib/typescript/components/DateTimeList/styles.d.ts.map +1 -1
- package/lib/typescript/components/ListItem/index.d.ts +5 -4
- package/lib/typescript/components/ListItem/index.d.ts.map +1 -1
- package/lib/typescript/components/ListItem/styles.d.ts +1 -1
- package/lib/typescript/components/ListItem/styles.d.ts.map +1 -1
- package/lib/typescript/components/Menu/index.d.ts.map +1 -1
- package/lib/typescript/components/ScrollShadow/gradient.d.ts +7 -0
- package/lib/typescript/components/ScrollShadow/gradient.d.ts.map +1 -0
- package/lib/typescript/components/ScrollShadow/index.d.ts +57 -15
- package/lib/typescript/components/ScrollShadow/index.d.ts.map +1 -1
- package/lib/typescript/components/ScrollShadow/styles.d.ts +8 -2
- package/lib/typescript/components/ScrollShadow/styles.d.ts.map +1 -1
- package/lib/typescript/components/ScrollShadow/useComposedScrollHandler.d.ts +13 -0
- package/lib/typescript/components/ScrollShadow/useComposedScrollHandler.d.ts.map +1 -0
- package/lib/typescript/components/ScrollShadow/useScrollShadow.d.ts +15 -2
- package/lib/typescript/components/ScrollShadow/useScrollShadow.d.ts.map +1 -1
- package/lib/typescript/components/Stack/HStack.d.ts +3 -2
- package/lib/typescript/components/Stack/HStack.d.ts.map +1 -1
- package/lib/typescript/components/Stack/VStack.d.ts +3 -2
- package/lib/typescript/components/Stack/VStack.d.ts.map +1 -1
- package/lib/typescript/components/Tabs/index.d.ts.map +1 -1
- package/lib/typescript/components/Tabs/styles.d.ts +0 -7
- package/lib/typescript/components/Tabs/styles.d.ts.map +1 -1
- package/lib/typescript/components/Toast/animation.d.ts +3 -3
- package/lib/typescript/components/Toast/animation.d.ts.map +1 -1
- package/lib/typescript/figma/ListItem.SectionHeader.figma.d.ts.map +1 -1
- package/lib/typescript/index.d.ts +6 -1
- package/lib/typescript/index.d.ts.map +1 -1
- package/package.json +11 -9
- package/src/components/Box/Box.tsx +18 -4
- package/src/components/Breadcrumbs/index.tsx +28 -4
- package/src/components/Breadcrumbs/styles.ts +30 -0
- package/src/components/DateTimeList/index.tsx +13 -26
- package/src/components/DateTimeList/styles.ts +1 -10
- package/src/components/ListItem/index.tsx +5 -4
- package/src/components/ListItem/styles.ts +1 -0
- package/src/components/Menu/index.tsx +11 -8
- package/src/components/ScrollShadow/gradient.ts +48 -0
- package/src/components/ScrollShadow/index.tsx +300 -69
- package/src/components/ScrollShadow/styles.ts +45 -28
- package/src/components/ScrollShadow/useComposedScrollHandler.ts +58 -0
- package/src/components/ScrollShadow/useScrollShadow.ts +72 -10
- package/src/components/Stack/HStack.tsx +8 -4
- package/src/components/Stack/VStack.tsx +8 -4
- package/src/components/Tabs/index.tsx +25 -35
- package/src/components/Tabs/styles.ts +0 -9
- package/src/index.ts +8 -1
|
@@ -0,0 +1,695 @@
|
|
|
1
|
+
# List Item (https://design.candescent.com/docs/components/list-item)
|
|
2
|
+
|
|
3
|
+
Resources: [Figma](https://www.figma.com/design/0lEVMVlLj8ZS4fgItr3pmd/%E2%AD%90-Forge-DS--React-Native-Components?node-id=3710-4649), [Storybook](https://victorious-wave-0daadf00f.6.azurestaticapps.net/?path=/story/surfaces-listitem--default)
|
|
4
|
+
|
|
5
|
+
A compound component with sub-components for leading content, title, description, meta, trailing content, and section headers. Provide `onPress` to make the row pressable, or use `asChild` with `Link` for navigation.
|
|
6
|
+
|
|
7
|
+
```tsx
|
|
8
|
+
import { ListItem } from '@cdx-ui/components';
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Basic
|
|
12
|
+
|
|
13
|
+
Compose `ListItem.LeadingSlot`, `ListItem.Content`, and `ListItem.TrailingSlot` for a typical account or transaction row. Set `onPress` to make the row interactive.
|
|
14
|
+
|
|
15
|
+
```tsx
|
|
16
|
+
import { Avatar, Card, ListItem, Text } from '@cdx-ui/components';
|
|
17
|
+
import { Person } from '@cdx-ui/icons';
|
|
18
|
+
|
|
19
|
+
export default function ListItemBasicDemo() {
|
|
20
|
+
return (
|
|
21
|
+
<Card fullBleed className="w-full max-w-md">
|
|
22
|
+
<Card.Content>
|
|
23
|
+
<ListItem onPress={() => {}} showSeparator={false}>
|
|
24
|
+
<ListItem.LeadingSlot>
|
|
25
|
+
<Avatar>
|
|
26
|
+
<Avatar.Icon as={Person} />
|
|
27
|
+
</Avatar>
|
|
28
|
+
</ListItem.LeadingSlot>
|
|
29
|
+
<ListItem.Content>
|
|
30
|
+
<ListItem.Title>Joint Checking · 6643</ListItem.Title>
|
|
31
|
+
<ListItem.Description>Available balance</ListItem.Description>
|
|
32
|
+
</ListItem.Content>
|
|
33
|
+
<ListItem.TrailingSlot>
|
|
34
|
+
<Text>$2,450.00</Text>
|
|
35
|
+
</ListItem.TrailingSlot>
|
|
36
|
+
</ListItem>
|
|
37
|
+
</Card.Content>
|
|
38
|
+
</Card>
|
|
39
|
+
);
|
|
40
|
+
}
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## Static items
|
|
44
|
+
|
|
45
|
+
Omit `onPress` when rows present read-only information, such as account balances. The rows retain the same structure without suggesting that they navigate or trigger an action.
|
|
46
|
+
|
|
47
|
+
```tsx
|
|
48
|
+
import { Card, Heading, ListItem, Text } from '@cdx-ui/components';
|
|
49
|
+
|
|
50
|
+
const accounts = [
|
|
51
|
+
{
|
|
52
|
+
name: 'Joint Checking · 6643',
|
|
53
|
+
description: 'Available balance',
|
|
54
|
+
balance: '$2,450.00',
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
name: 'High Yield Savings · 7891',
|
|
58
|
+
description: 'Available balance',
|
|
59
|
+
balance: '$25,430.00',
|
|
60
|
+
},
|
|
61
|
+
];
|
|
62
|
+
|
|
63
|
+
export default function ListItemAvailableBalancesDemo() {
|
|
64
|
+
return (
|
|
65
|
+
<Card fullBleed className="w-full max-w-md">
|
|
66
|
+
<Card.Header>
|
|
67
|
+
<Heading size="sm">Available balances</Heading>
|
|
68
|
+
</Card.Header>
|
|
69
|
+
<Card.Content>
|
|
70
|
+
{accounts.map((account, index) => (
|
|
71
|
+
<ListItem key={account.name} showSeparator={index < accounts.length - 1}>
|
|
72
|
+
<ListItem.Content>
|
|
73
|
+
<ListItem.Title>{account.name}</ListItem.Title>
|
|
74
|
+
<ListItem.Description>{account.description}</ListItem.Description>
|
|
75
|
+
</ListItem.Content>
|
|
76
|
+
<ListItem.TrailingSlot>
|
|
77
|
+
<Text>{account.balance}</Text>
|
|
78
|
+
</ListItem.TrailingSlot>
|
|
79
|
+
</ListItem>
|
|
80
|
+
))}
|
|
81
|
+
</Card.Content>
|
|
82
|
+
</Card>
|
|
83
|
+
);
|
|
84
|
+
}
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
## Sizes
|
|
88
|
+
|
|
89
|
+
Use `size="compact"` for denser rows. Typography stays the same; padding and min-height shrink.
|
|
90
|
+
|
|
91
|
+
```tsx
|
|
92
|
+
import { Avatar, Card, ListItem, Text, VStack } from '@cdx-ui/components';
|
|
93
|
+
import { Person } from '@cdx-ui/icons';
|
|
94
|
+
|
|
95
|
+
export default function ListItemSizesDemo() {
|
|
96
|
+
return (
|
|
97
|
+
<VStack space="2xl" className="w-full max-w-md">
|
|
98
|
+
{(['default', 'compact'] as const).map((size) => (
|
|
99
|
+
<VStack key={size} space="sm">
|
|
100
|
+
<Text size="sm">{size}</Text>
|
|
101
|
+
<Card fullBleed>
|
|
102
|
+
<Card.Content>
|
|
103
|
+
<ListItem size={size} onPress={() => {}} showSeparator={false}>
|
|
104
|
+
<ListItem.LeadingSlot>
|
|
105
|
+
<Avatar>
|
|
106
|
+
<Avatar.Icon as={Person} />
|
|
107
|
+
</Avatar>
|
|
108
|
+
</ListItem.LeadingSlot>
|
|
109
|
+
<ListItem.Content>
|
|
110
|
+
<ListItem.Title>Joint Checking · 6643</ListItem.Title>
|
|
111
|
+
<ListItem.Description>Available balance</ListItem.Description>
|
|
112
|
+
</ListItem.Content>
|
|
113
|
+
<ListItem.TrailingSlot>
|
|
114
|
+
<Text>$2,450.00</Text>
|
|
115
|
+
</ListItem.TrailingSlot>
|
|
116
|
+
</ListItem>
|
|
117
|
+
</Card.Content>
|
|
118
|
+
</Card>
|
|
119
|
+
</VStack>
|
|
120
|
+
))}
|
|
121
|
+
</VStack>
|
|
122
|
+
);
|
|
123
|
+
}
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
## With meta
|
|
127
|
+
|
|
128
|
+
`ListItem.Meta` adds a tertiary line under the description — useful for timestamps and sources in alert feeds.
|
|
129
|
+
|
|
130
|
+
```tsx
|
|
131
|
+
import { Card, ListItem } from '@cdx-ui/components';
|
|
132
|
+
|
|
133
|
+
export default function ListItemWithMetaDemo() {
|
|
134
|
+
return (
|
|
135
|
+
<Card fullBleed className="w-full max-w-md">
|
|
136
|
+
<Card.Content>
|
|
137
|
+
<ListItem onPress={() => {}} showSeparator={false}>
|
|
138
|
+
<ListItem.Content>
|
|
139
|
+
<ListItem.Title>Security alert</ListItem.Title>
|
|
140
|
+
<ListItem.Description>
|
|
141
|
+
Unusual login detected from a new device in Portland, OR
|
|
142
|
+
</ListItem.Description>
|
|
143
|
+
<ListItem.Meta>2 hours ago · by System</ListItem.Meta>
|
|
144
|
+
</ListItem.Content>
|
|
145
|
+
</ListItem>
|
|
146
|
+
</Card.Content>
|
|
147
|
+
</Card>
|
|
148
|
+
);
|
|
149
|
+
}
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
## With switch
|
|
153
|
+
|
|
154
|
+
Omit `onPress` when the row hosts an interactive control in `ListItem.TrailingSlot`, such as a `Switch`.
|
|
155
|
+
|
|
156
|
+
```tsx
|
|
157
|
+
import { useState } from 'react';
|
|
158
|
+
import { Card, ListItem, Switch } from '@cdx-ui/components';
|
|
159
|
+
import { Notifications } from '@cdx-ui/icons';
|
|
160
|
+
|
|
161
|
+
export default function ListItemWithSwitchDemo() {
|
|
162
|
+
const [enabled, setEnabled] = useState(true);
|
|
163
|
+
|
|
164
|
+
return (
|
|
165
|
+
<Card fullBleed className="w-full max-w-md">
|
|
166
|
+
<Card.Content>
|
|
167
|
+
<ListItem showSeparator={false}>
|
|
168
|
+
<ListItem.LeadingSlot>
|
|
169
|
+
<Notifications size={24} />
|
|
170
|
+
</ListItem.LeadingSlot>
|
|
171
|
+
<ListItem.Content>
|
|
172
|
+
<ListItem.Title>Push Notifications</ListItem.Title>
|
|
173
|
+
<ListItem.Description>Receive alerts for account activity</ListItem.Description>
|
|
174
|
+
</ListItem.Content>
|
|
175
|
+
<ListItem.TrailingSlot>
|
|
176
|
+
<Switch value={enabled} onValueChange={setEnabled} />
|
|
177
|
+
</ListItem.TrailingSlot>
|
|
178
|
+
</ListItem>
|
|
179
|
+
</Card.Content>
|
|
180
|
+
</Card>
|
|
181
|
+
);
|
|
182
|
+
}
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
## Sectioned
|
|
186
|
+
|
|
187
|
+
Use `ListItem.SectionHeader` to group rows (e.g. by date). Each row renders its own bottom separator — set `showSeparator={false}` on the last item.
|
|
188
|
+
|
|
189
|
+
```tsx
|
|
190
|
+
import { Card, Chip, ListItem } from '@cdx-ui/components';
|
|
191
|
+
|
|
192
|
+
export default function ListItemSectionedDemo() {
|
|
193
|
+
return (
|
|
194
|
+
<Card fullBleed className="w-full max-w-md">
|
|
195
|
+
<Card.Content>
|
|
196
|
+
<ListItem.SectionHeader>Today, Friday February 13</ListItem.SectionHeader>
|
|
197
|
+
|
|
198
|
+
<ListItem onPress={() => {}}>
|
|
199
|
+
<ListItem.Content>
|
|
200
|
+
<ListItem.Title>Wire transfer received</ListItem.Title>
|
|
201
|
+
<ListItem.Description>
|
|
202
|
+
Save money with our bank account and credit card. Enjoy no annual fee cross-border
|
|
203
|
+
banking for 1 year
|
|
204
|
+
</ListItem.Description>
|
|
205
|
+
<ListItem.Meta>5 hours · by System</ListItem.Meta>
|
|
206
|
+
</ListItem.Content>
|
|
207
|
+
<ListItem.TrailingSlot>
|
|
208
|
+
<Chip color="info" size="small">
|
|
209
|
+
<Chip.Label>NEW</Chip.Label>
|
|
210
|
+
</Chip>
|
|
211
|
+
</ListItem.TrailingSlot>
|
|
212
|
+
</ListItem>
|
|
213
|
+
|
|
214
|
+
<ListItem onPress={() => {}}>
|
|
215
|
+
<ListItem.Content>
|
|
216
|
+
<ListItem.Title>Payment reminder</ListItem.Title>
|
|
217
|
+
<ListItem.Description>
|
|
218
|
+
Your credit card payment of $1,250.00 is due in 3 days
|
|
219
|
+
</ListItem.Description>
|
|
220
|
+
<ListItem.Meta>8 hours · by System</ListItem.Meta>
|
|
221
|
+
</ListItem.Content>
|
|
222
|
+
</ListItem>
|
|
223
|
+
|
|
224
|
+
<ListItem.SectionHeader>Thursday February 12</ListItem.SectionHeader>
|
|
225
|
+
|
|
226
|
+
<ListItem onPress={() => {}}>
|
|
227
|
+
<ListItem.Content>
|
|
228
|
+
<ListItem.Title>Account statement ready</ListItem.Title>
|
|
229
|
+
<ListItem.Description>
|
|
230
|
+
Your January statement is now available for download
|
|
231
|
+
</ListItem.Description>
|
|
232
|
+
<ListItem.Meta>1 day · by System</ListItem.Meta>
|
|
233
|
+
</ListItem.Content>
|
|
234
|
+
</ListItem>
|
|
235
|
+
|
|
236
|
+
<ListItem onPress={() => {}} showSeparator={false}>
|
|
237
|
+
<ListItem.Content>
|
|
238
|
+
<ListItem.Title>Security alert</ListItem.Title>
|
|
239
|
+
<ListItem.Description>
|
|
240
|
+
New device logged into your account from Portland, OR
|
|
241
|
+
</ListItem.Description>
|
|
242
|
+
<ListItem.Meta>1 day · by System</ListItem.Meta>
|
|
243
|
+
</ListItem.Content>
|
|
244
|
+
<ListItem.TrailingSlot>
|
|
245
|
+
<Chip color="info" size="small">
|
|
246
|
+
<Chip.Label>NEW</Chip.Label>
|
|
247
|
+
</Chip>
|
|
248
|
+
</ListItem.TrailingSlot>
|
|
249
|
+
</ListItem>
|
|
250
|
+
</Card.Content>
|
|
251
|
+
</Card>
|
|
252
|
+
);
|
|
253
|
+
}
|
|
254
|
+
```
|
|
255
|
+
|
|
256
|
+
Set `variant="subtle"` when grouping a contact list alphabetically. The neutral background stands the letter headers apart from their rows. The fill replaces the header's bottom border; the label styling and top divider stay the same.
|
|
257
|
+
|
|
258
|
+
```tsx
|
|
259
|
+
import { Avatar, Card, ListItem } from '@cdx-ui/components';
|
|
260
|
+
|
|
261
|
+
export default function ListItemSectionedSubtleDemo() {
|
|
262
|
+
return (
|
|
263
|
+
<Card fullBleed className="w-full max-w-md">
|
|
264
|
+
<Card.Content>
|
|
265
|
+
<ListItem.SectionHeader variant="subtle" showDivider={false}>
|
|
266
|
+
A
|
|
267
|
+
</ListItem.SectionHeader>
|
|
268
|
+
|
|
269
|
+
<ListItem onPress={() => {}}>
|
|
270
|
+
<ListItem.LeadingSlot>
|
|
271
|
+
<Avatar>
|
|
272
|
+
<Avatar.Text>Adam White</Avatar.Text>
|
|
273
|
+
</Avatar>
|
|
274
|
+
</ListItem.LeadingSlot>
|
|
275
|
+
<ListItem.Content>
|
|
276
|
+
<ListItem.Title>Adam White</ListItem.Title>
|
|
277
|
+
<ListItem.Description>Classmate</ListItem.Description>
|
|
278
|
+
</ListItem.Content>
|
|
279
|
+
</ListItem>
|
|
280
|
+
|
|
281
|
+
<ListItem onPress={() => {}} showSeparator={false}>
|
|
282
|
+
<ListItem.LeadingSlot>
|
|
283
|
+
<Avatar>
|
|
284
|
+
<Avatar.Text>Aron Smith</Avatar.Text>
|
|
285
|
+
</Avatar>
|
|
286
|
+
</ListItem.LeadingSlot>
|
|
287
|
+
<ListItem.Content>
|
|
288
|
+
<ListItem.Title>Aron Smith</ListItem.Title>
|
|
289
|
+
<ListItem.Description>Gym</ListItem.Description>
|
|
290
|
+
</ListItem.Content>
|
|
291
|
+
</ListItem>
|
|
292
|
+
|
|
293
|
+
<ListItem.SectionHeader variant="subtle" showDivider={false}>
|
|
294
|
+
B
|
|
295
|
+
</ListItem.SectionHeader>
|
|
296
|
+
|
|
297
|
+
<ListItem onPress={() => {}}>
|
|
298
|
+
<ListItem.LeadingSlot>
|
|
299
|
+
<Avatar>
|
|
300
|
+
<Avatar.Text>Bennett Charles</Avatar.Text>
|
|
301
|
+
</Avatar>
|
|
302
|
+
</ListItem.LeadingSlot>
|
|
303
|
+
<ListItem.Content>
|
|
304
|
+
<ListItem.Title>Bennett Charles</ListItem.Title>
|
|
305
|
+
<ListItem.Description>Savings •••1189</ListItem.Description>
|
|
306
|
+
</ListItem.Content>
|
|
307
|
+
</ListItem>
|
|
308
|
+
|
|
309
|
+
<ListItem onPress={() => {}} showSeparator={false}>
|
|
310
|
+
<ListItem.LeadingSlot>
|
|
311
|
+
<Avatar>
|
|
312
|
+
<Avatar.Text>Brightside Dental</Avatar.Text>
|
|
313
|
+
</Avatar>
|
|
314
|
+
</ListItem.LeadingSlot>
|
|
315
|
+
<ListItem.Content>
|
|
316
|
+
<ListItem.Title>Brightside Dental</ListItem.Title>
|
|
317
|
+
<ListItem.Description>Business Checking •••6021</ListItem.Description>
|
|
318
|
+
</ListItem.Content>
|
|
319
|
+
</ListItem>
|
|
320
|
+
</Card.Content>
|
|
321
|
+
</Card>
|
|
322
|
+
);
|
|
323
|
+
}
|
|
324
|
+
```
|
|
325
|
+
|
|
326
|
+
Set `variant="gradient"` for account group headers on a dashboard. The fill fades from the primary surface into a brand tint and keeps the bottom border.
|
|
327
|
+
|
|
328
|
+
```tsx
|
|
329
|
+
import { Card, ListItem, Text } from '@cdx-ui/components';
|
|
330
|
+
|
|
331
|
+
export default function ListItemSectionedGradientDemo() {
|
|
332
|
+
return (
|
|
333
|
+
<Card fullBleed className="w-full max-w-md">
|
|
334
|
+
<Card.Content>
|
|
335
|
+
<ListItem.SectionHeader variant="gradient" showDivider={false}>
|
|
336
|
+
Checking & savings
|
|
337
|
+
</ListItem.SectionHeader>
|
|
338
|
+
|
|
339
|
+
<ListItem onPress={() => {}}>
|
|
340
|
+
<ListItem.Content>
|
|
341
|
+
<ListItem.Title>Joint Household Checking</ListItem.Title>
|
|
342
|
+
<ListItem.Description>Available balance</ListItem.Description>
|
|
343
|
+
</ListItem.Content>
|
|
344
|
+
<ListItem.TrailingSlot>
|
|
345
|
+
<Text weight="semibold">$9,311.45</Text>
|
|
346
|
+
</ListItem.TrailingSlot>
|
|
347
|
+
</ListItem>
|
|
348
|
+
|
|
349
|
+
<ListItem onPress={() => {}} showSeparator={false}>
|
|
350
|
+
<ListItem.Content>
|
|
351
|
+
<ListItem.Title>Deposit Savings</ListItem.Title>
|
|
352
|
+
<ListItem.Description>Available balance</ListItem.Description>
|
|
353
|
+
</ListItem.Content>
|
|
354
|
+
<ListItem.TrailingSlot>
|
|
355
|
+
<Text weight="semibold">$6,345.67</Text>
|
|
356
|
+
</ListItem.TrailingSlot>
|
|
357
|
+
</ListItem>
|
|
358
|
+
</Card.Content>
|
|
359
|
+
</Card>
|
|
360
|
+
);
|
|
361
|
+
}
|
|
362
|
+
```
|
|
363
|
+
|
|
364
|
+
## Virtualized list
|
|
365
|
+
|
|
366
|
+
For long scrollable lists, render `ListItem` rows from `VirtualizedList` inside a `fullBleed` `Card`. Only visible rows mount at a time.
|
|
367
|
+
|
|
368
|
+
```tsx
|
|
369
|
+
import { Avatar, Box, Card, ListItem, Text, VirtualizedList } from '@cdx-ui/components';
|
|
370
|
+
|
|
371
|
+
const TITLES = ['Coffee Shop', 'Grocery Store', 'Gas Station', 'Online Transfer', 'Restaurant'];
|
|
372
|
+
const DESCRIPTIONS = ['Visa · *4321', 'Debit · *6643', 'Visa · *8821', 'Internal', 'Visa · *4321'];
|
|
373
|
+
const AMOUNTS = ['$12.45', '$84.20', '$41.75', '$250.00', '$36.18'];
|
|
374
|
+
|
|
375
|
+
const transactions = Array.from({ length: 50 }, (_, i) => ({
|
|
376
|
+
id: String(i),
|
|
377
|
+
title: TITLES[i % TITLES.length],
|
|
378
|
+
description: DESCRIPTIONS[i % DESCRIPTIONS.length],
|
|
379
|
+
amount: AMOUNTS[i % AMOUNTS.length],
|
|
380
|
+
date: `May ${String((i % 28) + 1)}`,
|
|
381
|
+
}));
|
|
382
|
+
|
|
383
|
+
export default function ListItemVirtualizedDemo() {
|
|
384
|
+
return (
|
|
385
|
+
<Box className="h-96 w-full max-w-md">
|
|
386
|
+
<Card fullBleed className="flex-1">
|
|
387
|
+
<Card.Content className="flex-1">
|
|
388
|
+
<ListItem.SectionHeader>Recent Transactions</ListItem.SectionHeader>
|
|
389
|
+
<VirtualizedList
|
|
390
|
+
data={transactions}
|
|
391
|
+
keyExtractor={(item) => item.id}
|
|
392
|
+
renderItem={({ item, index }) => (
|
|
393
|
+
<ListItem onPress={() => undefined} showSeparator={index < transactions.length - 1}>
|
|
394
|
+
<ListItem.LeadingSlot>
|
|
395
|
+
<Avatar>
|
|
396
|
+
<Avatar.Text>{item.title.slice(0, 2).toUpperCase()}</Avatar.Text>
|
|
397
|
+
</Avatar>
|
|
398
|
+
</ListItem.LeadingSlot>
|
|
399
|
+
<ListItem.Content>
|
|
400
|
+
<ListItem.Title>{item.title}</ListItem.Title>
|
|
401
|
+
<ListItem.Description>{item.description}</ListItem.Description>
|
|
402
|
+
<ListItem.Meta>{item.date}</ListItem.Meta>
|
|
403
|
+
</ListItem.Content>
|
|
404
|
+
<ListItem.TrailingSlot>
|
|
405
|
+
<Text>{item.amount}</Text>
|
|
406
|
+
</ListItem.TrailingSlot>
|
|
407
|
+
</ListItem>
|
|
408
|
+
)}
|
|
409
|
+
/>
|
|
410
|
+
</Card.Content>
|
|
411
|
+
</Card>
|
|
412
|
+
</Box>
|
|
413
|
+
);
|
|
414
|
+
}
|
|
415
|
+
```
|
|
416
|
+
|
|
417
|
+
## Multiple trailing
|
|
418
|
+
|
|
419
|
+
`ListItem.TrailingSlot` lays out multiple children in a horizontal row. Interactive trailing elements manage their own touch targets.
|
|
420
|
+
|
|
421
|
+
```tsx
|
|
422
|
+
import { Avatar, Card, IconButton, ListItem } from '@cdx-ui/components';
|
|
423
|
+
import { ChevronRight, Person, Star } from '@cdx-ui/icons';
|
|
424
|
+
|
|
425
|
+
export default function ListItemMultipleTrailingDemo() {
|
|
426
|
+
return (
|
|
427
|
+
<Card fullBleed className="w-full max-w-md">
|
|
428
|
+
<Card.Content>
|
|
429
|
+
<ListItem onPress={() => {}} showSeparator={false}>
|
|
430
|
+
<ListItem.LeadingSlot>
|
|
431
|
+
<Avatar>
|
|
432
|
+
<Avatar.Icon as={Person} />
|
|
433
|
+
</Avatar>
|
|
434
|
+
</ListItem.LeadingSlot>
|
|
435
|
+
<ListItem.Content>
|
|
436
|
+
<ListItem.Title>Savings Account</ListItem.Title>
|
|
437
|
+
<ListItem.Description>·4321</ListItem.Description>
|
|
438
|
+
</ListItem.Content>
|
|
439
|
+
<ListItem.TrailingSlot>
|
|
440
|
+
<IconButton as={Star} size="small" variant="ghost" onPress={() => {}} />
|
|
441
|
+
<ChevronRight size={20} />
|
|
442
|
+
</ListItem.TrailingSlot>
|
|
443
|
+
</ListItem>
|
|
444
|
+
</Card.Content>
|
|
445
|
+
</Card>
|
|
446
|
+
);
|
|
447
|
+
}
|
|
448
|
+
```
|
|
449
|
+
|
|
450
|
+
## Disabled
|
|
451
|
+
|
|
452
|
+
Set `isDisabled` to block press handling and reduce opacity.
|
|
453
|
+
|
|
454
|
+
```tsx
|
|
455
|
+
import { Avatar, Card, ListItem } from '@cdx-ui/components';
|
|
456
|
+
import { ChevronRight, Person } from '@cdx-ui/icons';
|
|
457
|
+
|
|
458
|
+
export default function ListItemDisabledDemo() {
|
|
459
|
+
return (
|
|
460
|
+
<Card fullBleed className="w-full max-w-md">
|
|
461
|
+
<Card.Content>
|
|
462
|
+
<ListItem onPress={() => {}} isDisabled showSeparator={false}>
|
|
463
|
+
<ListItem.LeadingSlot>
|
|
464
|
+
<Avatar>
|
|
465
|
+
<Avatar.Icon as={Person} />
|
|
466
|
+
</Avatar>
|
|
467
|
+
</ListItem.LeadingSlot>
|
|
468
|
+
<ListItem.Content>
|
|
469
|
+
<ListItem.Title>Locked Account · 9912</ListItem.Title>
|
|
470
|
+
<ListItem.Description>Contact support to unlock</ListItem.Description>
|
|
471
|
+
</ListItem.Content>
|
|
472
|
+
<ListItem.TrailingSlot>
|
|
473
|
+
<ChevronRight size={20} />
|
|
474
|
+
</ListItem.TrailingSlot>
|
|
475
|
+
</ListItem>
|
|
476
|
+
</Card.Content>
|
|
477
|
+
</Card>
|
|
478
|
+
);
|
|
479
|
+
}
|
|
480
|
+
```
|
|
481
|
+
|
|
482
|
+
## As link
|
|
483
|
+
|
|
484
|
+
Use `asChild` with `Link` so the link owns navigation while `ListItem` owns layout and visual treatment — no nested pressables.
|
|
485
|
+
|
|
486
|
+
```tsx
|
|
487
|
+
import { Card, Link, ListItem } from '@cdx-ui/components';
|
|
488
|
+
import { ChevronRight, Notifications, Settings } from '@cdx-ui/icons';
|
|
489
|
+
|
|
490
|
+
export default function ListItemAsLinkDemo() {
|
|
491
|
+
return (
|
|
492
|
+
<Card fullBleed className="w-full max-w-md">
|
|
493
|
+
<Card.Content>
|
|
494
|
+
<ListItem asChild>
|
|
495
|
+
<Link href="https://example.com/settings" accessibilityLabel="Account settings">
|
|
496
|
+
<ListItem.LeadingSlot>
|
|
497
|
+
<Settings size={24} />
|
|
498
|
+
</ListItem.LeadingSlot>
|
|
499
|
+
<ListItem.Content>
|
|
500
|
+
<ListItem.Title>Account Settings</ListItem.Title>
|
|
501
|
+
<ListItem.Description>Manage your preferences</ListItem.Description>
|
|
502
|
+
</ListItem.Content>
|
|
503
|
+
<ListItem.TrailingSlot>
|
|
504
|
+
<ChevronRight size={20} />
|
|
505
|
+
</ListItem.TrailingSlot>
|
|
506
|
+
</Link>
|
|
507
|
+
</ListItem>
|
|
508
|
+
<ListItem asChild showSeparator={false}>
|
|
509
|
+
<Link href="https://example.com/notifications" accessibilityLabel="Notifications">
|
|
510
|
+
<ListItem.LeadingSlot>
|
|
511
|
+
<Notifications size={24} />
|
|
512
|
+
</ListItem.LeadingSlot>
|
|
513
|
+
<ListItem.Content>
|
|
514
|
+
<ListItem.Title>Notifications</ListItem.Title>
|
|
515
|
+
<ListItem.Description>Push, email, and SMS alerts</ListItem.Description>
|
|
516
|
+
</ListItem.Content>
|
|
517
|
+
<ListItem.TrailingSlot>
|
|
518
|
+
<ChevronRight size={20} />
|
|
519
|
+
</ListItem.TrailingSlot>
|
|
520
|
+
</Link>
|
|
521
|
+
</ListItem>
|
|
522
|
+
</Card.Content>
|
|
523
|
+
</Card>
|
|
524
|
+
);
|
|
525
|
+
}
|
|
526
|
+
```
|
|
527
|
+
|
|
528
|
+
## API
|
|
529
|
+
|
|
530
|
+
### ListItem
|
|
531
|
+
|
|
532
|
+
Root row container. Renders as `View` by default; becomes pressable when `onPress` is provided. Use `asChild` to merge props onto a single child (e.g. `Link`).
|
|
533
|
+
|
|
534
|
+
| Prop | Type | Default | Description |
|
|
535
|
+
| --- | --- | --- | --- |
|
|
536
|
+
| `className?` | `string` | — | — |
|
|
537
|
+
| `children?` | `ReactNode` | — | — |
|
|
538
|
+
| `crossAlign?` | `'center' \| 'start'` | `'center'` | Vertical alignment of the leading, content, and trailing slots. `start` top-aligns them so trailing text lines up with the title. |
|
|
539
|
+
| `onPressIn?` | `((event: GestureResponderEvent) => void) \| null` | — | Called when a touch is engaged before `onPress`. |
|
|
540
|
+
| `onPressOut?` | `((event: GestureResponderEvent) => void) \| null` | — | Called when a touch is released before `onPress`. |
|
|
541
|
+
| `onHoverIn?` | `((event: MouseEvent) => void) \| null` | — | Called when the hover is activated to provide visual feedback. |
|
|
542
|
+
| `onHoverOut?` | `((event: MouseEvent) => void) \| null` | — | Called when the hover is deactivated to undo visual feedback. |
|
|
543
|
+
| `isDisabled?` | `boolean` | — | Disables press handling when the root is pressable (maps to Pressable `disabled`). |
|
|
544
|
+
| `onPress?` | `((event: GestureResponderEvent) => void) \| null` | — | When set (and `asChild` is not used), root renders as pressable with interaction props. |
|
|
545
|
+
| `asChild?` | `boolean` | — | Merge props onto a single child (for example `Link`) instead of rendering `View` or `Pressable`. The child's `onPress` is kept unless this component also passes `onPress`. `isDisabled` suppresses press on the child. |
|
|
546
|
+
| `accessory?` | `ReactNode` | — | Interactive control that must sit beside the row's pressable element, never inside it (for example a drag handle). On a pressable row (`onPress`, or `asChild` with an element child) the root renders a non-interactive container holding the accessory and the pressable region as siblings. The container receives `ref`, `className`, `style`, and data attributes, and mirrors the region's interaction state as `data-*`; the region receives every other prop. A non-pressable row renders the accessory inline beside `children`. |
|
|
547
|
+
| `accessoryPosition?` | `'start' \| 'end'` | `'start'` | Side of the pressable region the accessory renders on. |
|
|
548
|
+
| `pressableClassName?` | `string` | — | Class names for the pressable region when `accessory` splits the row. |
|
|
549
|
+
| `pressableStyle?` | `StyleProp<ViewStyle>` | — | Style for the pressable region when `accessory` splits the row. |
|
|
550
|
+
| `size?` | `'default' \| 'compact'` | `'default'` | Vertical density. `compact` reduces padding and min-height; typography stays the same. |
|
|
551
|
+
| `showSeparator?` | `boolean` | `true` | Bottom border between rows. Set `false` on the last row to avoid a trailing border. |
|
|
552
|
+
|
|
553
|
+
Inherits all [`ViewProps`](https://reactnative.dev/docs/view#props). When `onPress` is set, pressable event handlers (`onPressIn`, `onPressOut`, `onHoverIn`, `onHoverOut`) are also accepted.
|
|
554
|
+
|
|
555
|
+
| Attribute | Values | Description |
|
|
556
|
+
| -------------------- | ----------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
557
|
+
| `data-slot` | `list-item` | Root row |
|
|
558
|
+
| `data-disabled` | `true` \| `false` | Disabled state |
|
|
559
|
+
| `data-hover` | `true` \| `false` | Hover (web, when pressable) |
|
|
560
|
+
| `data-active` | `true` \| `false` | Pressed (when pressable) |
|
|
561
|
+
| `data-focus-visible` | `true` \| `false` | Keyboard focus ring (web) |
|
|
562
|
+
| `data-dragging` | `true` \| `false` | True while this row is dragged in a [`ReorderableList`](https://design.candescent.com/docs/components/reorderable-list/content.md). Read from the list's row context; there is no prop |
|
|
563
|
+
|
|
564
|
+
## Sub-components
|
|
565
|
+
|
|
566
|
+
### ListItem.LeadingSlot
|
|
567
|
+
|
|
568
|
+
Optional leading adornment (Avatar, Icon). Decorative and `aria-hidden` by default — set `aria-hidden={false}` when the slot contains meaningful controls.
|
|
569
|
+
|
|
570
|
+
| Prop | Type | Default | Description |
|
|
571
|
+
| --- | --- | --- | --- |
|
|
572
|
+
| `className?` | `string` | — | — |
|
|
573
|
+
| `children?` | `ReactNode` | — | — |
|
|
574
|
+
| `asChild?` | `boolean` | — | Renders the consumer's child element in place of the default `View` host. |
|
|
575
|
+
|
|
576
|
+
Inherits all [`ViewProps`](https://reactnative.dev/docs/view#props).
|
|
577
|
+
|
|
578
|
+
### ListItem.DragHandle
|
|
579
|
+
|
|
580
|
+
Explicit grip used with [`ReorderableList`](https://design.candescent.com/docs/components/reorderable-list/content.md). Outside a list row it renders nothing and logs a development warning. Make it the first or last direct child of `ListItem`, not a child of `ListItem.LeadingSlot` (that slot is `aria-hidden` by default) or `ListItem.TrailingSlot`.
|
|
581
|
+
|
|
582
|
+
On a pressable row (`onPress`, or `asChild`), the row renders the handle beside its pressable element instead of inside it, so tapping or clicking the handle never presses the row and screen readers reach both controls. Under `asChild`, pass the handle and the interactive element as siblings: `<ListItem asChild><ListItem.DragHandle /><Link>…</Link></ListItem>`. A handle nested deeper in a pressable row logs a development warning.
|
|
583
|
+
|
|
584
|
+
| Prop | Type | Default | Description |
|
|
585
|
+
| --- | --- | --- | --- |
|
|
586
|
+
| `className?` | `string` | — | — |
|
|
587
|
+
| `children?` | `ReactNode` | — | — |
|
|
588
|
+
|
|
589
|
+
Inherits all [`ViewProps`](https://reactnative.dev/docs/view#props).
|
|
590
|
+
|
|
591
|
+
### ListItem.Content
|
|
592
|
+
|
|
593
|
+
Flex column for the text stack (`ListItem.Title`, `ListItem.Description`, and `ListItem.Meta`).
|
|
594
|
+
|
|
595
|
+
| Prop | Type | Default | Description |
|
|
596
|
+
| --- | --- | --- | --- |
|
|
597
|
+
| `className?` | `string` | — | — |
|
|
598
|
+
| `children?` | `ReactNode` | — | — |
|
|
599
|
+
| `asChild?` | `boolean` | — | Renders the consumer's child element in place of the default `View` host. |
|
|
600
|
+
|
|
601
|
+
Inherits all [`ViewProps`](https://reactnative.dev/docs/view#props).
|
|
602
|
+
|
|
603
|
+
### ListItem.Title
|
|
604
|
+
|
|
605
|
+
Primary label. Truncates to one line by default (`numberOfLines={1}`).
|
|
606
|
+
|
|
607
|
+
| Prop | Type | Default | Description |
|
|
608
|
+
| --- | --- | --- | --- |
|
|
609
|
+
| `className?` | `string` | — | — |
|
|
610
|
+
| `children?` | `ReactNode` | — | — |
|
|
611
|
+
| `asChild?` | `boolean` | — | Renders the consumer's child element in place of the default `Text` host. |
|
|
612
|
+
|
|
613
|
+
Inherits all [`TextProps`](https://reactnative.dev/docs/text#props).
|
|
614
|
+
|
|
615
|
+
### ListItem.Description
|
|
616
|
+
|
|
617
|
+
Secondary text below the title. Wraps freely by default.
|
|
618
|
+
|
|
619
|
+
| Prop | Type | Default | Description |
|
|
620
|
+
| --- | --- | --- | --- |
|
|
621
|
+
| `className?` | `string` | — | — |
|
|
622
|
+
| `children?` | `ReactNode` | — | — |
|
|
623
|
+
| `asChild?` | `boolean` | — | Renders the consumer's child element in place of the default `Text` host. |
|
|
624
|
+
|
|
625
|
+
Inherits all [`TextProps`](https://reactnative.dev/docs/text#props).
|
|
626
|
+
|
|
627
|
+
### ListItem.Meta
|
|
628
|
+
|
|
629
|
+
Tertiary metadata line (timestamp, source). Truncates to one line by default (`numberOfLines={1}`).
|
|
630
|
+
|
|
631
|
+
| Prop | Type | Default | Description |
|
|
632
|
+
| --- | --- | --- | --- |
|
|
633
|
+
| `className?` | `string` | — | — |
|
|
634
|
+
| `children?` | `ReactNode` | — | — |
|
|
635
|
+
| `asChild?` | `boolean` | — | Renders the consumer's child element in place of the default `Text` host. |
|
|
636
|
+
|
|
637
|
+
Inherits all [`TextProps`](https://reactnative.dev/docs/text#props).
|
|
638
|
+
|
|
639
|
+
### ListItem.TrailingSlot
|
|
640
|
+
|
|
641
|
+
Optional trailing content (amount, chip, chevron, switch, or action buttons). Renders children in a horizontal row with gap.
|
|
642
|
+
|
|
643
|
+
| Prop | Type | Default | Description |
|
|
644
|
+
| --- | --- | --- | --- |
|
|
645
|
+
| `className?` | `string` | — | — |
|
|
646
|
+
| `children?` | `ReactNode` | — | — |
|
|
647
|
+
| `asChild?` | `boolean` | — | Renders the consumer's child element in place of the default `View` host. |
|
|
648
|
+
|
|
649
|
+
Inherits all [`ViewProps`](https://reactnative.dev/docs/view#props).
|
|
650
|
+
|
|
651
|
+
### ListItem.SectionHeader
|
|
652
|
+
|
|
653
|
+
Group heading row with an optional accent top-border divider and an optional `subtle` neutral background. String or number children are auto-styled. Supports a `trailing` adornment (e.g. a count Chip).
|
|
654
|
+
|
|
655
|
+
| Prop | Type | Default | Description |
|
|
656
|
+
| --- | --- | --- | --- |
|
|
657
|
+
| `className?` | `string` | — | — |
|
|
658
|
+
| `children` | `ReactNode` | — | Primary section label. String or number children are styled as an uppercase label. |
|
|
659
|
+
| `asChild?` | `boolean` | — | Renders the consumer's child element in place of the default `View` host. |
|
|
660
|
+
| `trailing?` | `ReactNode` | — | Optional right-aligned adornment (e.g. section Chip). |
|
|
661
|
+
| `variant?` | `'ghost' \| 'subtle' \| 'gradient'` | `'ghost'` | Background treatment. `ghost` has no fill and a bottom border; `subtle` adds a neutral fill (matching `subtle` on Avatar, Chip, and IconButton) and drops the bottom border. `gradient` fades from the primary surface into a brand tint, left to right, and keeps the bottom border. Label typography is the same for all three. |
|
|
662
|
+
| `showDivider?` | `boolean` | `true` | Accent top border above the header. |
|
|
663
|
+
|
|
664
|
+
Inherits all [`ViewProps`](https://reactnative.dev/docs/view#props).
|
|
665
|
+
|
|
666
|
+
| Attribute | Values | Description |
|
|
667
|
+
| -------------- | --------------------- | -------------------------------- |
|
|
668
|
+
| `data-slot` | `list-section-header` | Section header root |
|
|
669
|
+
| `data-divider` | `true` \| `false` | Whether the top divider is shown |
|
|
670
|
+
|
|
671
|
+
## Anatomy
|
|
672
|
+
|
|
673
|
+
| `data-slot` | Element |
|
|
674
|
+
| ----------------------- | --------------------- |
|
|
675
|
+
| `list-item` | Root row |
|
|
676
|
+
| `list-item-drag-handle` | Drag handle |
|
|
677
|
+
| `list-item-leading` | Leading adornment |
|
|
678
|
+
| `list-item-content` | Text stack |
|
|
679
|
+
| `list-item-title` | Primary label |
|
|
680
|
+
| `list-item-description` | Secondary text |
|
|
681
|
+
| `list-item-meta` | Tertiary metadata |
|
|
682
|
+
| `list-item-trailing` | Trailing content |
|
|
683
|
+
| `list-section-header` | Section group heading |
|
|
684
|
+
|
|
685
|
+
## Accessibility
|
|
686
|
+
|
|
687
|
+
| Attribute | Behavior |
|
|
688
|
+
| ---------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
689
|
+
| **Role** | No implicit ARIA role. Add `role="listitem"` when inside a `role="list"` container. |
|
|
690
|
+
| **Keyboard** | Pressable rows are Tab-focusable. Activate with Enter or Space. Focus ring via `focus-visible` on web. |
|
|
691
|
+
| **Screen reader** | Provide an explicit `accessibilityLabel` on pressable rows when needed. Nested title and description text are read individually. |
|
|
692
|
+
| **`ListItem.LeadingSlot`** | `aria-hidden` by default — override for meaningful leading content. |
|
|
693
|
+
| **`ListItem.DragHandle`** | Button role with default label `Reorder`. Provide a per-row `accessibilityLabel`. On iOS and Android it carries the list's move accessibility actions and a hint that names them. |
|
|
694
|
+
| **`ListItem.SectionHeader`** | Uses `accessibilityRole="header"` for VoiceOver section navigation. |
|
|
695
|
+
| **Disabled** | Sets `accessibilityState={{ disabled: true }}` on pressable roots. Non-pressable disabled rows receive `data-disabled` styling only. |
|