@neynar/ui 0.1.1
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/LICENSE +21 -0
- package/README.md +195 -0
- package/dist/components/ui/accordion.d.ts +229 -0
- package/dist/components/ui/accordion.d.ts.map +1 -0
- package/dist/components/ui/alert-dialog.d.ts +247 -0
- package/dist/components/ui/alert-dialog.d.ts.map +1 -0
- package/dist/components/ui/alert.d.ts +187 -0
- package/dist/components/ui/alert.d.ts.map +1 -0
- package/dist/components/ui/aspect-ratio.d.ts +94 -0
- package/dist/components/ui/aspect-ratio.d.ts.map +1 -0
- package/dist/components/ui/avatar.d.ts +244 -0
- package/dist/components/ui/avatar.d.ts.map +1 -0
- package/dist/components/ui/badge.d.ts +163 -0
- package/dist/components/ui/badge.d.ts.map +1 -0
- package/dist/components/ui/breadcrumb.d.ts +281 -0
- package/dist/components/ui/breadcrumb.d.ts.map +1 -0
- package/dist/components/ui/button.d.ts +129 -0
- package/dist/components/ui/button.d.ts.map +1 -0
- package/dist/components/ui/calendar.d.ts +169 -0
- package/dist/components/ui/calendar.d.ts.map +1 -0
- package/dist/components/ui/card.d.ts +365 -0
- package/dist/components/ui/card.d.ts.map +1 -0
- package/dist/components/ui/carousel.d.ts +369 -0
- package/dist/components/ui/carousel.d.ts.map +1 -0
- package/dist/components/ui/chart.d.ts +442 -0
- package/dist/components/ui/chart.d.ts.map +1 -0
- package/dist/components/ui/checkbox.d.ts +88 -0
- package/dist/components/ui/checkbox.d.ts.map +1 -0
- package/dist/components/ui/collapsible.d.ts +182 -0
- package/dist/components/ui/collapsible.d.ts.map +1 -0
- package/dist/components/ui/combobox.d.ts +270 -0
- package/dist/components/ui/combobox.d.ts.map +1 -0
- package/dist/components/ui/command.d.ts +355 -0
- package/dist/components/ui/command.d.ts.map +1 -0
- package/dist/components/ui/container.d.ts +102 -0
- package/dist/components/ui/container.d.ts.map +1 -0
- package/dist/components/ui/context-menu.d.ts +339 -0
- package/dist/components/ui/context-menu.d.ts.map +1 -0
- package/dist/components/ui/date-picker.d.ts +145 -0
- package/dist/components/ui/date-picker.d.ts.map +1 -0
- package/dist/components/ui/dialog.d.ts +322 -0
- package/dist/components/ui/dialog.d.ts.map +1 -0
- package/dist/components/ui/drawer.d.ts +154 -0
- package/dist/components/ui/drawer.d.ts.map +1 -0
- package/dist/components/ui/dropdown-menu.d.ts +349 -0
- package/dist/components/ui/dropdown-menu.d.ts.map +1 -0
- package/dist/components/ui/empty-state.d.ts +133 -0
- package/dist/components/ui/empty-state.d.ts.map +1 -0
- package/dist/components/ui/hover-card.d.ts +109 -0
- package/dist/components/ui/hover-card.d.ts.map +1 -0
- package/dist/components/ui/input.d.ts +89 -0
- package/dist/components/ui/input.d.ts.map +1 -0
- package/dist/components/ui/label.d.ts +93 -0
- package/dist/components/ui/label.d.ts.map +1 -0
- package/dist/components/ui/menubar.d.ts +306 -0
- package/dist/components/ui/menubar.d.ts.map +1 -0
- package/dist/components/ui/navigation-menu.d.ts +318 -0
- package/dist/components/ui/navigation-menu.d.ts.map +1 -0
- package/dist/components/ui/pagination.d.ts +343 -0
- package/dist/components/ui/pagination.d.ts.map +1 -0
- package/dist/components/ui/popover.d.ts +178 -0
- package/dist/components/ui/popover.d.ts.map +1 -0
- package/dist/components/ui/progress.d.ts +64 -0
- package/dist/components/ui/progress.d.ts.map +1 -0
- package/dist/components/ui/radio-group.d.ts +144 -0
- package/dist/components/ui/radio-group.d.ts.map +1 -0
- package/dist/components/ui/resizable.d.ts +164 -0
- package/dist/components/ui/resizable.d.ts.map +1 -0
- package/dist/components/ui/scroll-area.d.ts +82 -0
- package/dist/components/ui/scroll-area.d.ts.map +1 -0
- package/dist/components/ui/select.d.ts +316 -0
- package/dist/components/ui/select.d.ts.map +1 -0
- package/dist/components/ui/separator.d.ts +80 -0
- package/dist/components/ui/separator.d.ts.map +1 -0
- package/dist/components/ui/sheet.d.ts +346 -0
- package/dist/components/ui/sheet.d.ts.map +1 -0
- package/dist/components/ui/sidebar.d.ts +1561 -0
- package/dist/components/ui/sidebar.d.ts.map +1 -0
- package/dist/components/ui/skeleton.d.ts +66 -0
- package/dist/components/ui/skeleton.d.ts.map +1 -0
- package/dist/components/ui/slider.d.ts +95 -0
- package/dist/components/ui/slider.d.ts.map +1 -0
- package/dist/components/ui/sonner.d.ts +101 -0
- package/dist/components/ui/sonner.d.ts.map +1 -0
- package/dist/components/ui/stack.d.ts +192 -0
- package/dist/components/ui/stack.d.ts.map +1 -0
- package/dist/components/ui/stories/accordion.stories.d.ts +71 -0
- package/dist/components/ui/stories/accordion.stories.d.ts.map +1 -0
- package/dist/components/ui/stories/alert-dialog.stories.d.ts +39 -0
- package/dist/components/ui/stories/alert-dialog.stories.d.ts.map +1 -0
- package/dist/components/ui/stories/alert.stories.d.ts +48 -0
- package/dist/components/ui/stories/alert.stories.d.ts.map +1 -0
- package/dist/components/ui/stories/aspect-ratio.stories.d.ts +53 -0
- package/dist/components/ui/stories/aspect-ratio.stories.d.ts.map +1 -0
- package/dist/components/ui/stories/avatar.stories.d.ts +49 -0
- package/dist/components/ui/stories/avatar.stories.d.ts.map +1 -0
- package/dist/components/ui/stories/badge.stories.d.ts +64 -0
- package/dist/components/ui/stories/badge.stories.d.ts.map +1 -0
- package/dist/components/ui/stories/breadcrumb.stories.d.ts +27 -0
- package/dist/components/ui/stories/breadcrumb.stories.d.ts.map +1 -0
- package/dist/components/ui/stories/button.stories.d.ts +92 -0
- package/dist/components/ui/stories/button.stories.d.ts.map +1 -0
- package/dist/components/ui/stories/calendar.stories.d.ts +94 -0
- package/dist/components/ui/stories/calendar.stories.d.ts.map +1 -0
- package/dist/components/ui/stories/card.stories.d.ts +29 -0
- package/dist/components/ui/stories/card.stories.d.ts.map +1 -0
- package/dist/components/ui/stories/carousel.stories.d.ts +42 -0
- package/dist/components/ui/stories/carousel.stories.d.ts.map +1 -0
- package/dist/components/ui/stories/chart.stories.d.ts +51 -0
- package/dist/components/ui/stories/chart.stories.d.ts.map +1 -0
- package/dist/components/ui/stories/checkbox.stories.d.ts +72 -0
- package/dist/components/ui/stories/checkbox.stories.d.ts.map +1 -0
- package/dist/components/ui/stories/cn.stories.d.ts +19 -0
- package/dist/components/ui/stories/cn.stories.d.ts.map +1 -0
- package/dist/components/ui/stories/collapsible.stories.d.ts +51 -0
- package/dist/components/ui/stories/collapsible.stories.d.ts.map +1 -0
- package/dist/components/ui/stories/colors.stories.d.ts +31 -0
- package/dist/components/ui/stories/colors.stories.d.ts.map +1 -0
- package/dist/components/ui/stories/combobox.stories.d.ts +89 -0
- package/dist/components/ui/stories/combobox.stories.d.ts.map +1 -0
- package/dist/components/ui/stories/command.stories.d.ts +69 -0
- package/dist/components/ui/stories/command.stories.d.ts.map +1 -0
- package/dist/components/ui/stories/container.stories.d.ts +42 -0
- package/dist/components/ui/stories/container.stories.d.ts.map +1 -0
- package/dist/components/ui/stories/context-menu.stories.d.ts +32 -0
- package/dist/components/ui/stories/context-menu.stories.d.ts.map +1 -0
- package/dist/components/ui/stories/date-picker.stories.d.ts +67 -0
- package/dist/components/ui/stories/date-picker.stories.d.ts.map +1 -0
- package/dist/components/ui/stories/dialog.stories.d.ts +48 -0
- package/dist/components/ui/stories/dialog.stories.d.ts.map +1 -0
- package/dist/components/ui/stories/drawer.stories.d.ts +33 -0
- package/dist/components/ui/stories/drawer.stories.d.ts.map +1 -0
- package/dist/components/ui/stories/dropdown-menu.stories.d.ts +31 -0
- package/dist/components/ui/stories/dropdown-menu.stories.d.ts.map +1 -0
- package/dist/components/ui/stories/empty-state.stories.d.ts +74 -0
- package/dist/components/ui/stories/empty-state.stories.d.ts.map +1 -0
- package/dist/components/ui/stories/hover-card.stories.d.ts +35 -0
- package/dist/components/ui/stories/hover-card.stories.d.ts.map +1 -0
- package/dist/components/ui/stories/input.stories.d.ts +69 -0
- package/dist/components/ui/stories/input.stories.d.ts.map +1 -0
- package/dist/components/ui/stories/label.stories.d.ts +47 -0
- package/dist/components/ui/stories/label.stories.d.ts.map +1 -0
- package/dist/components/ui/stories/menubar.stories.d.ts +39 -0
- package/dist/components/ui/stories/menubar.stories.d.ts.map +1 -0
- package/dist/components/ui/stories/navigation-menu.stories.d.ts +44 -0
- package/dist/components/ui/stories/navigation-menu.stories.d.ts.map +1 -0
- package/dist/components/ui/stories/pagination.stories.d.ts +33 -0
- package/dist/components/ui/stories/pagination.stories.d.ts.map +1 -0
- package/dist/components/ui/stories/popover.stories.d.ts +36 -0
- package/dist/components/ui/stories/popover.stories.d.ts.map +1 -0
- package/dist/components/ui/stories/progress.stories.d.ts +38 -0
- package/dist/components/ui/stories/progress.stories.d.ts.map +1 -0
- package/dist/components/ui/stories/radio-group.stories.d.ts +76 -0
- package/dist/components/ui/stories/radio-group.stories.d.ts.map +1 -0
- package/dist/components/ui/stories/resizable.stories.d.ts +49 -0
- package/dist/components/ui/stories/resizable.stories.d.ts.map +1 -0
- package/dist/components/ui/stories/scroll-area.stories.d.ts +35 -0
- package/dist/components/ui/stories/scroll-area.stories.d.ts.map +1 -0
- package/dist/components/ui/stories/select.stories.d.ts +51 -0
- package/dist/components/ui/stories/select.stories.d.ts.map +1 -0
- package/dist/components/ui/stories/separator.stories.d.ts +58 -0
- package/dist/components/ui/stories/separator.stories.d.ts.map +1 -0
- package/dist/components/ui/stories/sheet.stories.d.ts +43 -0
- package/dist/components/ui/stories/sheet.stories.d.ts.map +1 -0
- package/dist/components/ui/stories/sidebar.stories.d.ts +60 -0
- package/dist/components/ui/stories/sidebar.stories.d.ts.map +1 -0
- package/dist/components/ui/stories/skeleton.stories.d.ts +42 -0
- package/dist/components/ui/stories/skeleton.stories.d.ts.map +1 -0
- package/dist/components/ui/stories/slider.stories.d.ts +99 -0
- package/dist/components/ui/stories/slider.stories.d.ts.map +1 -0
- package/dist/components/ui/stories/sonner.stories.d.ts +9 -0
- package/dist/components/ui/stories/sonner.stories.d.ts.map +1 -0
- package/dist/components/ui/stories/stack.stories.d.ts +39 -0
- package/dist/components/ui/stories/stack.stories.d.ts.map +1 -0
- package/dist/components/ui/stories/switch.stories.d.ts +71 -0
- package/dist/components/ui/stories/switch.stories.d.ts.map +1 -0
- package/dist/components/ui/stories/table.stories.d.ts +40 -0
- package/dist/components/ui/stories/table.stories.d.ts.map +1 -0
- package/dist/components/ui/stories/tabs.stories.d.ts +62 -0
- package/dist/components/ui/stories/tabs.stories.d.ts.map +1 -0
- package/dist/components/ui/stories/text-field.stories.d.ts +78 -0
- package/dist/components/ui/stories/text-field.stories.d.ts.map +1 -0
- package/dist/components/ui/stories/textarea.stories.d.ts +57 -0
- package/dist/components/ui/stories/textarea.stories.d.ts.map +1 -0
- package/dist/components/ui/stories/theme-toggle.stories.d.ts +71 -0
- package/dist/components/ui/stories/theme-toggle.stories.d.ts.map +1 -0
- package/dist/components/ui/stories/theme.stories.d.ts +51 -0
- package/dist/components/ui/stories/theme.stories.d.ts.map +1 -0
- package/dist/components/ui/stories/toggle-group.stories.d.ts +71 -0
- package/dist/components/ui/stories/toggle-group.stories.d.ts.map +1 -0
- package/dist/components/ui/stories/toggle.stories.d.ts +78 -0
- package/dist/components/ui/stories/toggle.stories.d.ts.map +1 -0
- package/dist/components/ui/stories/tooltip.stories.d.ts +37 -0
- package/dist/components/ui/stories/tooltip.stories.d.ts.map +1 -0
- package/dist/components/ui/stories/typography.stories.d.ts +137 -0
- package/dist/components/ui/stories/typography.stories.d.ts.map +1 -0
- package/dist/components/ui/stories/use-mobile.stories.d.ts +20 -0
- package/dist/components/ui/stories/use-mobile.stories.d.ts.map +1 -0
- package/dist/components/ui/stories/use-theme.stories.d.ts +23 -0
- package/dist/components/ui/stories/use-theme.stories.d.ts.map +1 -0
- package/dist/components/ui/switch.d.ts +84 -0
- package/dist/components/ui/switch.d.ts.map +1 -0
- package/dist/components/ui/table.d.ts +321 -0
- package/dist/components/ui/table.d.ts.map +1 -0
- package/dist/components/ui/tabs.d.ts +260 -0
- package/dist/components/ui/tabs.d.ts.map +1 -0
- package/dist/components/ui/text-field.d.ts +157 -0
- package/dist/components/ui/text-field.d.ts.map +1 -0
- package/dist/components/ui/textarea.d.ts +84 -0
- package/dist/components/ui/textarea.d.ts.map +1 -0
- package/dist/components/ui/theme-toggle.d.ts +105 -0
- package/dist/components/ui/theme-toggle.d.ts.map +1 -0
- package/dist/components/ui/theme.d.ts +110 -0
- package/dist/components/ui/theme.d.ts.map +1 -0
- package/dist/components/ui/toggle-group.d.ts +133 -0
- package/dist/components/ui/toggle-group.d.ts.map +1 -0
- package/dist/components/ui/toggle.d.ts +84 -0
- package/dist/components/ui/toggle.d.ts.map +1 -0
- package/dist/components/ui/tooltip.d.ts +202 -0
- package/dist/components/ui/tooltip.d.ts.map +1 -0
- package/dist/components/ui/typography.d.ts +287 -0
- package/dist/components/ui/typography.d.ts.map +1 -0
- package/dist/hooks/use-mobile.d.ts +74 -0
- package/dist/hooks/use-mobile.d.ts.map +1 -0
- package/dist/hooks/use-theme.d.ts +142 -0
- package/dist/hooks/use-theme.d.ts.map +1 -0
- package/dist/index.d.ts +57 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +27498 -0
- package/dist/index.js.map +1 -0
- package/dist/lib/utils.d.ts +43 -0
- package/dist/lib/utils.d.ts.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/docs/llm/colors.md +273 -0
- package/docs/llm/components/buttons.md +68 -0
- package/docs/llm/components/cards.md +53 -0
- package/docs/llm/components/display.md +134 -0
- package/docs/llm/components/feedback.md +96 -0
- package/docs/llm/components/forms.md +90 -0
- package/docs/llm/components/layout.md +59 -0
- package/docs/llm/components/menus.md +70 -0
- package/docs/llm/components/navigation.md +80 -0
- package/docs/llm/components/overlays.md +83 -0
- package/docs/llm/components/tables.md +73 -0
- package/docs/llm/components/typography.md +199 -0
- package/docs/llm/components/utilities.md +114 -0
- package/docs/llm/guide.md +165 -0
- package/llms.txt +122 -0
- package/package.json +104 -0
- package/src/components/ui/accordion.tsx +285 -0
- package/src/components/ui/alert-dialog.tsx +387 -0
- package/src/components/ui/alert.tsx +243 -0
- package/src/components/ui/aspect-ratio.tsx +99 -0
- package/src/components/ui/avatar.tsx +288 -0
- package/src/components/ui/badge.tsx +205 -0
- package/src/components/ui/breadcrumb.tsx +378 -0
- package/src/components/ui/button.tsx +195 -0
- package/src/components/ui/calendar.tsx +371 -0
- package/src/components/ui/card.tsx +447 -0
- package/src/components/ui/carousel.tsx +624 -0
- package/src/components/ui/chart.tsx +802 -0
- package/src/components/ui/checkbox.tsx +113 -0
- package/src/components/ui/collapsible.tsx +207 -0
- package/src/components/ui/combobox.tsx +373 -0
- package/src/components/ui/command.tsx +518 -0
- package/src/components/ui/container.tsx +114 -0
- package/src/components/ui/context-menu.tsx +563 -0
- package/src/components/ui/date-picker.tsx +213 -0
- package/src/components/ui/dialog.tsx +447 -0
- package/src/components/ui/drawer.tsx +273 -0
- package/src/components/ui/dropdown-menu.tsx +578 -0
- package/src/components/ui/empty-state.tsx +145 -0
- package/src/components/ui/hover-card.tsx +144 -0
- package/src/components/ui/input.tsx +106 -0
- package/src/components/ui/label.tsx +110 -0
- package/src/components/ui/menubar.tsx +553 -0
- package/src/components/ui/navigation-menu.tsx +471 -0
- package/src/components/ui/pagination.tsx +456 -0
- package/src/components/ui/popover.tsx +216 -0
- package/src/components/ui/progress.tsx +88 -0
- package/src/components/ui/radio-group.tsx +183 -0
- package/src/components/ui/resizable.tsx +209 -0
- package/src/components/ui/scroll-area.tsx +132 -0
- package/src/components/ui/select.tsx +485 -0
- package/src/components/ui/separator.tsx +101 -0
- package/src/components/ui/sheet.tsx +495 -0
- package/src/components/ui/sidebar.tsx +2211 -0
- package/src/components/ui/skeleton.tsx +76 -0
- package/src/components/ui/slider.tsx +147 -0
- package/src/components/ui/sonner.tsx +120 -0
- package/src/components/ui/stack.tsx +180 -0
- package/src/components/ui/stories/accordion.stories.tsx +429 -0
- package/src/components/ui/stories/alert-dialog.stories.tsx +519 -0
- package/src/components/ui/stories/alert.stories.tsx +228 -0
- package/src/components/ui/stories/aspect-ratio.stories.tsx +200 -0
- package/src/components/ui/stories/avatar.stories.tsx +317 -0
- package/src/components/ui/stories/badge.stories.tsx +260 -0
- package/src/components/ui/stories/breadcrumb.stories.tsx +482 -0
- package/src/components/ui/stories/button.stories.tsx +266 -0
- package/src/components/ui/stories/calendar.stories.tsx +375 -0
- package/src/components/ui/stories/card.stories.tsx +308 -0
- package/src/components/ui/stories/carousel.stories.tsx +328 -0
- package/src/components/ui/stories/chart.stories.tsx +430 -0
- package/src/components/ui/stories/checkbox.stories.tsx +297 -0
- package/src/components/ui/stories/cn.stories.tsx +433 -0
- package/src/components/ui/stories/collapsible.stories.tsx +256 -0
- package/src/components/ui/stories/colors.stories.tsx +502 -0
- package/src/components/ui/stories/combobox.stories.tsx +301 -0
- package/src/components/ui/stories/command.stories.tsx +632 -0
- package/src/components/ui/stories/container.stories.tsx +250 -0
- package/src/components/ui/stories/context-menu.stories.tsx +446 -0
- package/src/components/ui/stories/date-picker.stories.tsx +378 -0
- package/src/components/ui/stories/dialog.stories.tsx +535 -0
- package/src/components/ui/stories/drawer.stories.tsx +364 -0
- package/src/components/ui/stories/dropdown-menu.stories.tsx +374 -0
- package/src/components/ui/stories/empty-state.stories.tsx +244 -0
- package/src/components/ui/stories/hover-card.stories.tsx +355 -0
- package/src/components/ui/stories/input.stories.tsx +289 -0
- package/src/components/ui/stories/label.stories.tsx +294 -0
- package/src/components/ui/stories/menubar.stories.tsx +764 -0
- package/src/components/ui/stories/navigation-menu.stories.tsx +539 -0
- package/src/components/ui/stories/pagination.stories.tsx +604 -0
- package/src/components/ui/stories/popover.stories.tsx +392 -0
- package/src/components/ui/stories/progress.stories.tsx +218 -0
- package/src/components/ui/stories/radio-group.stories.tsx +400 -0
- package/src/components/ui/stories/resizable.stories.tsx +417 -0
- package/src/components/ui/stories/scroll-area.stories.tsx +180 -0
- package/src/components/ui/stories/select.stories.tsx +389 -0
- package/src/components/ui/stories/separator.stories.tsx +192 -0
- package/src/components/ui/stories/sheet.stories.tsx +468 -0
- package/src/components/ui/stories/sidebar.stories.tsx +731 -0
- package/src/components/ui/stories/skeleton.stories.tsx +216 -0
- package/src/components/ui/stories/slider.stories.tsx +321 -0
- package/src/components/ui/stories/sonner.stories.tsx +373 -0
- package/src/components/ui/stories/stack.stories.tsx +222 -0
- package/src/components/ui/stories/switch.stories.tsx +202 -0
- package/src/components/ui/stories/table.stories.tsx +541 -0
- package/src/components/ui/stories/tabs.stories.tsx +544 -0
- package/src/components/ui/stories/text-field.stories.tsx +280 -0
- package/src/components/ui/stories/textarea.stories.tsx +245 -0
- package/src/components/ui/stories/theme-toggle.stories.tsx +275 -0
- package/src/components/ui/stories/theme.stories.tsx +412 -0
- package/src/components/ui/stories/toggle-group.stories.tsx +337 -0
- package/src/components/ui/stories/toggle.stories.tsx +325 -0
- package/src/components/ui/stories/tooltip.stories.tsx +444 -0
- package/src/components/ui/stories/typography.stories.tsx +1586 -0
- package/src/components/ui/stories/use-mobile.stories.tsx +420 -0
- package/src/components/ui/stories/use-theme.stories.tsx +531 -0
- package/src/components/ui/switch.tsx +106 -0
- package/src/components/ui/table.tsx +424 -0
- package/src/components/ui/tabs.tsx +316 -0
- package/src/components/ui/text-field.tsx +206 -0
- package/src/components/ui/textarea.tsx +98 -0
- package/src/components/ui/theme-toggle.tsx +185 -0
- package/src/components/ui/theme.tsx +148 -0
- package/src/components/ui/toggle-group.tsx +196 -0
- package/src/components/ui/toggle.tsx +115 -0
- package/src/components/ui/tooltip.tsx +253 -0
- package/src/components/ui/typography.tsx +468 -0
- package/src/hooks/use-mobile.ts +91 -0
- package/src/hooks/use-theme.ts +319 -0
- package/src/index.ts +77 -0
- package/src/lib/utils.ts +57 -0
- package/src/styles/globals.css +160 -0
|
@@ -0,0 +1,447 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
|
|
3
|
+
import { cn } from "@/lib/utils";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Card - A flexible container component for grouping related content
|
|
7
|
+
*
|
|
8
|
+
* Cards are surfaces that display content and actions on a single topic.
|
|
9
|
+
* They should be easy to scan for relevant and actionable information.
|
|
10
|
+
* Cards support composition through multiple sub-components and can be
|
|
11
|
+
* customized with various layouts and styling patterns.
|
|
12
|
+
*
|
|
13
|
+
* Based on the shadcn/ui Card component, this implementation provides:
|
|
14
|
+
* - Flexible composition through sub-components
|
|
15
|
+
* - Semantic HTML structure for accessibility
|
|
16
|
+
* - Consistent spacing and visual hierarchy
|
|
17
|
+
* - Support for interactive elements and actions
|
|
18
|
+
*
|
|
19
|
+
* @component
|
|
20
|
+
* @example
|
|
21
|
+
* ```tsx
|
|
22
|
+
* // Basic card with header and content
|
|
23
|
+
* <Card>
|
|
24
|
+
* <CardHeader>
|
|
25
|
+
* <CardTitle>Card Title</CardTitle>
|
|
26
|
+
* <CardDescription>Card description goes here</CardDescription>
|
|
27
|
+
* </CardHeader>
|
|
28
|
+
* <CardContent>
|
|
29
|
+
* <p>Card content goes here</p>
|
|
30
|
+
* </CardContent>
|
|
31
|
+
* </Card>
|
|
32
|
+
* ```
|
|
33
|
+
*
|
|
34
|
+
* @example
|
|
35
|
+
* ```tsx
|
|
36
|
+
* // Card with action button in header
|
|
37
|
+
* <Card>
|
|
38
|
+
* <CardHeader>
|
|
39
|
+
* <CardTitle>Settings</CardTitle>
|
|
40
|
+
* <CardAction>
|
|
41
|
+
* <Button variant="ghost" size="icon">
|
|
42
|
+
* <Settings />
|
|
43
|
+
* </Button>
|
|
44
|
+
* </CardAction>
|
|
45
|
+
* </CardHeader>
|
|
46
|
+
* <CardContent>
|
|
47
|
+
* <p>Manage your settings</p>
|
|
48
|
+
* </CardContent>
|
|
49
|
+
* <CardFooter>
|
|
50
|
+
* <Button>Save Changes</Button>
|
|
51
|
+
* </CardFooter>
|
|
52
|
+
* </Card>
|
|
53
|
+
* ```
|
|
54
|
+
*
|
|
55
|
+
* @example
|
|
56
|
+
* ```tsx
|
|
57
|
+
* // Minimal card with only content
|
|
58
|
+
* <Card>
|
|
59
|
+
* <CardContent>
|
|
60
|
+
* <p>Simple card content without header or footer</p>
|
|
61
|
+
* </CardContent>
|
|
62
|
+
* </Card>
|
|
63
|
+
* ```
|
|
64
|
+
*
|
|
65
|
+
* @example
|
|
66
|
+
* ```tsx
|
|
67
|
+
* // Product card with custom styling
|
|
68
|
+
* <Card className="w-80 hover:shadow-lg transition-shadow">
|
|
69
|
+
* <CardHeader>
|
|
70
|
+
* <div className="aspect-video bg-muted rounded-lg mb-4" />
|
|
71
|
+
* <CardTitle>Product Name</CardTitle>
|
|
72
|
+
* <CardDescription>Product description</CardDescription>
|
|
73
|
+
* <CardAction>
|
|
74
|
+
* <Badge variant="secondary">New</Badge>
|
|
75
|
+
* </CardAction>
|
|
76
|
+
* </CardHeader>
|
|
77
|
+
* <CardContent>
|
|
78
|
+
* <div className="flex items-center justify-between">
|
|
79
|
+
* <span className="text-2xl font-bold">$299</span>
|
|
80
|
+
* <span className="text-sm text-muted-foreground line-through">$399</span>
|
|
81
|
+
* </div>
|
|
82
|
+
* </CardContent>
|
|
83
|
+
* <CardFooter className="gap-2">
|
|
84
|
+
* <Button className="flex-1">Add to Cart</Button>
|
|
85
|
+
* <Button size="icon" variant="outline">
|
|
86
|
+
* <Heart className="size-4" />
|
|
87
|
+
* </Button>
|
|
88
|
+
* </CardFooter>
|
|
89
|
+
* </Card>
|
|
90
|
+
* ```
|
|
91
|
+
*
|
|
92
|
+
* @accessibility
|
|
93
|
+
* - Uses semantic HTML structure with proper div elements
|
|
94
|
+
* - Supports keyboard navigation for interactive elements within
|
|
95
|
+
* - Proper heading hierarchy when using CardTitle
|
|
96
|
+
* - Screen reader friendly with clear content structure
|
|
97
|
+
* - Focus management handled by interactive child components
|
|
98
|
+
*
|
|
99
|
+
* @param {string} [className] - Additional CSS classes to apply to the card
|
|
100
|
+
* @param {React.HTMLAttributes<HTMLDivElement>} props - Standard HTML div attributes
|
|
101
|
+
*
|
|
102
|
+
* @see {@link CardHeader} - Card header container with grid layout support
|
|
103
|
+
* @see {@link CardTitle} - Card title component for main headings
|
|
104
|
+
* @see {@link CardDescription} - Card description component for supplementary text
|
|
105
|
+
* @see {@link CardAction} - Card action container for header buttons/controls
|
|
106
|
+
* @see {@link CardContent} - Card content container for main body content
|
|
107
|
+
* @see {@link CardFooter} - Card footer container for actions and supplementary info
|
|
108
|
+
* @see {@link https://ui.shadcn.com/docs/components/card} - shadcn/ui Card documentation
|
|
109
|
+
* @since 1.0.0
|
|
110
|
+
*/
|
|
111
|
+
function Card({ className, ...props }: React.ComponentProps<"div">) {
|
|
112
|
+
return (
|
|
113
|
+
<div
|
|
114
|
+
data-slot="card"
|
|
115
|
+
className={cn(
|
|
116
|
+
"bg-card text-card-foreground flex flex-col gap-6 rounded-xl border py-6 shadow-sm",
|
|
117
|
+
className,
|
|
118
|
+
)}
|
|
119
|
+
{...props}
|
|
120
|
+
/>
|
|
121
|
+
);
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* CardHeader - Container for card header content
|
|
126
|
+
*
|
|
127
|
+
* Groups the card title, description, and optional action button.
|
|
128
|
+
* Automatically handles grid layout when CardAction is present, positioning
|
|
129
|
+
* the action to the right while allowing title and description to span
|
|
130
|
+
* the remaining space.
|
|
131
|
+
*
|
|
132
|
+
* Uses CSS Grid with container queries for responsive behavior:
|
|
133
|
+
* - Default: Single column layout for title and description
|
|
134
|
+
* - With CardAction: Two-column grid with action positioned top-right
|
|
135
|
+
* - Auto-adjusts spacing with gap utilities
|
|
136
|
+
*
|
|
137
|
+
* @component
|
|
138
|
+
* @example
|
|
139
|
+
* ```tsx
|
|
140
|
+
* // Basic header with title and description
|
|
141
|
+
* <CardHeader>
|
|
142
|
+
* <CardTitle>Dashboard Overview</CardTitle>
|
|
143
|
+
* <CardDescription>View your analytics and metrics</CardDescription>
|
|
144
|
+
* </CardHeader>
|
|
145
|
+
* ```
|
|
146
|
+
*
|
|
147
|
+
* @example
|
|
148
|
+
* ```tsx
|
|
149
|
+
* // Header with action button
|
|
150
|
+
* <CardHeader>
|
|
151
|
+
* <CardTitle>Settings</CardTitle>
|
|
152
|
+
* <CardDescription>Manage your preferences</CardDescription>
|
|
153
|
+
* <CardAction>
|
|
154
|
+
* <Button variant="ghost" size="icon">
|
|
155
|
+
* <MoreHorizontal className="size-4" />
|
|
156
|
+
* </Button>
|
|
157
|
+
* </CardAction>
|
|
158
|
+
* </CardHeader>
|
|
159
|
+
* ```
|
|
160
|
+
*
|
|
161
|
+
* @accessibility
|
|
162
|
+
* - Maintains proper heading structure with CardTitle
|
|
163
|
+
* - Supports responsive layout with container queries
|
|
164
|
+
* - Grid layout preserves reading order for screen readers
|
|
165
|
+
* - Action buttons maintain focus order
|
|
166
|
+
*
|
|
167
|
+
* @param {string} [className] - Additional CSS classes to apply
|
|
168
|
+
* @param {React.HTMLAttributes<HTMLDivElement>} props - Standard HTML div attributes
|
|
169
|
+
* @since 1.0.0
|
|
170
|
+
*/
|
|
171
|
+
function CardHeader({ className, ...props }: React.ComponentProps<"div">) {
|
|
172
|
+
return (
|
|
173
|
+
<div
|
|
174
|
+
data-slot="card-header"
|
|
175
|
+
className={cn(
|
|
176
|
+
"@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-1.5 px-6 has-data-[slot=card-action]:grid-cols-[1fr_auto] [.border-b]:pb-6",
|
|
177
|
+
className,
|
|
178
|
+
)}
|
|
179
|
+
{...props}
|
|
180
|
+
/>
|
|
181
|
+
);
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
/**
|
|
185
|
+
* CardTitle - The main title of a card
|
|
186
|
+
*
|
|
187
|
+
* Renders the primary heading for a card. Should be used within CardHeader
|
|
188
|
+
* to maintain proper semantic structure and visual hierarchy. Uses semibold
|
|
189
|
+
* font weight and leading-none for compact appearance.
|
|
190
|
+
*
|
|
191
|
+
* @component
|
|
192
|
+
* @example
|
|
193
|
+
* ```tsx
|
|
194
|
+
* <CardTitle>Dashboard Overview</CardTitle>
|
|
195
|
+
* ```
|
|
196
|
+
*
|
|
197
|
+
* @example
|
|
198
|
+
* ```tsx
|
|
199
|
+
* // With custom styling
|
|
200
|
+
* <CardTitle className="text-lg text-primary">
|
|
201
|
+
* Featured Product
|
|
202
|
+
* </CardTitle>
|
|
203
|
+
* ```
|
|
204
|
+
*
|
|
205
|
+
* @accessibility
|
|
206
|
+
* - Acts as the primary heading for the card content
|
|
207
|
+
* - Should maintain logical heading hierarchy in the document
|
|
208
|
+
* - Screen readers will identify this as the card's main topic
|
|
209
|
+
*
|
|
210
|
+
* @param {string} [className] - Additional CSS classes to apply
|
|
211
|
+
* @param {React.HTMLAttributes<HTMLDivElement>} props - Standard HTML div attributes
|
|
212
|
+
* @since 1.0.0
|
|
213
|
+
*/
|
|
214
|
+
function CardTitle({ className, ...props }: React.ComponentProps<"div">) {
|
|
215
|
+
return (
|
|
216
|
+
<div
|
|
217
|
+
data-slot="card-title"
|
|
218
|
+
className={cn("leading-none font-semibold", className)}
|
|
219
|
+
{...props}
|
|
220
|
+
/>
|
|
221
|
+
);
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
/**
|
|
225
|
+
* CardDescription - Supplementary description text for a card
|
|
226
|
+
*
|
|
227
|
+
* Provides additional context or details about the card content.
|
|
228
|
+
* Styled with muted foreground color and smaller text size to create
|
|
229
|
+
* visual hierarchy below the CardTitle.
|
|
230
|
+
*
|
|
231
|
+
* @component
|
|
232
|
+
* @example
|
|
233
|
+
* ```tsx
|
|
234
|
+
* <CardDescription>
|
|
235
|
+
* View and manage your dashboard settings
|
|
236
|
+
* </CardDescription>
|
|
237
|
+
* ```
|
|
238
|
+
*
|
|
239
|
+
* @example
|
|
240
|
+
* ```tsx
|
|
241
|
+
* // Multi-line description
|
|
242
|
+
* <CardDescription>
|
|
243
|
+
* This card contains important information about your account.
|
|
244
|
+
* Review the details and take action if needed.
|
|
245
|
+
* </CardDescription>
|
|
246
|
+
* ```
|
|
247
|
+
*
|
|
248
|
+
* @accessibility
|
|
249
|
+
* - Provides context for screen readers
|
|
250
|
+
* - Uses muted color that maintains sufficient contrast
|
|
251
|
+
* - Should be descriptive and concise
|
|
252
|
+
*
|
|
253
|
+
* @param {string} [className] - Additional CSS classes to apply
|
|
254
|
+
* @param {React.HTMLAttributes<HTMLDivElement>} props - Standard HTML div attributes
|
|
255
|
+
* @since 1.0.0
|
|
256
|
+
*/
|
|
257
|
+
function CardDescription({ className, ...props }: React.ComponentProps<"div">) {
|
|
258
|
+
return (
|
|
259
|
+
<div
|
|
260
|
+
data-slot="card-description"
|
|
261
|
+
className={cn("text-muted-foreground text-sm", className)}
|
|
262
|
+
{...props}
|
|
263
|
+
/>
|
|
264
|
+
);
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
/**
|
|
268
|
+
* CardAction - Container for card header actions
|
|
269
|
+
*
|
|
270
|
+
* Positioned to the right of the card header using CSS Grid positioning.
|
|
271
|
+
* Typically contains icon buttons, badges, or dropdown menus for card-specific
|
|
272
|
+
* actions. Automatically positioned when used within CardHeader.
|
|
273
|
+
*
|
|
274
|
+
* Grid positioning:
|
|
275
|
+
* - `col-start-2`: Places in second column
|
|
276
|
+
* - `row-span-2`: Spans both title and description rows
|
|
277
|
+
* - `row-start-1`: Starts from first row
|
|
278
|
+
* - `self-start justify-self-end`: Aligns to top-right
|
|
279
|
+
*
|
|
280
|
+
* @component
|
|
281
|
+
* @example
|
|
282
|
+
* ```tsx
|
|
283
|
+
* <CardAction>
|
|
284
|
+
* <Button variant="ghost" size="icon">
|
|
285
|
+
* <MoreHorizontal className="size-4" />
|
|
286
|
+
* </Button>
|
|
287
|
+
* </CardAction>
|
|
288
|
+
* ```
|
|
289
|
+
*
|
|
290
|
+
* @example
|
|
291
|
+
* ```tsx
|
|
292
|
+
* // With badge
|
|
293
|
+
* <CardAction>
|
|
294
|
+
* <Badge variant="secondary">New</Badge>
|
|
295
|
+
* </CardAction>
|
|
296
|
+
* ```
|
|
297
|
+
*
|
|
298
|
+
* @example
|
|
299
|
+
* ```tsx
|
|
300
|
+
* // With dropdown menu
|
|
301
|
+
* <CardAction>
|
|
302
|
+
* <DropdownMenu>
|
|
303
|
+
* <DropdownMenuTrigger asChild>
|
|
304
|
+
* <Button variant="ghost" size="icon">
|
|
305
|
+
* <MoreHorizontal className="size-4" />
|
|
306
|
+
* </Button>
|
|
307
|
+
* </DropdownMenuTrigger>
|
|
308
|
+
* <DropdownMenuContent>
|
|
309
|
+
* <DropdownMenuItem>Edit</DropdownMenuItem>
|
|
310
|
+
* <DropdownMenuItem>Delete</DropdownMenuItem>
|
|
311
|
+
* </DropdownMenuContent>
|
|
312
|
+
* </DropdownMenu>
|
|
313
|
+
* </CardAction>
|
|
314
|
+
* ```
|
|
315
|
+
*
|
|
316
|
+
* @accessibility
|
|
317
|
+
* - Interactive elements should have appropriate labels
|
|
318
|
+
* - Maintains logical tab order
|
|
319
|
+
* - Icon-only buttons should include aria-label
|
|
320
|
+
*
|
|
321
|
+
* @param {string} [className] - Additional CSS classes to apply
|
|
322
|
+
* @param {React.HTMLAttributes<HTMLDivElement>} props - Standard HTML div attributes
|
|
323
|
+
* @since 1.0.0
|
|
324
|
+
*/
|
|
325
|
+
function CardAction({ className, ...props }: React.ComponentProps<"div">) {
|
|
326
|
+
return (
|
|
327
|
+
<div
|
|
328
|
+
data-slot="card-action"
|
|
329
|
+
className={cn(
|
|
330
|
+
"col-start-2 row-span-2 row-start-1 self-start justify-self-end",
|
|
331
|
+
className,
|
|
332
|
+
)}
|
|
333
|
+
{...props}
|
|
334
|
+
/>
|
|
335
|
+
);
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
/**
|
|
339
|
+
* CardContent - Main content area of a card
|
|
340
|
+
*
|
|
341
|
+
* Contains the primary content for the card. Automatically applies
|
|
342
|
+
* horizontal padding to maintain consistent spacing with other card sections.
|
|
343
|
+
* Can contain any type of content including text, images, forms, or other
|
|
344
|
+
* components.
|
|
345
|
+
*
|
|
346
|
+
* @component
|
|
347
|
+
* @example
|
|
348
|
+
* ```tsx
|
|
349
|
+
* <CardContent>
|
|
350
|
+
* <p>Your main content goes here.</p>
|
|
351
|
+
* </CardContent>
|
|
352
|
+
* ```
|
|
353
|
+
*
|
|
354
|
+
* @example
|
|
355
|
+
* ```tsx
|
|
356
|
+
* // With custom spacing
|
|
357
|
+
* <CardContent className="py-4">
|
|
358
|
+
* <div className="space-y-4">
|
|
359
|
+
* <p>Multiple content elements</p>
|
|
360
|
+
* <Button>Action button</Button>
|
|
361
|
+
* </div>
|
|
362
|
+
* </CardContent>
|
|
363
|
+
* ```
|
|
364
|
+
*
|
|
365
|
+
* @accessibility
|
|
366
|
+
* - Contains the main content that screen readers will focus on
|
|
367
|
+
* - Should maintain logical content structure
|
|
368
|
+
* - Interactive elements should have proper focus management
|
|
369
|
+
*
|
|
370
|
+
* @param {string} [className] - Additional CSS classes to apply
|
|
371
|
+
* @param {React.HTMLAttributes<HTMLDivElement>} props - Standard HTML div attributes
|
|
372
|
+
* @since 1.0.0
|
|
373
|
+
*/
|
|
374
|
+
function CardContent({ className, ...props }: React.ComponentProps<"div">) {
|
|
375
|
+
return (
|
|
376
|
+
<div
|
|
377
|
+
data-slot="card-content"
|
|
378
|
+
className={cn("px-6", className)}
|
|
379
|
+
{...props}
|
|
380
|
+
/>
|
|
381
|
+
);
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
/**
|
|
385
|
+
* CardFooter - Footer area of a card, typically for actions
|
|
386
|
+
*
|
|
387
|
+
* Positioned at the bottom of the card and commonly used for action buttons,
|
|
388
|
+
* supplementary information, or navigation elements. Uses flexbox layout
|
|
389
|
+
* with automatic alignment of items. Can be styled with border-top when
|
|
390
|
+
* visual separation from content is needed.
|
|
391
|
+
*
|
|
392
|
+
* @component
|
|
393
|
+
* @example
|
|
394
|
+
* ```tsx
|
|
395
|
+
* // Basic footer with actions
|
|
396
|
+
* <CardFooter>
|
|
397
|
+
* <Button variant="outline">Cancel</Button>
|
|
398
|
+
* <Button>Save</Button>
|
|
399
|
+
* </CardFooter>
|
|
400
|
+
* ```
|
|
401
|
+
*
|
|
402
|
+
* @example
|
|
403
|
+
* ```tsx
|
|
404
|
+
* // Footer with gap for better spacing
|
|
405
|
+
* <CardFooter className="gap-2">
|
|
406
|
+
* <Button variant="outline" className="flex-1">Cancel</Button>
|
|
407
|
+
* <Button className="flex-1">Confirm</Button>
|
|
408
|
+
* </CardFooter>
|
|
409
|
+
* ```
|
|
410
|
+
*
|
|
411
|
+
* @example
|
|
412
|
+
* ```tsx
|
|
413
|
+
* // Footer with supplementary info
|
|
414
|
+
* <CardFooter className="justify-between">
|
|
415
|
+
* <span className="text-sm text-muted-foreground">Last updated 2 days ago</span>
|
|
416
|
+
* <Button size="sm">Edit</Button>
|
|
417
|
+
* </CardFooter>
|
|
418
|
+
* ```
|
|
419
|
+
*
|
|
420
|
+
* @accessibility
|
|
421
|
+
* - Action buttons should have descriptive labels
|
|
422
|
+
* - Maintains logical tab order for interactive elements
|
|
423
|
+
* - Consider aria-label for icon-only buttons
|
|
424
|
+
*
|
|
425
|
+
* @param {string} [className] - Additional CSS classes to apply
|
|
426
|
+
* @param {React.HTMLAttributes<HTMLDivElement>} props - Standard HTML div attributes
|
|
427
|
+
* @since 1.0.0
|
|
428
|
+
*/
|
|
429
|
+
function CardFooter({ className, ...props }: React.ComponentProps<"div">) {
|
|
430
|
+
return (
|
|
431
|
+
<div
|
|
432
|
+
data-slot="card-footer"
|
|
433
|
+
className={cn("flex items-center px-6 [.border-t]:pt-6", className)}
|
|
434
|
+
{...props}
|
|
435
|
+
/>
|
|
436
|
+
);
|
|
437
|
+
}
|
|
438
|
+
|
|
439
|
+
export {
|
|
440
|
+
Card,
|
|
441
|
+
CardHeader,
|
|
442
|
+
CardFooter,
|
|
443
|
+
CardTitle,
|
|
444
|
+
CardAction,
|
|
445
|
+
CardDescription,
|
|
446
|
+
CardContent,
|
|
447
|
+
};
|