@cdx-ui/components 0.2.2 → 0.2.4
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 +6 -2
- 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 +235 -0
- package/docs/components/bottom-sheet/content.md +351 -0
- package/docs/components/bottom-sheet/design.md +249 -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 +416 -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 +86 -0
- package/docs/components/color-field/content.md +134 -0
- package/docs/components/color-picker/content.md +208 -0
- package/docs/components/color-slider/content.md +120 -0
- package/docs/components/color-swatch/content.md +64 -0
- package/docs/components/color-swatch-picker/content.md +126 -0
- package/docs/components/content.md +97 -0
- package/docs/components/currency-input/content.md +205 -0
- package/docs/components/data-grid/content.md +522 -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 +436 -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 +281 -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 +1247 -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 +309 -0
- package/docs/components/scoped-theme/content.md +47 -0
- package/docs/components/scroll-shadow/content.md +686 -0
- package/docs/components/select/content.md +400 -0
- package/docs/components/select/design.md +301 -0
- package/docs/components/skeleton/content.md +103 -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 +292 -0
- package/docs/components/text/content.md +142 -0
- package/docs/components/textarea/content.md +222 -0
- package/docs/components/tile/content.md +703 -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 +193 -0
- package/docs/llms.txt +193 -0
- package/docs/patterns/account-management/content.md +75 -0
- package/docs/patterns/authentication/content.md +52 -0
- package/docs/patterns/content.md +10 -0
- package/docs/patterns/dashboard/content.md +39 -0
- package/docs/patterns/empty-states/content.md +31 -0
- package/docs/patterns/forms/content.md +109 -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/content.md +64 -0
- package/lib/commonjs/components/Checkbox/index.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/Heading/index.js.map +1 -1
- package/lib/commonjs/components/Icon/index.js.map +1 -1
- package/lib/commonjs/components/ListItem/index.js +170 -9
- package/lib/commonjs/components/ListItem/index.js.map +1 -1
- package/lib/commonjs/components/ListItem/styles.js +38 -2
- 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/RangeCalendar/index.js.map +1 -1
- package/lib/commonjs/components/ReorderableList/ReorderableListShared.js +91 -0
- package/lib/commonjs/components/ReorderableList/ReorderableListShared.js.map +1 -0
- package/lib/commonjs/components/ReorderableList/index.js +135 -0
- package/lib/commonjs/components/ReorderableList/index.js.map +1 -0
- package/lib/commonjs/components/ReorderableList/index.web.js +233 -0
- package/lib/commonjs/components/ReorderableList/index.web.js.map +1 -0
- package/lib/commonjs/components/ReorderableList/labels.js +47 -0
- package/lib/commonjs/components/ReorderableList/labels.js.map +1 -0
- package/lib/commonjs/components/ReorderableList/reorderItems.js +16 -0
- package/lib/commonjs/components/ReorderableList/reorderItems.js.map +1 -0
- package/lib/commonjs/components/ReorderableList/rowContext.js +42 -0
- package/lib/commonjs/components/ReorderableList/rowContext.js.map +1 -0
- package/lib/commonjs/components/ReorderableList/types.js +6 -0
- package/lib/commonjs/components/ReorderableList/types.js.map +1 -0
- package/lib/commonjs/components/ReorderableList/useReorder.js +131 -0
- package/lib/commonjs/components/ReorderableList/useReorder.js.map +1 -0
- package/lib/commonjs/components/ReorderableList/webDnd.js +64 -0
- package/lib/commonjs/components/ReorderableList/webDnd.js.map +1 -0
- package/lib/commonjs/components/ScopedTheme/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/Skeleton/index.js.map +1 -1
- package/lib/commonjs/components/TablePagination/index.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/components/Text/index.js.map +1 -1
- package/lib/commonjs/components/Tile/styles.js +1 -1
- package/lib/commonjs/components/Tile/styles.js.map +1 -1
- package/lib/commonjs/components/index.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/reorderable-list.js +17 -0
- package/lib/commonjs/reorderable-list.js.map +1 -0
- package/lib/module/components/Checkbox/index.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/Heading/index.js.map +1 -1
- package/lib/module/components/Icon/index.js.map +1 -1
- package/lib/module/components/ListItem/index.js +163 -14
- package/lib/module/components/ListItem/index.js.map +1 -1
- package/lib/module/components/ListItem/styles.js +37 -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/RangeCalendar/index.js.map +1 -1
- package/lib/module/components/ReorderableList/ReorderableListShared.js +86 -0
- package/lib/module/components/ReorderableList/ReorderableListShared.js.map +1 -0
- package/lib/module/components/ReorderableList/index.js +130 -0
- package/lib/module/components/ReorderableList/index.js.map +1 -0
- package/lib/module/components/ReorderableList/index.web.js +229 -0
- package/lib/module/components/ReorderableList/index.web.js.map +1 -0
- package/lib/module/components/ReorderableList/labels.js +41 -0
- package/lib/module/components/ReorderableList/labels.js.map +1 -0
- package/lib/module/components/ReorderableList/reorderItems.js +12 -0
- package/lib/module/components/ReorderableList/reorderItems.js.map +1 -0
- package/lib/module/components/ReorderableList/rowContext.js +38 -0
- package/lib/module/components/ReorderableList/rowContext.js.map +1 -0
- package/lib/module/components/ReorderableList/types.js +4 -0
- package/lib/module/components/ReorderableList/types.js.map +1 -0
- package/lib/module/components/ReorderableList/useReorder.js +123 -0
- package/lib/module/components/ReorderableList/useReorder.js.map +1 -0
- package/lib/module/components/ReorderableList/webDnd.js +59 -0
- package/lib/module/components/ReorderableList/webDnd.js.map +1 -0
- package/lib/module/components/ScopedTheme/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/Skeleton/index.js.map +1 -1
- package/lib/module/components/TablePagination/index.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/components/Text/index.js.map +1 -1
- package/lib/module/components/Tile/styles.js +1 -1
- package/lib/module/components/Tile/styles.js.map +1 -1
- package/lib/module/components/index.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/reorderable-list.js +4 -0
- package/lib/module/reorderable-list.js.map +1 -0
- package/lib/typescript/components/Checkbox/index.d.ts +22 -0
- package/lib/typescript/components/Checkbox/index.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/Heading/index.d.ts +20 -2
- package/lib/typescript/components/Heading/index.d.ts.map +1 -1
- package/lib/typescript/components/Icon/index.d.ts +2 -0
- package/lib/typescript/components/Icon/index.d.ts.map +1 -1
- package/lib/typescript/components/ListItem/index.d.ts +28 -5
- package/lib/typescript/components/ListItem/index.d.ts.map +1 -1
- package/lib/typescript/components/ListItem/styles.d.ts +6 -1
- package/lib/typescript/components/ListItem/styles.d.ts.map +1 -1
- package/lib/typescript/components/Menu/index.d.ts +116 -4
- package/lib/typescript/components/Menu/index.d.ts.map +1 -1
- package/lib/typescript/components/RangeCalendar/index.d.ts +2 -0
- package/lib/typescript/components/RangeCalendar/index.d.ts.map +1 -1
- package/lib/typescript/components/ReorderableList/ReorderableListShared.d.ts +31 -0
- package/lib/typescript/components/ReorderableList/ReorderableListShared.d.ts.map +1 -0
- package/lib/typescript/components/ReorderableList/index.d.ts +8 -0
- package/lib/typescript/components/ReorderableList/index.d.ts.map +1 -0
- package/lib/typescript/components/ReorderableList/index.web.d.ts +8 -0
- package/lib/typescript/components/ReorderableList/index.web.d.ts.map +1 -0
- package/lib/typescript/components/ReorderableList/labels.d.ts +16 -0
- package/lib/typescript/components/ReorderableList/labels.d.ts.map +1 -0
- package/lib/typescript/components/ReorderableList/reorderItems.d.ts +3 -0
- package/lib/typescript/components/ReorderableList/reorderItems.d.ts.map +1 -0
- package/lib/typescript/components/ReorderableList/rowContext.d.ts +57 -0
- package/lib/typescript/components/ReorderableList/rowContext.d.ts.map +1 -0
- package/lib/typescript/components/ReorderableList/types.d.ts +75 -0
- package/lib/typescript/components/ReorderableList/types.d.ts.map +1 -0
- package/lib/typescript/components/ReorderableList/useReorder.d.ts +31 -0
- package/lib/typescript/components/ReorderableList/useReorder.d.ts.map +1 -0
- package/lib/typescript/components/ReorderableList/webDnd.d.ts +27 -0
- package/lib/typescript/components/ReorderableList/webDnd.d.ts.map +1 -0
- package/lib/typescript/components/ScopedTheme/index.d.ts +6 -1
- package/lib/typescript/components/ScopedTheme/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/Skeleton/index.d.ts +3 -0
- package/lib/typescript/components/Skeleton/index.d.ts.map +1 -1
- package/lib/typescript/components/TablePagination/index.d.ts +54 -0
- package/lib/typescript/components/TablePagination/index.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/Text/index.d.ts +12 -2
- package/lib/typescript/components/Text/index.d.ts.map +1 -1
- package/lib/typescript/components/Tile/styles.d.ts.map +1 -1
- package/lib/typescript/components/ToggleButton/styles.d.ts +1 -1
- package/lib/typescript/components/index.d.ts +1 -0
- package/lib/typescript/components/index.d.ts.map +1 -1
- package/lib/typescript/figma/ListItem.SectionHeader.figma.d.ts.map +1 -1
- package/lib/typescript/reorderable-list.d.ts +2 -0
- package/lib/typescript/reorderable-list.d.ts.map +1 -0
- package/package.json +37 -8
- package/src/components/Checkbox/index.tsx +22 -0
- package/src/components/DateTimeList/index.tsx +13 -26
- package/src/components/DateTimeList/styles.ts +1 -10
- package/src/components/Heading/index.tsx +10 -1
- package/src/components/Icon/index.tsx +2 -0
- package/src/components/ListItem/index.tsx +232 -15
- package/src/components/ListItem/styles.ts +41 -0
- package/src/components/Menu/index.tsx +128 -12
- package/src/components/RangeCalendar/index.tsx +2 -0
- package/src/components/ReorderableList/ReorderableListShared.tsx +113 -0
- package/src/components/ReorderableList/index.tsx +162 -0
- package/src/components/ReorderableList/index.web.tsx +254 -0
- package/src/components/ReorderableList/labels.ts +52 -0
- package/src/components/ReorderableList/reorderItems.ts +16 -0
- package/src/components/ReorderableList/rowContext.tsx +72 -0
- package/src/components/ReorderableList/types.ts +80 -0
- package/src/components/ReorderableList/useReorder.ts +159 -0
- package/src/components/ReorderableList/webDnd.ts +60 -0
- package/src/components/ScopedTheme/index.tsx +6 -1
- 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/Skeleton/index.tsx +3 -0
- package/src/components/TablePagination/index.tsx +54 -0
- package/src/components/Tabs/index.tsx +25 -35
- package/src/components/Tabs/styles.ts +0 -9
- package/src/components/Text/index.tsx +6 -1
- package/src/components/Tile/styles.ts +4 -1
- package/src/components/index.ts +5 -0
- package/src/reorderable-list.ts +1 -0
|
@@ -0,0 +1,398 @@
|
|
|
1
|
+
# Button (https://design.candescent.com/docs/components/button)
|
|
2
|
+
|
|
3
|
+
Resources: [Figma](https://www.figma.com/design/0lEVMVlLj8ZS4fgItr3pmd/%E2%AD%90-Forge-DS--React-Native-Components?node-id=119-72), [Storybook](https://victorious-wave-0daadf00f.6.azurestaticapps.net/?path=/story/actions-button--default)
|
|
4
|
+
|
|
5
|
+
A compound component with sub-components for label, icon, spinner, and grouping.
|
|
6
|
+
|
|
7
|
+
```tsx
|
|
8
|
+
import { Button } from '@cdx-ui/components';
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Variants
|
|
12
|
+
|
|
13
|
+
```tsx
|
|
14
|
+
import { Button, Box } from '@cdx-ui/components';
|
|
15
|
+
|
|
16
|
+
export default function ButtonVariantsDemo() {
|
|
17
|
+
return (
|
|
18
|
+
<Box className="flex-row gap-4">
|
|
19
|
+
<Button variant="solid">
|
|
20
|
+
<Button.Label>Solid</Button.Label>
|
|
21
|
+
</Button>
|
|
22
|
+
<Button variant="outline">
|
|
23
|
+
<Button.Label>Outline</Button.Label>
|
|
24
|
+
</Button>
|
|
25
|
+
<Button variant="ghost">
|
|
26
|
+
<Button.Label>Ghost</Button.Label>
|
|
27
|
+
</Button>
|
|
28
|
+
</Box>
|
|
29
|
+
);
|
|
30
|
+
}
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
### Solid
|
|
34
|
+
|
|
35
|
+
```tsx
|
|
36
|
+
import { Button, Box } from '@cdx-ui/components';
|
|
37
|
+
|
|
38
|
+
export default function ButtonSolidDemo() {
|
|
39
|
+
return (
|
|
40
|
+
<Box className="flex-row gap-4">
|
|
41
|
+
<Button variant="solid" color="action">
|
|
42
|
+
<Button.Label>Action</Button.Label>
|
|
43
|
+
</Button>
|
|
44
|
+
<Button variant="solid" color="danger">
|
|
45
|
+
<Button.Label>Danger</Button.Label>
|
|
46
|
+
</Button>
|
|
47
|
+
<Button variant="solid" color="warning">
|
|
48
|
+
<Button.Label>Warning</Button.Label>
|
|
49
|
+
</Button>
|
|
50
|
+
<Button variant="solid" color="success">
|
|
51
|
+
<Button.Label>Success</Button.Label>
|
|
52
|
+
</Button>
|
|
53
|
+
<Button variant="solid" color="info">
|
|
54
|
+
<Button.Label>Info</Button.Label>
|
|
55
|
+
</Button>
|
|
56
|
+
</Box>
|
|
57
|
+
);
|
|
58
|
+
}
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
### Outline
|
|
62
|
+
|
|
63
|
+
```tsx
|
|
64
|
+
import { Button, Box } from '@cdx-ui/components';
|
|
65
|
+
|
|
66
|
+
export default function ButtonOutlineDemo() {
|
|
67
|
+
return (
|
|
68
|
+
<Box className="flex-row gap-4">
|
|
69
|
+
<Button variant="outline" color="action">
|
|
70
|
+
<Button.Label>Action</Button.Label>
|
|
71
|
+
</Button>
|
|
72
|
+
<Button variant="outline" color="danger">
|
|
73
|
+
<Button.Label>Danger</Button.Label>
|
|
74
|
+
</Button>
|
|
75
|
+
<Button variant="outline" color="warning">
|
|
76
|
+
<Button.Label>Warning</Button.Label>
|
|
77
|
+
</Button>
|
|
78
|
+
<Button variant="outline" color="success">
|
|
79
|
+
<Button.Label>Success</Button.Label>
|
|
80
|
+
</Button>
|
|
81
|
+
<Button variant="outline" color="info">
|
|
82
|
+
<Button.Label>Info</Button.Label>
|
|
83
|
+
</Button>
|
|
84
|
+
</Box>
|
|
85
|
+
);
|
|
86
|
+
}
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
### Ghost
|
|
90
|
+
|
|
91
|
+
```tsx
|
|
92
|
+
import { Button, Box } from '@cdx-ui/components';
|
|
93
|
+
|
|
94
|
+
export default function ButtonGhostDemo() {
|
|
95
|
+
return (
|
|
96
|
+
<Box className="flex-row gap-4">
|
|
97
|
+
<Button variant="ghost" color="action">
|
|
98
|
+
<Button.Label>Action</Button.Label>
|
|
99
|
+
</Button>
|
|
100
|
+
<Button variant="ghost" color="danger">
|
|
101
|
+
<Button.Label>Danger</Button.Label>
|
|
102
|
+
</Button>
|
|
103
|
+
<Button variant="ghost" color="warning">
|
|
104
|
+
<Button.Label>Warning</Button.Label>
|
|
105
|
+
</Button>
|
|
106
|
+
<Button variant="ghost" color="success">
|
|
107
|
+
<Button.Label>Success</Button.Label>
|
|
108
|
+
</Button>
|
|
109
|
+
<Button variant="ghost" color="info">
|
|
110
|
+
<Button.Label>Info</Button.Label>
|
|
111
|
+
</Button>
|
|
112
|
+
</Box>
|
|
113
|
+
);
|
|
114
|
+
}
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
## Sizes
|
|
118
|
+
|
|
119
|
+
```tsx
|
|
120
|
+
import { Button, Box } from '@cdx-ui/components';
|
|
121
|
+
|
|
122
|
+
export default function ButtonSizeDemo() {
|
|
123
|
+
return (
|
|
124
|
+
<Box className="flex-row gap-4">
|
|
125
|
+
<Box className="flex-col gap-4">
|
|
126
|
+
<Button variant="solid" size="default">
|
|
127
|
+
<Button.Label>Default</Button.Label>
|
|
128
|
+
</Button>
|
|
129
|
+
<Button variant="solid" size="small">
|
|
130
|
+
<Button.Label>Small</Button.Label>
|
|
131
|
+
</Button>
|
|
132
|
+
</Box>
|
|
133
|
+
<Box className="flex-col gap-4">
|
|
134
|
+
<Button variant="outline" size="default">
|
|
135
|
+
<Button.Label>Default</Button.Label>
|
|
136
|
+
</Button>
|
|
137
|
+
<Button variant="outline" size="small">
|
|
138
|
+
<Button.Label>Small</Button.Label>
|
|
139
|
+
</Button>
|
|
140
|
+
</Box>
|
|
141
|
+
<Box className="flex-col gap-4">
|
|
142
|
+
<Button variant="ghost" size="default">
|
|
143
|
+
<Button.Label>Default</Button.Label>
|
|
144
|
+
</Button>
|
|
145
|
+
<Button variant="ghost" size="small">
|
|
146
|
+
<Button.Label>Small</Button.Label>
|
|
147
|
+
</Button>
|
|
148
|
+
</Box>
|
|
149
|
+
</Box>
|
|
150
|
+
);
|
|
151
|
+
}
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
## With icons
|
|
155
|
+
|
|
156
|
+
```tsx
|
|
157
|
+
import { Button, View } from '@cdx-ui/components';
|
|
158
|
+
import { AddIcon, DeleteIcon, SendIcon } from '@cdx-ui/icons';
|
|
159
|
+
|
|
160
|
+
export default function ButtonIconsDemo() {
|
|
161
|
+
return (
|
|
162
|
+
<View className="flex-row flex-wrap gap-4">
|
|
163
|
+
<Button variant="outline">
|
|
164
|
+
<Button.Icon as={AddIcon} />
|
|
165
|
+
<Button.Label>Add</Button.Label>
|
|
166
|
+
</Button>
|
|
167
|
+
<Button color="danger">
|
|
168
|
+
<Button.Icon as={DeleteIcon} />
|
|
169
|
+
<Button.Label>Delete</Button.Label>
|
|
170
|
+
</Button>
|
|
171
|
+
<Button>
|
|
172
|
+
<Button.Label>Send</Button.Label>
|
|
173
|
+
<Button.Icon as={SendIcon} />
|
|
174
|
+
</Button>
|
|
175
|
+
</View>
|
|
176
|
+
);
|
|
177
|
+
}
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
## Loading
|
|
181
|
+
|
|
182
|
+
```tsx
|
|
183
|
+
import { Button, Box } from '@cdx-ui/components';
|
|
184
|
+
|
|
185
|
+
export default function ButtonLoadingDemo() {
|
|
186
|
+
return (
|
|
187
|
+
<Box className="flex-row flex-wrap gap-4">
|
|
188
|
+
<Button variant="solid" color="action">
|
|
189
|
+
<Button.Spinner />
|
|
190
|
+
<Button.Label>Loading</Button.Label>
|
|
191
|
+
</Button>
|
|
192
|
+
<Button variant="outline" color="action">
|
|
193
|
+
<Button.Spinner />
|
|
194
|
+
<Button.Label>Loading</Button.Label>
|
|
195
|
+
</Button>
|
|
196
|
+
<Button variant="ghost" color="action">
|
|
197
|
+
<Button.Spinner />
|
|
198
|
+
<Button.Label>Loading</Button.Label>
|
|
199
|
+
</Button>
|
|
200
|
+
</Box>
|
|
201
|
+
);
|
|
202
|
+
}
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
## Full-width
|
|
206
|
+
|
|
207
|
+
```tsx
|
|
208
|
+
import { Button, Box } from '@cdx-ui/components';
|
|
209
|
+
|
|
210
|
+
export default function ButtonFullWidthDemo() {
|
|
211
|
+
return (
|
|
212
|
+
<Box className="gap-4 w-64">
|
|
213
|
+
<Button fullWidth variant="solid">
|
|
214
|
+
<Button.Label>Submit</Button.Label>
|
|
215
|
+
</Button>
|
|
216
|
+
<Button fullWidth variant="outline">
|
|
217
|
+
<Button.Label>Delete</Button.Label>
|
|
218
|
+
</Button>
|
|
219
|
+
<Button fullWidth variant="ghost">
|
|
220
|
+
<Button.Label>Cancel</Button.Label>
|
|
221
|
+
</Button>
|
|
222
|
+
</Box>
|
|
223
|
+
);
|
|
224
|
+
}
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
## Disabled
|
|
228
|
+
|
|
229
|
+
```tsx
|
|
230
|
+
import { Button, Box } from '@cdx-ui/components';
|
|
231
|
+
|
|
232
|
+
export default function ButtonDisabledDemo() {
|
|
233
|
+
return (
|
|
234
|
+
<Box className="flex-row flex-wrap gap-4">
|
|
235
|
+
<Button variant="solid" color="action" isDisabled>
|
|
236
|
+
<Button.Label>Action</Button.Label>
|
|
237
|
+
</Button>
|
|
238
|
+
<Button variant="solid" color="danger" isDisabled>
|
|
239
|
+
<Button.Label>Danger</Button.Label>
|
|
240
|
+
</Button>
|
|
241
|
+
<Button variant="solid" color="warning" isDisabled>
|
|
242
|
+
<Button.Label>Warning</Button.Label>
|
|
243
|
+
</Button>
|
|
244
|
+
<Button variant="solid" color="success" isDisabled>
|
|
245
|
+
<Button.Label>Success</Button.Label>
|
|
246
|
+
</Button>
|
|
247
|
+
<Button variant="solid" color="info" isDisabled>
|
|
248
|
+
<Button.Label>Info</Button.Label>
|
|
249
|
+
</Button>
|
|
250
|
+
</Box>
|
|
251
|
+
);
|
|
252
|
+
}
|
|
253
|
+
```
|
|
254
|
+
|
|
255
|
+
## Group
|
|
256
|
+
|
|
257
|
+
```tsx
|
|
258
|
+
import { Button, Box } from '@cdx-ui/components';
|
|
259
|
+
|
|
260
|
+
export default function ButtonGroupDemo() {
|
|
261
|
+
return (
|
|
262
|
+
<Box className="gap-6">
|
|
263
|
+
<Button.Group>
|
|
264
|
+
<Button variant="outline">
|
|
265
|
+
<Button.Label>Left</Button.Label>
|
|
266
|
+
</Button>
|
|
267
|
+
<Button variant="outline">
|
|
268
|
+
<Button.Label>Center</Button.Label>
|
|
269
|
+
</Button>
|
|
270
|
+
<Button variant="outline">
|
|
271
|
+
<Button.Label>Right</Button.Label>
|
|
272
|
+
</Button>
|
|
273
|
+
</Button.Group>
|
|
274
|
+
|
|
275
|
+
<Button.Group isAttached>
|
|
276
|
+
<Button variant="outline">
|
|
277
|
+
<Button.Label>Left</Button.Label>
|
|
278
|
+
</Button>
|
|
279
|
+
<Button variant="outline">
|
|
280
|
+
<Button.Label>Center</Button.Label>
|
|
281
|
+
</Button>
|
|
282
|
+
<Button variant="outline">
|
|
283
|
+
<Button.Label>Right</Button.Label>
|
|
284
|
+
</Button>
|
|
285
|
+
</Button.Group>
|
|
286
|
+
|
|
287
|
+
<Button.Group isAttached flexDirection="column">
|
|
288
|
+
<Button variant="outline">
|
|
289
|
+
<Button.Label>Top</Button.Label>
|
|
290
|
+
</Button>
|
|
291
|
+
<Button variant="outline">
|
|
292
|
+
<Button.Label>Middle</Button.Label>
|
|
293
|
+
</Button>
|
|
294
|
+
<Button variant="outline">
|
|
295
|
+
<Button.Label>Bottom</Button.Label>
|
|
296
|
+
</Button>
|
|
297
|
+
</Button.Group>
|
|
298
|
+
</Box>
|
|
299
|
+
);
|
|
300
|
+
}
|
|
301
|
+
```
|
|
302
|
+
|
|
303
|
+
## As link
|
|
304
|
+
|
|
305
|
+
Use `Link` with `asChild` to merge navigation behavior onto the button.
|
|
306
|
+
|
|
307
|
+
```tsx
|
|
308
|
+
import { Button, Link } from '@cdx-ui/components';
|
|
309
|
+
|
|
310
|
+
export default function ButtonAsLinkDemo() {
|
|
311
|
+
return (
|
|
312
|
+
<Link href="https://example.com" asChild webProps={{ target: '_blank', rel: 'noopener' }}>
|
|
313
|
+
<Button>
|
|
314
|
+
<Button.Label>Visit website</Button.Label>
|
|
315
|
+
</Button>
|
|
316
|
+
</Link>
|
|
317
|
+
);
|
|
318
|
+
}
|
|
319
|
+
```
|
|
320
|
+
|
|
321
|
+
## API
|
|
322
|
+
|
|
323
|
+
### Button
|
|
324
|
+
|
|
325
|
+
| Prop | Type | Default | Description |
|
|
326
|
+
| --- | --- | --- | --- |
|
|
327
|
+
| `className?` | `string` | — | Additional Uniwind/Tailwind classes, merged after the button's own styles. |
|
|
328
|
+
| `children?` | `React.ReactNode` | — | Button content — typically `Button.Label`, `Button.Icon`, and/or `Button.Spinner`. |
|
|
329
|
+
| `asChild?` | `boolean` | — | Render the consumer's child element in place of the default `Pressable` host — merges Button's props onto the child instead of wrapping it (e.g. `<Button asChild><Link /></Button>`). |
|
|
330
|
+
| `variant?` | `'solid' \| 'outline' \| 'ghost'` | `'solid'` | Visual style variant. |
|
|
331
|
+
| `color?` | `'action' \| 'danger' \| 'warning' \| 'success' \| 'info'` | `'action'` | Color theme applied to the button surface and content. |
|
|
332
|
+
| `size?` | `'default' \| 'small'` | `'default'` | Height and horizontal padding scale. |
|
|
333
|
+
| `fullWidth?` | `boolean` | `false` | Stretch the button to fill the width of its container. |
|
|
334
|
+
| `isDisabled?` | `boolean` | — | If true, the button will be disabled. |
|
|
335
|
+
|
|
336
|
+
Inherits all [`PressableProps`](https://reactnative.dev/docs/pressable#props) (including `onPress`).
|
|
337
|
+
|
|
338
|
+
## Sub-components
|
|
339
|
+
|
|
340
|
+
### Button.Label
|
|
341
|
+
|
|
342
|
+
Text label inside the button. Inherits variant, color, and size from the parent Button context.
|
|
343
|
+
|
|
344
|
+
| Prop | Type | Default | Description |
|
|
345
|
+
| --- | --- | --- | --- |
|
|
346
|
+
| `className?` | `string` | — | Additional Uniwind/Tailwind classes, merged after the label's own styles. |
|
|
347
|
+
| `children?` | `React.ReactNode` | — | Label content (or a custom element when `asChild` is set). |
|
|
348
|
+
| `asChild?` | `boolean` | — | Render the consumer's child element in place of the default `Text` host. |
|
|
349
|
+
|
|
350
|
+
Inherits all [`TextProps`](https://reactnative.dev/docs/text#props).
|
|
351
|
+
|
|
352
|
+
### Button.Icon
|
|
353
|
+
|
|
354
|
+
Renders a Forge icon. Inherits size, variant, and color from the parent Button context.
|
|
355
|
+
|
|
356
|
+
| Prop | Type | Default | Description |
|
|
357
|
+
| --- | --- | --- | --- |
|
|
358
|
+
| `className?` | `string` | — | Utility classes for size (`size-*`) and placement, merged after the defaults. |
|
|
359
|
+
| `filled?` | `boolean` | — | When `true`, renders the filled variant of the icon (if available). Defaults to `false` (outlined). |
|
|
360
|
+
| `size?` | `string \| number` | — | Width and height of the icon, in pixels or any SVG length. The bare icon renders at 24 when omitted. |
|
|
361
|
+
| `data-testid?` | `string` | — | Test identifier forwarded to the rendered SVG. |
|
|
362
|
+
| `as?` | `ForgeIcon` | — | Forge icon component to render. Required unless `asChild` is set, in which case the consumer's substituted element is rendered instead. |
|
|
363
|
+
| `asChild?` | `boolean` | — | Render the consumer's child element in place of the default icon host. |
|
|
364
|
+
| `position?` | `'leading' \| 'trailing'` | — | Position hint that emits `data-icon="inline-start"` or `data-icon="inline-end"`. CVA uses this attribute to apply leading/trailing padding logically (RTL-aware). Omit to apply the symmetric baseline gap. |
|
|
365
|
+
|
|
366
|
+
Inherits all `ForgeIconProps` (react-native-svg `SvgProps` plus `filled` and `size`).
|
|
367
|
+
|
|
368
|
+
### Button.Spinner
|
|
369
|
+
|
|
370
|
+
Loading indicator displayed alongside the label.
|
|
371
|
+
|
|
372
|
+
| Prop | Type | Default | Description |
|
|
373
|
+
| --- | --- | --- | --- |
|
|
374
|
+
| `className?` | `string` | — | Additional Uniwind/Tailwind classes for the spinner container. |
|
|
375
|
+
| `children?` | `React.ReactNode` | — | — |
|
|
376
|
+
| `accessibilityLabel?` | `string` | `'Loading'` | Screen reader label for the spinner. |
|
|
377
|
+
| `colorClassName?` | `string` | — | Uniwind `accent-*` color class override for the spinner. When omitted, the color is derived from the parent button's `variant` and `color`. |
|
|
378
|
+
| `asChild?` | `boolean` | — | Render the consumer's child element in place of the default `ActivityIndicator` host. |
|
|
379
|
+
| `position?` | `'leading' \| 'trailing'` | — | Position hint that emits `data-icon="inline-start"` or `data-icon="inline-end"`. CVA uses this attribute to apply leading/trailing padding logically (RTL-aware). Omit to apply the symmetric baseline gap. |
|
|
380
|
+
|
|
381
|
+
Inherits all [`ActivityIndicatorProps`](https://reactnative.dev/docs/activityindicator#props).
|
|
382
|
+
|
|
383
|
+
### Button.Group
|
|
384
|
+
|
|
385
|
+
Groups multiple buttons with consistent spacing and optional attached borders.
|
|
386
|
+
|
|
387
|
+
| Prop | Type | Default | Description |
|
|
388
|
+
| --- | --- | --- | --- |
|
|
389
|
+
| `className?` | `string` | — | Additional Uniwind/Tailwind classes, merged after the group's own styles. |
|
|
390
|
+
| `children` | `React.ReactElement<unknown, string \| React.JSXElementConstructor<any>> \| React.ReactElement<unknown, string \| React.JSXElementConstructor<any>>[]` | — | The buttons to group together. |
|
|
391
|
+
| `asChild?` | `boolean` | — | Render the consumer's child element in place of the default `View` host. |
|
|
392
|
+
| `flexDirection?` | `'row' \| 'column' \| 'row-reverse' \| 'column-reverse'` | `'row'` | Layout direction of the grouped buttons. |
|
|
393
|
+
| `isDisabled?` | `boolean` | — | Disable every button in the group. |
|
|
394
|
+
| `isAttached?` | `boolean` | — | Remove the gap between buttons and merge their adjoining borders. |
|
|
395
|
+
| `reversed?` | `boolean` | — | Reverse the visual order of the buttons. |
|
|
396
|
+
| `isReversed?` | `boolean` | — | Alias of `reversed`. |
|
|
397
|
+
|
|
398
|
+
Inherits all [`ViewProps`](https://reactnative.dev/docs/view#props).
|
|
@@ -0,0 +1,258 @@
|
|
|
1
|
+
# Button — Design (https://design.candescent.com/docs/components/button)
|
|
2
|
+
|
|
3
|
+
## Usage
|
|
4
|
+
|
|
5
|
+
**Common alternative names**: Call to action, CTA
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## Anatomy
|
|
10
|
+
|
|
11
|
+
Buttons always have a label. They can also include an icon before or after the label.
|
|
12
|
+
|
|
13
|
+
1. **Button**: The selectable area of the button.
|
|
14
|
+
2. **Label**: Text that describes the button's action. Follow the label text guidelines below.
|
|
15
|
+
3. **Leading Icon (optional)**: An icon can be included before the label to add additional affordance a button. Most buttons don't need an icon. Follow the icon guidelines.
|
|
16
|
+
4. **Trailing Icon (optional)**: An icon can be included after the label to add additional affordance a button. Most buttons don't need an icon. Follow the icon guidelines.
|
|
17
|
+
|
|
18
|
+
### Variant
|
|
19
|
+
|
|
20
|
+
Buttons are available in 3 variants: **solid**, **outline**, and **ghost**.
|
|
21
|
+
|
|
22
|
+
- **Solid**
|
|
23
|
+
|
|
24
|
+
High-emphasis buttons that should contain actions that are primary to your app.
|
|
25
|
+
- **Outline**
|
|
26
|
+
|
|
27
|
+
Medium-emphasis buttons that should contain actions that are important but aren't the primary action in an app.
|
|
28
|
+
- **Ghost**
|
|
29
|
+
|
|
30
|
+
Medium-emphasis buttons that should contain actions that are important but aren't the primary action in an app.
|
|
31
|
+
|
|
32
|
+
### Color
|
|
33
|
+
|
|
34
|
+
Buttons are versatile, and are available in a wide variety of colors. However, the most frequently used button colors should be: **Action,** and **Danger**.
|
|
35
|
+
|
|
36
|
+
- **Action (Default)**
|
|
37
|
+
|
|
38
|
+
Utilizes the action color palette. Used for **most buttons** in designs.
|
|
39
|
+
- **Danger**
|
|
40
|
+
|
|
41
|
+
Utilizes the danger color palette. Used for buttons with **destructive actions**.
|
|
42
|
+
|
|
43
|
+
### Icon
|
|
44
|
+
|
|
45
|
+
Icons may be added to buttons, either on the left or the right. For buttons with an icon but no label, use the Icon Button component instead.
|
|
46
|
+
|
|
47
|
+
- **Show Leading Icon?: True**
|
|
48
|
+
|
|
49
|
+
Enables an icon that comes before the label (left side).
|
|
50
|
+
- **Show End Icon?: True**
|
|
51
|
+
|
|
52
|
+
Enables an icon that comes after the label (right side).
|
|
53
|
+
|
|
54
|
+
### Size
|
|
55
|
+
|
|
56
|
+
Buttons are available in 2 sizes: **Default**, and **Small**. Size should be considered for visual balance and user focus; not to replace visual hierarchy.
|
|
57
|
+
|
|
58
|
+
- **Size: Default**
|
|
59
|
+
|
|
60
|
+
Large buttons have a height of 44px. This matches the height of the Input Field component.
|
|
61
|
+
- **Size: Small**
|
|
62
|
+
|
|
63
|
+
Small buttons have a height of 32px.
|
|
64
|
+
|
|
65
|
+
---
|
|
66
|
+
|
|
67
|
+
Usage
|
|
68
|
+
|
|
69
|
+
### When to use
|
|
70
|
+
|
|
71
|
+
> [!TIP]
|
|
72
|
+
>
|
|
73
|
+
> **For actions that users can take**
|
|
74
|
+
>
|
|
75
|
+
> - ex: Open a dialog
|
|
76
|
+
> - ex: Submit a form
|
|
77
|
+
|
|
78
|
+
> [!TIP]
|
|
79
|
+
>
|
|
80
|
+
> **When you need to provide a call-to-action for the user**
|
|
81
|
+
>
|
|
82
|
+
> - ex: _Add to cart_
|
|
83
|
+
> - ex: _Sign up_
|
|
84
|
+
> - ex: _Save_
|
|
85
|
+
|
|
86
|
+
### When not to use
|
|
87
|
+
|
|
88
|
+
> [!CAUTION]
|
|
89
|
+
>
|
|
90
|
+
> **As navigational elements**
|
|
91
|
+
>
|
|
92
|
+
> - ex: As links in navigation menus
|
|
93
|
+
|
|
94
|
+
> [!CAUTION]
|
|
95
|
+
>
|
|
96
|
+
> **For simple, non-tabular information**
|
|
97
|
+
>
|
|
98
|
+
> - ex: Leading the user to a new website
|
|
99
|
+
> - ex: Within blocks of running text
|
|
100
|
+
|
|
101
|
+
### Hierarchy
|
|
102
|
+
|
|
103
|
+
A button hierarchy emphasizes which button is most important in the context so the user can take action right away.
|
|
104
|
+
|
|
105
|
+
Our buttons should use color and contrast to create three consistent levels of emphasis and hierarchy. The buttons with the strongest emphasis are **solid** buttons, followed by **outline**, then **ghost**.
|
|
106
|
+
|
|
107
|
+
In general, your product work streams should follow these button guidelines for choosing the hierarchy of a button:
|
|
108
|
+
|
|
109
|
+
| **Emphasis** | **Variant** | **Count** | **Use for** |
|
|
110
|
+
| ------------ | ----------- | --------- | -------------------------------------------------------------------------------------------------------- |
|
|
111
|
+
| High | **solid** | 1 | The **most important action**, to move forward in a flow, acknowledge & dismiss or finish a task. |
|
|
112
|
+
| Medium | **outline** | Many | Most actions, especially those inline with other content. |
|
|
113
|
+
| Low | **ghost** | A few | **Dismissive actions** that give users a way out of something, letting them do nothing, dismiss or skip. |
|
|
114
|
+
|
|
115
|
+
For detailed guidance on button placement, refer to the Button placement and hierarchy documentation.
|
|
116
|
+
|
|
117
|
+
#### **Solid buttons**
|
|
118
|
+
|
|
119
|
+
Solid buttons should be used for **high-emphasis actions**. Examples include moving forward in a flow, submitting a form, or highlighting the most common action a user would take on a page. Use them sparingly to avoid making the interface too busy.
|
|
120
|
+
|
|
121
|
+
- **Do:** The single most important button should be solid. Other buttons should be lower emphasis.
|
|
122
|
+
- **Do:** You can use multiple solid buttons if there is a clear separation between content.
|
|
123
|
+
- **Don't:** Don’t use multiple solid buttons if there is no clear separation between content.
|
|
124
|
+
|
|
125
|
+
When creating a Dialog, the single most important button (the affirmative action) should be a contained button. The dismissive action should be lower emphasis.
|
|
126
|
+
|
|
127
|
+
- **Do:** Use solid buttons for affirmative actions, especially in a Dialog.
|
|
128
|
+
- **Don't:** Don’t use solid buttons for dismissive actions, especially in a Dialog.
|
|
129
|
+
|
|
130
|
+
#### Outline buttons
|
|
131
|
+
|
|
132
|
+
Outline buttons should be used for **medium-emphasis actions** or actions that are supplementary to the main high-emphasis action. This variant will generally make up the majority of buttons on a page. They are also useful for when a page doesn’t have one true high-emphasis action.
|
|
133
|
+
|
|
134
|
+
- **Do:** Use outline buttons inline with lists and other elements as needed. These medium-emphasis buttons are often most common.
|
|
135
|
+
- **Caution:** Avoid using solid buttons in the middle of the page. Important actions should be placed at the top or bottom.
|
|
136
|
+
|
|
137
|
+
#### Ghost buttons
|
|
138
|
+
|
|
139
|
+
Ghost buttons are the least bold of the 3 variants, meaning that it is the least noticeable to users. Therefore, they should only be used for **low-emphasis actions**.
|
|
140
|
+
|
|
141
|
+
The most common use for ghost buttons are **dismissive actions**: actions that give users a way out of a flow or allow them to ignore something. Some common examples include _Cancel_, _Close_, _Dismiss_, _Skip_, and _Ignore_.
|
|
142
|
+
|
|
143
|
+
Always use ghost buttons when your users are aborting an action and thus navigating back to the previous state of the UI to create familiarity as they work through your product work streams.
|
|
144
|
+
|
|
145
|
+
- **Do:** Use ghost buttons for dismissive actions. For example, a Cancel button could be used to back out of a process or action.
|
|
146
|
+
- **Don't:** Don’t use outline buttons for buttons with dismissive behavior such as Cancel, Close, or Dismiss.
|
|
147
|
+
|
|
148
|
+
#### Destructive buttons
|
|
149
|
+
|
|
150
|
+
Destructive buttons should be used when the button’s action will cause permanent data loss. Any of the three button variants can be used as a destructive button by setting the property **color: danger**.
|
|
151
|
+
|
|
152
|
+
_usage\_destructive\_01-ex_
|
|
153
|
+
|
|
154
|
+
- **Do:** Use destructive buttons for actions that will delete data as soon as the button is pressed.
|
|
155
|
+
- **Don't:** Don’t use destructive buttons for dismissive behaviors or other actions that don’t result in data loss.
|
|
156
|
+
|
|
157
|
+
See the [destructive actions](https://design.candescent.com/docs/components/button/content.md) section below for more details about usage & behavior.
|
|
158
|
+
|
|
159
|
+
### Layout and placement
|
|
160
|
+
|
|
161
|
+
An **affirmative action** is something that takes the users further in their journey (for example, **Save**, **Review** or **Delete**), while a **dismissive action** takes a user back (for example, _Cancel_). Affirmative actions are the highest in the hierarchy.
|
|
162
|
+
|
|
163
|
+
In most breakpoints, the visual hierarchy of buttons moves from right-to-left, starting with primary buttons on the right, followed by secondary buttons, and so on. So, an affirmative action should be the right-most button.
|
|
164
|
+
|
|
165
|
+
In the Mobile breakpoint, where the buttons are full-width, the hierarchy moves from bottom-to-top, starting with primary buttons on the bottom.
|
|
166
|
+
|
|
167
|
+
- **Mobile**
|
|
168
|
+
|
|
169
|
+
Hierarchy moves from bottom to top. Affirmative actions should always be the bottom-most button.
|
|
170
|
+
- **Tablet and Above**
|
|
171
|
+
|
|
172
|
+
Hierarchy moves from right to left. Affirmative actions should always be the right-most button.
|
|
173
|
+
|
|
174
|
+
### **Breakpoints**
|
|
175
|
+
|
|
176
|
+
The width of buttons should change depending when they are viewed on a mobile device.
|
|
177
|
+
|
|
178
|
+
- **Mobile**
|
|
179
|
+
|
|
180
|
+
Within the Mobile breakpoint (width \< 600px), most buttons should scale to 100% width of their container.
|
|
181
|
+
- **Tablet and Above**
|
|
182
|
+
|
|
183
|
+
On all breakpoints larger than Mobile (width ≥ 600px), the width of buttons should hug their content.
|
|
184
|
+
|
|
185
|
+
---
|
|
186
|
+
|
|
187
|
+
## Behavior
|
|
188
|
+
|
|
189
|
+
### Interaction states
|
|
190
|
+
|
|
191
|
+
The default state of a button is clickable. The appearance of the button will respond as the user interacts with it.
|
|
192
|
+
|
|
193
|
+
- **Resting (default)**
|
|
194
|
+
|
|
195
|
+
Default state. User is not interacting with the button.
|
|
196
|
+
- **isHovered: True**
|
|
197
|
+
|
|
198
|
+
When the user’s cursor is hovering over the button.
|
|
199
|
+
- **isFocused: True**
|
|
200
|
+
|
|
201
|
+
When a keyboard user is focused on the button using tab navigation controls.
|
|
202
|
+
|
|
203
|
+
### Disabled
|
|
204
|
+
|
|
205
|
+
Buttons can be disabled, which prevents the user from clicking on or interacting with the button.
|
|
206
|
+
|
|
207
|
+
Using disabled buttons can cause accessibility issues so try and avoid them, as they often create more problems than they solve. Keep buttons active and use clear error messaging to guide users whenever possible. Use disabled buttons only in rare edge cases.
|
|
208
|
+
|
|
209
|
+
- **isDisabled: true**
|
|
210
|
+
|
|
211
|
+
The user cannot interact with the button in this state.
|
|
212
|
+
|
|
213
|
+
### Loading
|
|
214
|
+
|
|
215
|
+
If a button’s action is not nearly-instant, it is recommended to give the user some visual feedback that the action is in progress. One way of accomplishing this is using a loading button.
|
|
216
|
+
|
|
217
|
+
- **isLoading: true**
|
|
218
|
+
|
|
219
|
+
This state displays a loading spinner inside the button, and prevents the user from interacting with the button.
|
|
220
|
+
|
|
221
|
+
### Destructive actions
|
|
222
|
+
|
|
223
|
+
Destructive actions are **actions that cause permanent data loss**, such as discarding a draft email, deleting a user account, or closing a credit card. In most cases, these actions can’t be undone.
|
|
224
|
+
|
|
225
|
+
In flows that contain destructive actions, **users should be prompted before the action is completed**, as it is possible they pressed the button by mistake. The first action that initiates the prompt should be a medium-emphasis or low-emphasis button, and the final action that triggers the destruction should be a high-emphasis button.
|
|
226
|
+
|
|
227
|
+
- **Do:** Use destructive buttons for actions that will delete data as soon as the button is pressed.
|
|
228
|
+
- **Don't:** Don’t use secondary style buttons for buttons with dismissive behavior such as “Cancel”, “Close”, or “Dismiss”.
|
|
229
|
+
|
|
230
|
+
## Content
|
|
231
|
+
|
|
232
|
+
## **Label text**
|
|
233
|
+
|
|
234
|
+
Label text describes the action that will occur if a user taps a button. Since the width of the button is determined by the length of the text, labels should be short and direct.
|
|
235
|
+
|
|
236
|
+
Use the following guidelines when writing button labels:
|
|
237
|
+
|
|
238
|
+
- Labels should be short, but their meaning should still be clear.
|
|
239
|
+
- Write labels in sentence case.
|
|
240
|
+
- Use verbs instead of adjectives whenever it makes sense to
|
|
241
|
+
- example: Use _Create account_ instead of _New account_
|
|
242
|
+
|
|
243
|
+
* **Do:** Use short, direct labels that help the user understand the action the button represents.
|
|
244
|
+
* **Don't:** Don’t wrap text within buttons. Find a way to write the label shorter if there isn’t enough room.
|
|
245
|
+
* **Do:** Use a verb (“Create”) instead of an adjective (“New”) when it makes sense in context.
|
|
246
|
+
* **Caution:** Adjectives can still be used in some cases. In this example, “Create transfer” would be misleading.
|
|
247
|
+
* **Don't:** Don’t use a misleading verb. This example should instead say “Schedule transfer” or “New transfer”.
|
|
248
|
+
|
|
249
|
+
## **Icons**
|
|
250
|
+
|
|
251
|
+
Icons can be useful for reinforcing the button’s purpose, and can help the user scan the page more quickly. However, make sure that the icon has a clear **affordance** – the meaning of the symbol should be easily understood, and not conflict with the label’s text. When an action can be represented clearly by a symbol, we recommend using an [icon button](https://design.candescent.com/docs/components/icon-button/content.md).
|
|
252
|
+
|
|
253
|
+
- **Do:** Use the icons most commonly associated with the action.
|
|
254
|
+
- **Do:** Icons that are more specific (but still clear) can be used.
|
|
255
|
+
- **Don't:** Don’t use icons that are not commonly associated with the action.
|
|
256
|
+
- **Don't:** Don’t use icons that are commonly associated with other actions.
|
|
257
|
+
- **Don't:** Don’t use two icons in a button. It may lead to confusion and/or clutter.
|
|
258
|
+
- **Don't:** Don’t use a button with an icon and no label. Use an Icon Button instead.
|