@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
package/AGENTS.md
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# @cdx-ui/components — agent guide
|
|
2
|
+
|
|
3
|
+
This package ships its own Forge UI documentation in `docs/`, generated from the docs site
|
|
4
|
+
at the commit this version was released from. It matches the installed version exactly.
|
|
5
|
+
|
|
6
|
+
## Use the bundled docs first
|
|
7
|
+
|
|
8
|
+
- Prefer `docs/` over https://design.candescent.com. The live site tracks the latest
|
|
9
|
+
unreleased source, so its APIs and examples can be ahead of this install.
|
|
10
|
+
- Start at `docs/llms.txt`: an index of every page, linking each to its local file.
|
|
11
|
+
- For a page at site path `<path>` (for example `components/button` or
|
|
12
|
+
`getting-started/developers`):
|
|
13
|
+
- `docs/<path>/content.md` has the page prose, demo source and generated prop tables.
|
|
14
|
+
- `docs/<path>/design.md` has design guidance. Only some pages have one.
|
|
15
|
+
- Search the folder directly (for example `grep -rl "BottomSheet" docs/`) instead of
|
|
16
|
+
fetching a concatenated file.
|
|
17
|
+
|
|
18
|
+
## When sources disagree
|
|
19
|
+
|
|
20
|
+
The installed type declarations in `lib/typescript/` are the final word on props and
|
|
21
|
+
exports. If they disagree with `docs/`, trust the types.
|
|
22
|
+
|
|
23
|
+
Links inside `content.md` and `design.md` use absolute site URLs, so they open the live
|
|
24
|
+
site rather than this version. Prefer the local file for the same `<path>`.
|
package/README.md
CHANGED
|
@@ -46,6 +46,8 @@ export function Example() {
|
|
|
46
46
|
|
|
47
47
|
The [component reference](https://design.candescent.com/docs/components) is the source of truth for the catalog — every component has a page there with live examples, props, and accessibility notes.
|
|
48
48
|
|
|
49
|
+
The package also ships that reference as markdown in `docs/`, matched to the installed version; coding agents should start at `AGENTS.md` in the package root.
|
|
50
|
+
|
|
49
51
|
> `Box` is exported but deprecated — use React Native's `View` directly.
|
|
50
52
|
|
|
51
53
|
### Providers
|
package/coverage.svg
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
<svg xmlns="http://www.w3.org/2000/svg" width="108" height="20" role="img" aria-label="coverage: 92.
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="108" height="20" role="img" aria-label="coverage: 92.6%"><title>coverage: 92.6%</title><filter id="blur"><feGaussianBlur stdDeviation="16"/></filter><linearGradient id="s" x2="0" y2="100%"><stop offset="0" stop-color="#bbb" stop-opacity=".1"/><stop offset="1" stop-opacity=".1"/></linearGradient><clipPath id="r"><rect width="108" height="20" rx="3"/></clipPath><g clip-path="url(#r)"><rect width="61" height="20" fill="#555"/><rect x="61" width="47" height="20" fill="#4b0"/><rect width="108" height="20" fill="url(#s)"/></g><g fill="#fff" text-anchor="middle" font-family="Verdana,Geneva,DejaVu Sans,sans-serif" text-rendering="geometricPrecision" font-size="110"><g transform="scale(.1)"><g aria-hidden="true" fill="#010101"><text x="315" y="150" fill-opacity=".8" filter="url(#blur)" textLength="510">coverage</text><text x="315" y="150" fill-opacity=".3" textLength="510">coverage</text></g><text x="315" y="140" textLength="510">coverage</text></g><g transform="scale(.1)"><g aria-hidden="true" fill="#010101"><text x="835" y="150" fill-opacity=".8" filter="url(#blur)" textLength="370">92.6%</text><text x="835" y="150" fill-opacity=".3" textLength="370">92.6%</text></g><text x="835" y="140" textLength="370">92.6%</text></g></g></svg>
|
|
@@ -0,0 +1,538 @@
|
|
|
1
|
+
# Accordion (https://design.candescent.com/docs/components/accordion)
|
|
2
|
+
|
|
3
|
+
Resources: [Figma](https://www.figma.com/design/0lEVMVlLj8ZS4fgItr3pmd/%E2%AD%90-Forge-DS--React-Native-Components?node-id=11210-5320), [Storybook](https://victorious-wave-0daadf00f.6.azurestaticapps.net/?path=/story/surfaces-accordion--default)
|
|
4
|
+
|
|
5
|
+
Use `Accordion` for FAQs, settings, and other sections where people reveal content as needed. Compose each item from a trigger and content region.
|
|
6
|
+
|
|
7
|
+
```tsx
|
|
8
|
+
import { Accordion } from '@cdx-ui/components';
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Basic
|
|
12
|
+
|
|
13
|
+
Use `type="single"` when only one item should be open. Control the open item with `value` and `onValueChange`, or provide `defaultValue` for uncontrolled usage.
|
|
14
|
+
|
|
15
|
+
```tsx
|
|
16
|
+
import { useState } from 'react';
|
|
17
|
+
import { Accordion, Text } from '@cdx-ui/components';
|
|
18
|
+
|
|
19
|
+
export default function AccordionBasicDemo() {
|
|
20
|
+
const [value, setValue] = useState<string | undefined>('shipping');
|
|
21
|
+
|
|
22
|
+
return (
|
|
23
|
+
<Accordion
|
|
24
|
+
type="single"
|
|
25
|
+
value={value}
|
|
26
|
+
onValueChange={setValue}
|
|
27
|
+
aria-label="Store policies"
|
|
28
|
+
className="w-full max-w-md"
|
|
29
|
+
>
|
|
30
|
+
<Accordion.Item value="shipping">
|
|
31
|
+
<Accordion.Trigger>
|
|
32
|
+
<Accordion.Label>
|
|
33
|
+
<Accordion.Title>Shipping policy</Accordion.Title>
|
|
34
|
+
</Accordion.Label>
|
|
35
|
+
</Accordion.Trigger>
|
|
36
|
+
<Accordion.Content>
|
|
37
|
+
<Text size="sm" color="secondary">
|
|
38
|
+
Standard shipping is free on orders over $50.
|
|
39
|
+
</Text>
|
|
40
|
+
</Accordion.Content>
|
|
41
|
+
</Accordion.Item>
|
|
42
|
+
<Accordion.Item value="returns" showSeparator={false}>
|
|
43
|
+
<Accordion.Trigger>
|
|
44
|
+
<Accordion.Label>
|
|
45
|
+
<Accordion.Title>Returns</Accordion.Title>
|
|
46
|
+
</Accordion.Label>
|
|
47
|
+
</Accordion.Trigger>
|
|
48
|
+
<Accordion.Content>
|
|
49
|
+
<Text size="sm" color="secondary">
|
|
50
|
+
Return unused items within 30 days for a full refund.
|
|
51
|
+
</Text>
|
|
52
|
+
</Accordion.Content>
|
|
53
|
+
</Accordion.Item>
|
|
54
|
+
</Accordion>
|
|
55
|
+
);
|
|
56
|
+
}
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
## Multiple
|
|
60
|
+
|
|
61
|
+
Use `type="multiple"` to let people open and close items independently.
|
|
62
|
+
|
|
63
|
+
```tsx
|
|
64
|
+
import { Accordion, Text } from '@cdx-ui/components';
|
|
65
|
+
|
|
66
|
+
export default function AccordionMultipleDemo() {
|
|
67
|
+
return (
|
|
68
|
+
<Accordion
|
|
69
|
+
type="multiple"
|
|
70
|
+
defaultValue={['alerts', 'security']}
|
|
71
|
+
aria-label="Account settings"
|
|
72
|
+
className="w-full max-w-md"
|
|
73
|
+
>
|
|
74
|
+
<Accordion.Item value="alerts">
|
|
75
|
+
<Accordion.Trigger>
|
|
76
|
+
<Accordion.Label>
|
|
77
|
+
<Accordion.Title>Alerts</Accordion.Title>
|
|
78
|
+
</Accordion.Label>
|
|
79
|
+
</Accordion.Trigger>
|
|
80
|
+
<Accordion.Content>
|
|
81
|
+
<Text size="sm" color="secondary">
|
|
82
|
+
Receive balance, deposit, and payment notifications.
|
|
83
|
+
</Text>
|
|
84
|
+
</Accordion.Content>
|
|
85
|
+
</Accordion.Item>
|
|
86
|
+
<Accordion.Item value="security" showSeparator={false}>
|
|
87
|
+
<Accordion.Trigger>
|
|
88
|
+
<Accordion.Label>
|
|
89
|
+
<Accordion.Title>Security</Accordion.Title>
|
|
90
|
+
</Accordion.Label>
|
|
91
|
+
</Accordion.Trigger>
|
|
92
|
+
<Accordion.Content>
|
|
93
|
+
<Text size="sm" color="secondary">
|
|
94
|
+
Review sign-in and device security preferences.
|
|
95
|
+
</Text>
|
|
96
|
+
</Accordion.Content>
|
|
97
|
+
</Accordion.Item>
|
|
98
|
+
</Accordion>
|
|
99
|
+
);
|
|
100
|
+
}
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
## Rich labels
|
|
104
|
+
|
|
105
|
+
Compose `Accordion.LeadingSlot`, `Accordion.Description`, and `Accordion.Meta` when a trigger needs more context than a title alone.
|
|
106
|
+
|
|
107
|
+
```tsx
|
|
108
|
+
import { Accordion, Icon, Text } from '@cdx-ui/components';
|
|
109
|
+
import { Notifications } from '@cdx-ui/icons';
|
|
110
|
+
|
|
111
|
+
export default function AccordionRichLabelDemo() {
|
|
112
|
+
return (
|
|
113
|
+
<Accordion
|
|
114
|
+
type="single"
|
|
115
|
+
defaultValue="notifications"
|
|
116
|
+
aria-label="Notification preferences"
|
|
117
|
+
className="w-full max-w-md"
|
|
118
|
+
>
|
|
119
|
+
<Accordion.Item value="notifications" showSeparator={false}>
|
|
120
|
+
<Accordion.Trigger>
|
|
121
|
+
<Accordion.LeadingSlot>
|
|
122
|
+
<Icon as={Notifications} />
|
|
123
|
+
</Accordion.LeadingSlot>
|
|
124
|
+
<Accordion.Label>
|
|
125
|
+
<Accordion.Title>Notifications</Accordion.Title>
|
|
126
|
+
<Accordion.Description>Manage account alerts</Accordion.Description>
|
|
127
|
+
<Accordion.Meta>3 channels enabled</Accordion.Meta>
|
|
128
|
+
</Accordion.Label>
|
|
129
|
+
</Accordion.Trigger>
|
|
130
|
+
<Accordion.Content>
|
|
131
|
+
<Text size="sm" color="secondary">
|
|
132
|
+
Choose when Forge sends push, email, and SMS notifications.
|
|
133
|
+
</Text>
|
|
134
|
+
</Accordion.Content>
|
|
135
|
+
</Accordion.Item>
|
|
136
|
+
</Accordion>
|
|
137
|
+
);
|
|
138
|
+
}
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
## Full bleed
|
|
142
|
+
|
|
143
|
+
Set `fullBleed` on items nested in an already-padded surface to avoid a second horizontal inset. Here the payment summary, Accordion details, and card action all align to the Card's shared gutter.
|
|
144
|
+
|
|
145
|
+
```tsx
|
|
146
|
+
import {
|
|
147
|
+
Accordion,
|
|
148
|
+
Button,
|
|
149
|
+
Card,
|
|
150
|
+
Chip,
|
|
151
|
+
Divider,
|
|
152
|
+
Heading,
|
|
153
|
+
HStack,
|
|
154
|
+
Icon,
|
|
155
|
+
Text,
|
|
156
|
+
VStack,
|
|
157
|
+
} from '@cdx-ui/components';
|
|
158
|
+
import { AccountBalance, ReceiptLong } from '@cdx-ui/icons';
|
|
159
|
+
|
|
160
|
+
export default function AccordionFullBleedDemo() {
|
|
161
|
+
return (
|
|
162
|
+
<Card className="w-full max-w-md">
|
|
163
|
+
<Card.Header>
|
|
164
|
+
<VStack space="xs">
|
|
165
|
+
<Text size="sm" color="secondary">
|
|
166
|
+
Upcoming payment
|
|
167
|
+
</Text>
|
|
168
|
+
<Heading size="sm">Visa Platinum · 0275</Heading>
|
|
169
|
+
</VStack>
|
|
170
|
+
<Chip color="success" size="small">
|
|
171
|
+
<Chip.Label>AutoPay on</Chip.Label>
|
|
172
|
+
</Chip>
|
|
173
|
+
</Card.Header>
|
|
174
|
+
<Card.Content>
|
|
175
|
+
<VStack space="lg">
|
|
176
|
+
<VStack space="xs">
|
|
177
|
+
<Text size="sm" color="secondary">
|
|
178
|
+
Statement balance
|
|
179
|
+
</Text>
|
|
180
|
+
<Text size="xl" weight="semibold">
|
|
181
|
+
$842.17
|
|
182
|
+
</Text>
|
|
183
|
+
<Text size="sm" color="secondary">
|
|
184
|
+
Due September 18
|
|
185
|
+
</Text>
|
|
186
|
+
</VStack>
|
|
187
|
+
<Divider />
|
|
188
|
+
<Accordion type="single" defaultValue="breakdown" aria-label="Payment details">
|
|
189
|
+
<Accordion.Item value="breakdown" fullBleed>
|
|
190
|
+
<Accordion.Trigger>
|
|
191
|
+
<Accordion.LeadingSlot>
|
|
192
|
+
<Icon as={ReceiptLong} />
|
|
193
|
+
</Accordion.LeadingSlot>
|
|
194
|
+
<Accordion.Label>
|
|
195
|
+
<Accordion.Title>Payment breakdown</Accordion.Title>
|
|
196
|
+
<Accordion.Description>How the amount was calculated</Accordion.Description>
|
|
197
|
+
</Accordion.Label>
|
|
198
|
+
</Accordion.Trigger>
|
|
199
|
+
<Accordion.Content>
|
|
200
|
+
<VStack space="sm">
|
|
201
|
+
<HStack space="lg" className="justify-between">
|
|
202
|
+
<Text size="sm" color="secondary">
|
|
203
|
+
Purchases
|
|
204
|
+
</Text>
|
|
205
|
+
<Text size="sm">$796.42</Text>
|
|
206
|
+
</HStack>
|
|
207
|
+
<HStack space="lg" className="justify-between">
|
|
208
|
+
<Text size="sm" color="secondary">
|
|
209
|
+
Interest
|
|
210
|
+
</Text>
|
|
211
|
+
<Text size="sm">$34.75</Text>
|
|
212
|
+
</HStack>
|
|
213
|
+
<HStack space="lg" className="justify-between">
|
|
214
|
+
<Text size="sm" color="secondary">
|
|
215
|
+
Fees
|
|
216
|
+
</Text>
|
|
217
|
+
<Text size="sm">$11.00</Text>
|
|
218
|
+
</HStack>
|
|
219
|
+
</VStack>
|
|
220
|
+
</Accordion.Content>
|
|
221
|
+
</Accordion.Item>
|
|
222
|
+
<Accordion.Item value="account" fullBleed showSeparator={false}>
|
|
223
|
+
<Accordion.Trigger>
|
|
224
|
+
<Accordion.LeadingSlot>
|
|
225
|
+
<Icon as={AccountBalance} />
|
|
226
|
+
</Accordion.LeadingSlot>
|
|
227
|
+
<Accordion.Label>
|
|
228
|
+
<Accordion.Title>Payment account</Accordion.Title>
|
|
229
|
+
<Accordion.Description>Joint Checking · 4821</Accordion.Description>
|
|
230
|
+
</Accordion.Label>
|
|
231
|
+
</Accordion.Trigger>
|
|
232
|
+
<Accordion.Content>
|
|
233
|
+
<HStack space="lg" className="justify-between">
|
|
234
|
+
<Text size="sm" color="secondary">
|
|
235
|
+
Available balance
|
|
236
|
+
</Text>
|
|
237
|
+
<Text size="sm">$4,250.18</Text>
|
|
238
|
+
</HStack>
|
|
239
|
+
</Accordion.Content>
|
|
240
|
+
</Accordion.Item>
|
|
241
|
+
</Accordion>
|
|
242
|
+
</VStack>
|
|
243
|
+
</Card.Content>
|
|
244
|
+
<Card.Footer>
|
|
245
|
+
<Button fullWidth>
|
|
246
|
+
<Button.Label>Review payment</Button.Label>
|
|
247
|
+
</Button>
|
|
248
|
+
</Card.Footer>
|
|
249
|
+
</Card>
|
|
250
|
+
);
|
|
251
|
+
}
|
|
252
|
+
```
|
|
253
|
+
|
|
254
|
+
## Indicator overrides
|
|
255
|
+
|
|
256
|
+
Pass an `indicator` to `Accordion.Trigger` to replace the default chevron, or pass `null` to suppress it.
|
|
257
|
+
|
|
258
|
+
```tsx
|
|
259
|
+
import { Accordion, Icon, Text } from '@cdx-ui/components';
|
|
260
|
+
import { Hexagon } from '@cdx-ui/icons';
|
|
261
|
+
|
|
262
|
+
export default function AccordionIndicatorOverridesDemo() {
|
|
263
|
+
return (
|
|
264
|
+
<Accordion
|
|
265
|
+
type="multiple"
|
|
266
|
+
defaultValue={['custom', 'hidden']}
|
|
267
|
+
aria-label="Indicator options"
|
|
268
|
+
className="w-full max-w-md"
|
|
269
|
+
>
|
|
270
|
+
<Accordion.Item value="custom">
|
|
271
|
+
<Accordion.Trigger
|
|
272
|
+
indicator={
|
|
273
|
+
<Accordion.Indicator>
|
|
274
|
+
<Icon as={Hexagon} />
|
|
275
|
+
</Accordion.Indicator>
|
|
276
|
+
}
|
|
277
|
+
>
|
|
278
|
+
<Accordion.Label>
|
|
279
|
+
<Accordion.Title>Custom indicator</Accordion.Title>
|
|
280
|
+
</Accordion.Label>
|
|
281
|
+
</Accordion.Trigger>
|
|
282
|
+
<Accordion.Content>
|
|
283
|
+
<Text size="sm" color="secondary">
|
|
284
|
+
Replace the default chevron with another visual.
|
|
285
|
+
</Text>
|
|
286
|
+
</Accordion.Content>
|
|
287
|
+
</Accordion.Item>
|
|
288
|
+
<Accordion.Item value="hidden" showSeparator={false}>
|
|
289
|
+
<Accordion.Trigger indicator={null}>
|
|
290
|
+
<Accordion.Label>
|
|
291
|
+
<Accordion.Title>No indicator</Accordion.Title>
|
|
292
|
+
</Accordion.Label>
|
|
293
|
+
</Accordion.Trigger>
|
|
294
|
+
<Accordion.Content>
|
|
295
|
+
<Text size="sm" color="secondary">
|
|
296
|
+
Pass null when the surrounding design provides the open-state affordance.
|
|
297
|
+
</Text>
|
|
298
|
+
</Accordion.Content>
|
|
299
|
+
</Accordion.Item>
|
|
300
|
+
</Accordion>
|
|
301
|
+
);
|
|
302
|
+
}
|
|
303
|
+
```
|
|
304
|
+
|
|
305
|
+
## Disabled
|
|
306
|
+
|
|
307
|
+
Set `disabled` on an item, or `isDisabled` on `Accordion` to disable the entire group.
|
|
308
|
+
|
|
309
|
+
```tsx
|
|
310
|
+
import { Accordion, Text } from '@cdx-ui/components';
|
|
311
|
+
|
|
312
|
+
export default function AccordionDisabledDemo() {
|
|
313
|
+
return (
|
|
314
|
+
<Accordion
|
|
315
|
+
type="single"
|
|
316
|
+
defaultValue="enabled"
|
|
317
|
+
aria-label="Account options"
|
|
318
|
+
className="w-full max-w-md"
|
|
319
|
+
>
|
|
320
|
+
<Accordion.Item value="enabled">
|
|
321
|
+
<Accordion.Trigger>
|
|
322
|
+
<Accordion.Label>
|
|
323
|
+
<Accordion.Title>Enabled option</Accordion.Title>
|
|
324
|
+
</Accordion.Label>
|
|
325
|
+
</Accordion.Trigger>
|
|
326
|
+
<Accordion.Content>
|
|
327
|
+
<Text size="sm" color="secondary">
|
|
328
|
+
This item can be opened and closed.
|
|
329
|
+
</Text>
|
|
330
|
+
</Accordion.Content>
|
|
331
|
+
</Accordion.Item>
|
|
332
|
+
<Accordion.Item value="disabled" disabled showSeparator={false}>
|
|
333
|
+
<Accordion.Trigger>
|
|
334
|
+
<Accordion.Label>
|
|
335
|
+
<Accordion.Title>Unavailable option</Accordion.Title>
|
|
336
|
+
</Accordion.Label>
|
|
337
|
+
</Accordion.Trigger>
|
|
338
|
+
<Accordion.Content>
|
|
339
|
+
<Text size="sm" color="secondary">
|
|
340
|
+
Disabled content cannot be opened.
|
|
341
|
+
</Text>
|
|
342
|
+
</Accordion.Content>
|
|
343
|
+
</Accordion.Item>
|
|
344
|
+
</Accordion>
|
|
345
|
+
);
|
|
346
|
+
}
|
|
347
|
+
```
|
|
348
|
+
|
|
349
|
+
## API
|
|
350
|
+
|
|
351
|
+
### Accordion
|
|
352
|
+
|
|
353
|
+
Root container that manages the open item value or values. The `type` discriminant determines the controlled and uncontrolled value shape.
|
|
354
|
+
|
|
355
|
+
| Prop | Type | Default | Description |
|
|
356
|
+
| --- | --- | --- | --- |
|
|
357
|
+
| `className?` | `string` | — | — |
|
|
358
|
+
| `children?` | `ReactNode` | — | — |
|
|
359
|
+
| `type?` | `'single' \| 'multiple'` | — | — |
|
|
360
|
+
| `value?` | `string \| string[]` | — | — |
|
|
361
|
+
| `defaultValue?` | `string \| string[]` | — | — |
|
|
362
|
+
| `onValueChange?` | `((value: string) => void) \| ((value: string[]) => void)` | — | — |
|
|
363
|
+
| `collapsible?` | `boolean` | — | — |
|
|
364
|
+
| `isDisabled?` | `boolean` | — | — |
|
|
365
|
+
| `asChild?` | `boolean` | — | — |
|
|
366
|
+
|
|
367
|
+
Inherits all [`ViewProps`](https://reactnative.dev/docs/view#props). Single mode uses `string | undefined`; multiple mode uses `string[]`. `collapsible` applies only to single mode.
|
|
368
|
+
|
|
369
|
+
| Attribute | Values | Description |
|
|
370
|
+
| ----------- | ----------- | -------------- |
|
|
371
|
+
| `data-slot` | `accordion` | Root container |
|
|
372
|
+
|
|
373
|
+
## Sub-components
|
|
374
|
+
|
|
375
|
+
### Accordion.Item
|
|
376
|
+
|
|
377
|
+
One disclosure item. Requires a unique `value`; `fullBleed` and `showSeparator` control its layout.
|
|
378
|
+
|
|
379
|
+
| Prop | Type | Default | Description |
|
|
380
|
+
| --- | --- | --- | --- |
|
|
381
|
+
| `className?` | `string` | — | — |
|
|
382
|
+
| `children?` | `ReactNode` | — | — |
|
|
383
|
+
| `asChild?` | `boolean` | — | — |
|
|
384
|
+
| `fullBleed?` | `boolean` | `false` | Removes horizontal padding so trigger and content can render edge to edge. |
|
|
385
|
+
| `showSeparator?` | `boolean` | `true` | Renders a separator below the item when true. |
|
|
386
|
+
| `value` | `string` | — | Required stable id within the Accordion. |
|
|
387
|
+
| `disabled?` | `boolean` | — | — |
|
|
388
|
+
|
|
389
|
+
Inherits all [`ViewProps`](https://reactnative.dev/docs/view#props).
|
|
390
|
+
|
|
391
|
+
| Attribute | Values | Description |
|
|
392
|
+
| --------------- | ------------------ | -------------------------------------- |
|
|
393
|
+
| `data-slot` | `accordion-item` | Item container |
|
|
394
|
+
| `data-state` | `open` \| `closed` | Disclosure state |
|
|
395
|
+
| `data-disabled` | `true` \| `false` | Effective item or group disabled state |
|
|
396
|
+
|
|
397
|
+
### Accordion.Trigger
|
|
398
|
+
|
|
399
|
+
Pressable header control that toggles its item. It renders the default chevron unless `indicator` replaces or suppresses it.
|
|
400
|
+
|
|
401
|
+
| Prop | Type | Default | Description |
|
|
402
|
+
| --- | --- | --- | --- |
|
|
403
|
+
| `className?` | `string` | — | — |
|
|
404
|
+
| `children?` | `ReactNode` | — | Either children or a render prop that receives a boolean reflecting whether the component is currently pressed. |
|
|
405
|
+
| `asChild?` | `boolean` | — | Substitute the rendered trigger element with the single child. The child must be another Forge primitive (IconButton, Chip, Button) — anything whose underlying Pressable accepts Pressable-shaped handlers. When set, the auto-injected expand indicator is skipped and `accordionTriggerVariants` is not applied so the substituted component's own appearance wins. |
|
|
406
|
+
| `indicator?` | `ReactNode` | — | Replaces the default open/closed chevron. Pass `null` to suppress the indicator. When `asChild` is set, only an explicitly provided indicator is appended to the substituted child. |
|
|
407
|
+
|
|
408
|
+
Inherits all [`PressableProps`](https://reactnative.dev/docs/pressable#props) (including `onPress`).
|
|
409
|
+
|
|
410
|
+
| Attribute | Values | Description |
|
|
411
|
+
| -------------------- | ------------------- | ------------------------- |
|
|
412
|
+
| `data-slot` | `accordion-trigger` | Trigger pressable |
|
|
413
|
+
| `data-state` | `open` \| `closed` | Disclosure state |
|
|
414
|
+
| `data-disabled` | `true` \| `false` | Effective disabled state |
|
|
415
|
+
| `data-hover` | `true` \| `false` | Pointer hover state |
|
|
416
|
+
| `data-active` | `true` \| `false` | Pressed state |
|
|
417
|
+
| `data-focus-visible` | `true` \| `false` | Keyboard focus-ring state |
|
|
418
|
+
|
|
419
|
+
### Accordion.LeadingSlot
|
|
420
|
+
|
|
421
|
+
Optional leading adornment such as an icon, avatar, or badge. Decorative content is hidden from the accessibility tree by default.
|
|
422
|
+
|
|
423
|
+
| Prop | Type | Default | Description |
|
|
424
|
+
| --- | --- | --- | --- |
|
|
425
|
+
| `className?` | `string` | — | — |
|
|
426
|
+
| `children?` | `ReactNode` | — | — |
|
|
427
|
+
| `asChild?` | `boolean` | — | — |
|
|
428
|
+
|
|
429
|
+
Inherits all [`ViewProps`](https://reactnative.dev/docs/view#props).
|
|
430
|
+
|
|
431
|
+
### Accordion.Label
|
|
432
|
+
|
|
433
|
+
Flexible column for `Accordion.Title`, `Accordion.Description`, and `Accordion.Meta`.
|
|
434
|
+
|
|
435
|
+
| Prop | Type | Default | Description |
|
|
436
|
+
| --- | --- | --- | --- |
|
|
437
|
+
| `className?` | `string` | — | — |
|
|
438
|
+
| `children?` | `ReactNode` | — | — |
|
|
439
|
+
| `asChild?` | `boolean` | — | — |
|
|
440
|
+
|
|
441
|
+
Inherits all [`ViewProps`](https://reactnative.dev/docs/view#props).
|
|
442
|
+
|
|
443
|
+
### Accordion.Title
|
|
444
|
+
|
|
445
|
+
Primary trigger label.
|
|
446
|
+
|
|
447
|
+
| Prop | Type | Default | Description |
|
|
448
|
+
| --- | --- | --- | --- |
|
|
449
|
+
| `className?` | `string` | — | — |
|
|
450
|
+
| `children?` | `ReactNode` | — | — |
|
|
451
|
+
| `asChild?` | `boolean` | — | — |
|
|
452
|
+
|
|
453
|
+
Inherits all [`TextProps`](https://reactnative.dev/docs/text#props).
|
|
454
|
+
|
|
455
|
+
### Accordion.Description
|
|
456
|
+
|
|
457
|
+
Supporting text displayed below the title.
|
|
458
|
+
|
|
459
|
+
| Prop | Type | Default | Description |
|
|
460
|
+
| --- | --- | --- | --- |
|
|
461
|
+
| `className?` | `string` | — | — |
|
|
462
|
+
| `children?` | `ReactNode` | — | — |
|
|
463
|
+
| `asChild?` | `boolean` | — | — |
|
|
464
|
+
|
|
465
|
+
Inherits all [`TextProps`](https://reactnative.dev/docs/text#props).
|
|
466
|
+
|
|
467
|
+
### Accordion.Meta
|
|
468
|
+
|
|
469
|
+
Tertiary trigger metadata displayed below the description.
|
|
470
|
+
|
|
471
|
+
| Prop | Type | Default | Description |
|
|
472
|
+
| --- | --- | --- | --- |
|
|
473
|
+
| `className?` | `string` | — | — |
|
|
474
|
+
| `children?` | `ReactNode` | — | — |
|
|
475
|
+
| `asChild?` | `boolean` | — | — |
|
|
476
|
+
|
|
477
|
+
Inherits all [`TextProps`](https://reactnative.dev/docs/text#props).
|
|
478
|
+
|
|
479
|
+
### Accordion.Indicator
|
|
480
|
+
|
|
481
|
+
Visual open-state affordance. It renders `KeyboardArrowDown` by default and rotates while open; compose custom children to replace the glyph.
|
|
482
|
+
|
|
483
|
+
| Prop | Type | Default | Description |
|
|
484
|
+
| --- | --- | --- | --- |
|
|
485
|
+
| `className?` | `string` | — | — |
|
|
486
|
+
| `children?` | `ReactNode` | — | — |
|
|
487
|
+
| `asChild?` | `boolean` | — | — |
|
|
488
|
+
|
|
489
|
+
Inherits all [`ViewProps`](https://reactnative.dev/docs/view#props).
|
|
490
|
+
|
|
491
|
+
| Attribute | Values | Description |
|
|
492
|
+
| ------------ | --------------------- | ------------------- |
|
|
493
|
+
| `data-slot` | `accordion-indicator` | Indicator container |
|
|
494
|
+
| `data-state` | `open` \| `closed` | Disclosure state |
|
|
495
|
+
|
|
496
|
+
### Accordion.Content
|
|
497
|
+
|
|
498
|
+
Revealed content associated with its trigger. It is not mounted while the item is closed.
|
|
499
|
+
|
|
500
|
+
| Prop | Type | Default | Description |
|
|
501
|
+
| --- | --- | --- | --- |
|
|
502
|
+
| `className?` | `string` | — | — |
|
|
503
|
+
| `children?` | `ReactNode` | — | — |
|
|
504
|
+
| `asChild?` | `boolean` | — | — |
|
|
505
|
+
|
|
506
|
+
Inherits all [`ViewProps`](https://reactnative.dev/docs/view#props).
|
|
507
|
+
|
|
508
|
+
| Attribute | Values | Description |
|
|
509
|
+
| ------------ | ------------------- | ----------------------- |
|
|
510
|
+
| `data-slot` | `accordion-content` | Revealed content region |
|
|
511
|
+
| `data-state` | `open` | Present while mounted |
|
|
512
|
+
|
|
513
|
+
## Anatomy
|
|
514
|
+
|
|
515
|
+
| `data-slot` | Element |
|
|
516
|
+
| ----------------------- | ----------------------- |
|
|
517
|
+
| `accordion` | Root container |
|
|
518
|
+
| `accordion-item` | Disclosure item |
|
|
519
|
+
| `accordion-trigger` | Trigger pressable |
|
|
520
|
+
| `accordion-leading` | Leading adornment |
|
|
521
|
+
| `accordion-label` | Trigger text stack |
|
|
522
|
+
| `accordion-title` | Primary label |
|
|
523
|
+
| `accordion-description` | Supporting label |
|
|
524
|
+
| `accordion-meta` | Tertiary metadata |
|
|
525
|
+
| `accordion-indicator` | Open-state affordance |
|
|
526
|
+
| `accordion-content` | Revealed content region |
|
|
527
|
+
|
|
528
|
+
## Accessibility
|
|
529
|
+
|
|
530
|
+
| Attribute | Behavior |
|
|
531
|
+
| --------------------- | ---------------------------------------------------------------------------------- |
|
|
532
|
+
| **Role** | Each `Accordion.Trigger` is a button. Open content is exposed as a region on web. |
|
|
533
|
+
| **Expanded state** | `aria-expanded` / `accessibilityState.expanded` reflects whether the item is open. |
|
|
534
|
+
| **Relationship** | `aria-controls` links the trigger to Content; Content is labelled by its trigger. |
|
|
535
|
+
| **Keyboard** | Focus triggers with Tab and toggle them with Enter or Space. |
|
|
536
|
+
| **Disabled** | `disabled` prevents one item from toggling; root `isDisabled` disables every item. |
|
|
537
|
+
| **Leading content** | `Accordion.LeadingSlot` is hidden from the accessibility tree by default. |
|
|
538
|
+
| **Content lifecycle** | Closed content is unmounted and therefore absent from the accessibility tree. |
|