@adres/mgda-ui 0.0.0-stage → 0.0.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/brand-knowledge.json +451 -0
- package/knowledge/accordion.md +135 -0
- package/knowledge/activity-rings.md +123 -0
- package/knowledge/alert.md +184 -0
- package/knowledge/answer-actions.md +217 -0
- package/knowledge/aspect-ratio.md +82 -0
- package/knowledge/avatar.md +158 -0
- package/knowledge/badge.md +172 -0
- package/knowledge/bar-graph.md +167 -0
- package/knowledge/bento-grid.md +115 -0
- package/knowledge/blockquote.md +153 -0
- package/knowledge/box-list.md +177 -0
- package/knowledge/bullet-list.md +128 -0
- package/knowledge/button-group.md +179 -0
- package/knowledge/button.md +231 -0
- package/knowledge/calendar.md +168 -0
- package/knowledge/card.md +321 -0
- package/knowledge/cards-nav.md +170 -0
- package/knowledge/chain-of-thought.md +164 -0
- package/knowledge/chat-container.md +135 -0
- package/knowledge/chat-message.md +224 -0
- package/knowledge/checkbox-card.md +172 -0
- package/knowledge/checkbox.md +111 -0
- package/knowledge/citations.md +241 -0
- package/knowledge/combobox.md +265 -0
- package/knowledge/countdown-pill.md +153 -0
- package/knowledge/cta.md +118 -0
- package/knowledge/data-list.md +173 -0
- package/knowledge/data-table.md +220 -0
- package/knowledge/dialog.md +249 -0
- package/knowledge/drawer.md +236 -0
- package/knowledge/dropdown-menu.md +238 -0
- package/knowledge/dropzone.md +153 -0
- package/knowledge/email-chips-input.md +161 -0
- package/knowledge/empty-state.md +106 -0
- package/knowledge/entity-header.md +166 -0
- package/knowledge/feature-grid.md +120 -0
- package/knowledge/feedback-bar.md +127 -0
- package/knowledge/footer.md +116 -0
- package/knowledge/heading.md +189 -0
- package/knowledge/hero.md +361 -0
- package/knowledge/input-button.md +187 -0
- package/knowledge/input-group.md +185 -0
- package/knowledge/input.md +256 -0
- package/knowledge/inset.md +177 -0
- package/knowledge/kpi-card.md +206 -0
- package/knowledge/list-nav.md +181 -0
- package/knowledge/logo-cloud.md +102 -0
- package/knowledge/media-gallery.md +158 -0
- package/knowledge/message-actions.md +175 -0
- package/knowledge/nav-sidebar.md +225 -0
- package/knowledge/number-stepper.md +159 -0
- package/knowledge/page-header.md +109 -0
- package/knowledge/pagination.md +225 -0
- package/knowledge/popover.md +159 -0
- package/knowledge/pricing.md +132 -0
- package/knowledge/progress.md +156 -0
- package/knowledge/prompt-input.md +337 -0
- package/knowledge/prompt-suggestions.md +168 -0
- package/knowledge/quota-bar.md +160 -0
- package/knowledge/quote.md +116 -0
- package/knowledge/radio-card.md +172 -0
- package/knowledge/radio-group.md +135 -0
- package/knowledge/reasoning.md +142 -0
- package/knowledge/search.md +131 -0
- package/knowledge/section-nav.md +162 -0
- package/knowledge/segmented-control.md +181 -0
- package/knowledge/select-button.md +205 -0
- package/knowledge/select.md +210 -0
- package/knowledge/separator.md +75 -0
- package/knowledge/shimmer-text.md +140 -0
- package/knowledge/sidebar.md +227 -0
- package/knowledge/skeleton.md +142 -0
- package/knowledge/slider.md +133 -0
- package/knowledge/slideshow.md +159 -0
- package/knowledge/source.md +156 -0
- package/knowledge/spinner.md +120 -0
- package/knowledge/stat-strip.md +128 -0
- package/knowledge/stats.md +117 -0
- package/knowledge/step-indicator.md +157 -0
- package/knowledge/switch.md +88 -0
- package/knowledge/table.md +190 -0
- package/knowledge/tabs.md +169 -0
- package/knowledge/testimonials.md +115 -0
- package/knowledge/text-link.md +192 -0
- package/knowledge/text.md +194 -0
- package/knowledge/thinking-bar.md +115 -0
- package/knowledge/thinking-steps.md +140 -0
- package/knowledge/toaster.md +127 -0
- package/knowledge/toggle.md +113 -0
- package/knowledge/tool-call-card.md +241 -0
- package/knowledge/tooltip.md +120 -0
- package/knowledge/top-nav.md +138 -0
- package/knowledge.json +19854 -0
- package/package.json +94 -4
- package/src/components/accordion.stories.tsx +46 -0
- package/src/components/accordion.tsx +74 -0
- package/src/components/activity-rings.stories.tsx +73 -0
- package/src/components/activity-rings.tsx +121 -0
- package/src/components/alert.stories.tsx +43 -0
- package/src/components/alert.tsx +132 -0
- package/src/components/answer-actions.stories.tsx +54 -0
- package/src/components/answer-actions.test.tsx +37 -0
- package/src/components/answer-actions.tsx +313 -0
- package/src/components/aspect-ratio.stories.tsx +32 -0
- package/src/components/aspect-ratio.tsx +5 -0
- package/src/components/avatar.stories.tsx +40 -0
- package/src/components/avatar.tsx +154 -0
- package/src/components/badge.stories.tsx +27 -0
- package/src/components/badge.tsx +63 -0
- package/src/components/bar-graph.stories.tsx +28 -0
- package/src/components/bar-graph.tsx +204 -0
- package/src/components/bento-grid.stories.tsx +23 -0
- package/src/components/bento-grid.tsx +67 -0
- package/src/components/blockquote.stories.tsx +28 -0
- package/src/components/blockquote.tsx +88 -0
- package/src/components/box-list.stories.tsx +25 -0
- package/src/components/box-list.tsx +108 -0
- package/src/components/bullet-list.stories.tsx +22 -0
- package/src/components/bullet-list.tsx +101 -0
- package/src/components/button-group.stories.tsx +31 -0
- package/src/components/button-group.tsx +156 -0
- package/src/components/button.stories.tsx +66 -0
- package/src/components/button.test.ts +17 -0
- package/src/components/button.tsx +139 -0
- package/src/components/calendar.stories.tsx +25 -0
- package/src/components/calendar.tsx +367 -0
- package/src/components/card.stories.tsx +44 -0
- package/src/components/card.tsx +392 -0
- package/src/components/cards-nav.stories.tsx +35 -0
- package/src/components/cards-nav.tsx +115 -0
- package/src/components/chain-of-thought.stories.tsx +67 -0
- package/src/components/chain-of-thought.test.tsx +50 -0
- package/src/components/chain-of-thought.tsx +170 -0
- package/src/components/chat-container.stories.tsx +47 -0
- package/src/components/chat-container.test.tsx +49 -0
- package/src/components/chat-container.tsx +222 -0
- package/src/components/chat-message.stories.tsx +52 -0
- package/src/components/chat-message.test.tsx +36 -0
- package/src/components/chat-message.tsx +163 -0
- package/src/components/checkbox-card.stories.tsx +27 -0
- package/src/components/checkbox-card.tsx +200 -0
- package/src/components/checkbox.stories.tsx +26 -0
- package/src/components/checkbox.tsx +61 -0
- package/src/components/citations.stories.tsx +64 -0
- package/src/components/citations.test.tsx +61 -0
- package/src/components/citations.tsx +220 -0
- package/src/components/combobox.stories.tsx +184 -0
- package/src/components/combobox.test.tsx +82 -0
- package/src/components/combobox.tsx +407 -0
- package/src/components/countdown-pill.stories.tsx +24 -0
- package/src/components/countdown-pill.tsx +129 -0
- package/src/components/cta.stories.tsx +29 -0
- package/src/components/cta.tsx +52 -0
- package/src/components/data-list.stories.tsx +50 -0
- package/src/components/data-list.test.tsx +35 -0
- package/src/components/data-list.tsx +181 -0
- package/src/components/data-table.stories.tsx +29 -0
- package/src/components/data-table.tsx +200 -0
- package/src/components/dialog.stories.tsx +42 -0
- package/src/components/dialog.tsx +200 -0
- package/src/components/drawer.stories.tsx +48 -0
- package/src/components/drawer.tsx +385 -0
- package/src/components/dropdown-menu.stories.tsx +41 -0
- package/src/components/dropdown-menu.tsx +252 -0
- package/src/components/dropzone.stories.tsx +19 -0
- package/src/components/dropzone.tsx +250 -0
- package/src/components/email-chips-input.stories.tsx +135 -0
- package/src/components/email-chips-input.tsx +210 -0
- package/src/components/empty-state.stories.tsx +22 -0
- package/src/components/empty-state.tsx +35 -0
- package/src/components/entity-header.stories.tsx +43 -0
- package/src/components/entity-header.test.tsx +35 -0
- package/src/components/entity-header.tsx +92 -0
- package/src/components/feature-grid.stories.tsx +25 -0
- package/src/components/feature-grid.tsx +87 -0
- package/src/components/feedback-bar.stories.tsx +25 -0
- package/src/components/feedback-bar.test.tsx +24 -0
- package/src/components/feedback-bar.tsx +62 -0
- package/src/components/footer.stories.tsx +23 -0
- package/src/components/footer.tsx +78 -0
- package/src/components/heading.stories.tsx +45 -0
- package/src/components/heading.test.tsx +22 -0
- package/src/components/heading.tsx +77 -0
- package/src/components/hero.stories.tsx +38 -0
- package/src/components/hero.tsx +498 -0
- package/src/components/input-button.stories.tsx +19 -0
- package/src/components/input-button.tsx +112 -0
- package/src/components/input-group.stories.tsx +38 -0
- package/src/components/input-group.tsx +157 -0
- package/src/components/input.stories.tsx +31 -0
- package/src/components/input.tsx +284 -0
- package/src/components/inset.stories.tsx +29 -0
- package/src/components/inset.tsx +70 -0
- package/src/components/kpi-card.stories.tsx +29 -0
- package/src/components/kpi-card.tsx +284 -0
- package/src/components/list-nav.stories.tsx +22 -0
- package/src/components/list-nav.tsx +145 -0
- package/src/components/logo-cloud.stories.tsx +23 -0
- package/src/components/logo-cloud.tsx +42 -0
- package/src/components/media-gallery.stories.tsx +25 -0
- package/src/components/media-gallery.tsx +347 -0
- package/src/components/message-actions.stories.tsx +45 -0
- package/src/components/message-actions.test.tsx +32 -0
- package/src/components/message-actions.tsx +119 -0
- package/src/components/nav-sidebar.stories.tsx +58 -0
- package/src/components/nav-sidebar.test.tsx +54 -0
- package/src/components/nav-sidebar.tsx +462 -0
- package/src/components/number-stepper.stories.tsx +19 -0
- package/src/components/number-stepper.tsx +158 -0
- package/src/components/page-header.stories.tsx +25 -0
- package/src/components/page-header.tsx +64 -0
- package/src/components/pagination.stories.tsx +110 -0
- package/src/components/pagination.test.tsx +46 -0
- package/src/components/pagination.tsx +144 -0
- package/src/components/popover.stories.tsx +26 -0
- package/src/components/popover.tsx +62 -0
- package/src/components/pricing.stories.tsx +42 -0
- package/src/components/pricing.tsx +130 -0
- package/src/components/progress.stories.tsx +22 -0
- package/src/components/progress.tsx +189 -0
- package/src/components/prompt-input.stories.tsx +62 -0
- package/src/components/prompt-input.test.tsx +106 -0
- package/src/components/prompt-input.tsx +343 -0
- package/src/components/prompt-suggestions.stories.tsx +53 -0
- package/src/components/prompt-suggestions.test.tsx +37 -0
- package/src/components/prompt-suggestions.tsx +122 -0
- package/src/components/quota-bar.stories.tsx +19 -0
- package/src/components/quota-bar.tsx +191 -0
- package/src/components/quote.stories.tsx +18 -0
- package/src/components/quote.tsx +43 -0
- package/src/components/radio-card.stories.tsx +27 -0
- package/src/components/radio-card.tsx +225 -0
- package/src/components/radio-group.stories.tsx +32 -0
- package/src/components/radio-group.tsx +68 -0
- package/src/components/reasoning.stories.tsx +50 -0
- package/src/components/reasoning.test.tsx +48 -0
- package/src/components/reasoning.tsx +143 -0
- package/src/components/search.stories.tsx +18 -0
- package/src/components/search.tsx +133 -0
- package/src/components/section-nav.stories.tsx +59 -0
- package/src/components/section-nav.test.tsx +36 -0
- package/src/components/section-nav.tsx +146 -0
- package/src/components/segmented-control.stories.tsx +22 -0
- package/src/components/segmented-control.tsx +301 -0
- package/src/components/select-button.stories.tsx +27 -0
- package/src/components/select-button.tsx +174 -0
- package/src/components/select.stories.tsx +27 -0
- package/src/components/select.tsx +198 -0
- package/src/components/separator.stories.tsx +22 -0
- package/src/components/separator.tsx +23 -0
- package/src/components/shimmer-text.stories.tsx +23 -0
- package/src/components/shimmer-text.test.tsx +35 -0
- package/src/components/shimmer-text.tsx +43 -0
- package/src/components/sidebar.stories.tsx +25 -0
- package/src/components/sidebar.tsx +234 -0
- package/src/components/skeleton.stories.tsx +22 -0
- package/src/components/skeleton.tsx +96 -0
- package/src/components/slider.stories.tsx +20 -0
- package/src/components/slider.tsx +176 -0
- package/src/components/slideshow.stories.tsx +30 -0
- package/src/components/slideshow.tsx +291 -0
- package/src/components/source.stories.tsx +32 -0
- package/src/components/source.test.tsx +40 -0
- package/src/components/source.tsx +161 -0
- package/src/components/spinner.stories.tsx +19 -0
- package/src/components/spinner.tsx +76 -0
- package/src/components/stat-strip.stories.tsx +36 -0
- package/src/components/stat-strip.test.tsx +25 -0
- package/src/components/stat-strip.tsx +85 -0
- package/src/components/stats.stories.tsx +24 -0
- package/src/components/stats.tsx +83 -0
- package/src/components/step-indicator.stories.tsx +18 -0
- package/src/components/step-indicator.test.tsx +18 -0
- package/src/components/step-indicator.tsx +286 -0
- package/src/components/switch.stories.tsx +26 -0
- package/src/components/switch.tsx +32 -0
- package/src/components/table.stories.tsx +38 -0
- package/src/components/table.tsx +220 -0
- package/src/components/tabs.stories.tsx +25 -0
- package/src/components/tabs.tsx +276 -0
- package/src/components/testimonials.stories.tsx +22 -0
- package/src/components/testimonials.tsx +109 -0
- package/src/components/text-link.stories.tsx +47 -0
- package/src/components/text-link.test.tsx +18 -0
- package/src/components/text-link.tsx +88 -0
- package/src/components/text.stories.tsx +49 -0
- package/src/components/text.tsx +105 -0
- package/src/components/thinking-bar.stories.tsx +19 -0
- package/src/components/thinking-bar.test.tsx +27 -0
- package/src/components/thinking-bar.tsx +64 -0
- package/src/components/thinking-steps.stories.tsx +44 -0
- package/src/components/thinking-steps.test.tsx +42 -0
- package/src/components/thinking-steps.tsx +92 -0
- package/src/components/toaster.stories.tsx +80 -0
- package/src/components/toaster.tsx +36 -0
- package/src/components/toggle.stories.tsx +21 -0
- package/src/components/toggle.tsx +103 -0
- package/src/components/tool-call-card.stories.tsx +97 -0
- package/src/components/tool-call-card.test.tsx +88 -0
- package/src/components/tool-call-card.tsx +231 -0
- package/src/components/tooltip.stories.tsx +25 -0
- package/src/components/tooltip.tsx +43 -0
- package/src/components/top-nav.stories.tsx +20 -0
- package/src/components/top-nav.tsx +76 -0
- package/src/docs/Colors.stories.tsx +192 -0
- package/src/docs/GettingStarted.mdx +72 -0
- package/src/docs/Mcp.mdx +52 -0
- package/src/docs/Typography.stories.tsx +114 -0
- package/src/hooks/use-in-view.ts +32 -0
- package/src/hooks/use-reduced-motion.ts +26 -0
- package/src/index.ts +343 -0
- package/src/lib/cn.test.ts +67 -0
- package/src/lib/cn.ts +81 -0
- package/src/lib/motion.ts +109 -0
- package/src/lib/prefix-utilities.test.ts +56 -0
- package/src/lib/prefix-utilities.ts +50 -0
- package/src/styles/base.css +489 -0
- package/src/styles/motion.css +69 -0
- package/src/styles/overrides.css +44 -0
- package/src/styles/typography.css +173 -0
- package/src/theme/theme.css +391 -0
- package/src/theme/tokens.ts +29 -0
- package/src/theme/types.ts +26 -0
- package/README.md +0 -3
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
---
|
|
2
|
+
# >>> DERIVED - regenerated by `npm run knowledge:sync`. Do not edit. <<<
|
|
3
|
+
derived:
|
|
4
|
+
schemaVersion: 1
|
|
5
|
+
id: chat-container
|
|
6
|
+
sourceFile: packages/design-system/src/components/chat-container.tsx
|
|
7
|
+
client: true
|
|
8
|
+
category: web-app-ai
|
|
9
|
+
categoryFromBarrel: web-app-ai
|
|
10
|
+
barrelExported: true
|
|
11
|
+
importPath: "@adres/mgda-ui"
|
|
12
|
+
exports:
|
|
13
|
+
- name: ChatContainerContent
|
|
14
|
+
kind: component
|
|
15
|
+
typeText: "ForwardRefExoticComponent<ChatContainerContentProps & RefAttributes<HTMLDivElement>>"
|
|
16
|
+
- name: ChatContainerContentProps
|
|
17
|
+
kind: type
|
|
18
|
+
- name: ChatContainerRoot
|
|
19
|
+
kind: component
|
|
20
|
+
typeText: "ForwardRefExoticComponent<ChatContainerRootProps & RefAttributes<HTMLDivElement>>"
|
|
21
|
+
- name: ChatContainerRootProps
|
|
22
|
+
kind: type
|
|
23
|
+
- name: ChatContainerState
|
|
24
|
+
kind: type
|
|
25
|
+
- name: ChatScrollButton
|
|
26
|
+
kind: component
|
|
27
|
+
typeText: "ForwardRefExoticComponent<ChatScrollButtonProps & RefAttributes<HTMLButtonElement>>"
|
|
28
|
+
- name: ChatScrollButtonProps
|
|
29
|
+
kind: type
|
|
30
|
+
- name: useChatContainer
|
|
31
|
+
kind: hook
|
|
32
|
+
typeText: "() => ChatContainerState"
|
|
33
|
+
primaryExport: ChatContainerContent
|
|
34
|
+
subcomponents:
|
|
35
|
+
- ChatContainerRoot
|
|
36
|
+
- ChatScrollButton
|
|
37
|
+
props:
|
|
38
|
+
ChatScrollButton:
|
|
39
|
+
- name: asChild
|
|
40
|
+
type: boolean
|
|
41
|
+
required: false
|
|
42
|
+
declaredIn: button
|
|
43
|
+
doc: "When true, renders the child element instead of a button (e.g. for `<Link>`)."
|
|
44
|
+
- name: aurora
|
|
45
|
+
type: boolean
|
|
46
|
+
required: false
|
|
47
|
+
declaredIn: button
|
|
48
|
+
doc: "Decorative \"aurora\" - two soft, blurred orbs (primary + accent) drifting behind the label for a modern, glowing look. Designed for the `primary` variant. Ignored with `asChild` (it needs to inject its own children)."
|
|
49
|
+
extendsProps:
|
|
50
|
+
- "React.HTMLAttributes<HTMLDivElement>"
|
|
51
|
+
variants: {}
|
|
52
|
+
variantSource: none
|
|
53
|
+
compoundVariants: []
|
|
54
|
+
sizeMaps: []
|
|
55
|
+
dataSlots:
|
|
56
|
+
- chat-container
|
|
57
|
+
- chat-container-content
|
|
58
|
+
- chat-scroll-button
|
|
59
|
+
dependsOn:
|
|
60
|
+
internal:
|
|
61
|
+
- button
|
|
62
|
+
lib:
|
|
63
|
+
- cn
|
|
64
|
+
hooks: []
|
|
65
|
+
external:
|
|
66
|
+
- lucide-react
|
|
67
|
+
- react
|
|
68
|
+
contexts:
|
|
69
|
+
- name: ChatContainerContext
|
|
70
|
+
type: ChatContainerContextValue
|
|
71
|
+
default: null
|
|
72
|
+
stories:
|
|
73
|
+
- exportName: Default
|
|
74
|
+
id: components-chatcontainer--default
|
|
75
|
+
storybookTitle: Components/ChatContainer
|
|
76
|
+
docsId: components-chatcontainer--documentation
|
|
77
|
+
argTypeOptions: {}
|
|
78
|
+
resolvedCleanly: true
|
|
79
|
+
contractHash: "07ffc38de2ee"
|
|
80
|
+
factsHash: eae438b00211
|
|
81
|
+
# >>> AUTHORED - humans own everything below this line. <<<
|
|
82
|
+
status: beta
|
|
83
|
+
summary: "A conversation log that sticks to the latest message: it follows new and streaming content while the reader is at the bottom, stays put once they scroll up, and offers a button back down."
|
|
84
|
+
useWhen:
|
|
85
|
+
- "a chat or assistant conversation grows at the bottom and should follow new messages"
|
|
86
|
+
- "replies stream in and the reader may scroll up to reread earlier turns"
|
|
87
|
+
related:
|
|
88
|
+
- chat-message
|
|
89
|
+
- prompt-input
|
|
90
|
+
a11y:
|
|
91
|
+
notes:
|
|
92
|
+
- "ChatContainerContent is a focusable role=\"log\" named \"Conversation\" by default, so keyboard users can scroll it and new turns are announced politely."
|
|
93
|
+
- "ChatScrollButton is aria-hidden and out of the tab order while the reader is at the bottom."
|
|
94
|
+
- "The icon-only scroll button is labelled \"Scroll to latest\"; with unseen content it reads \"New messages\"."
|
|
95
|
+
radixHandles: false
|
|
96
|
+
pitfalls:
|
|
97
|
+
- "Give ChatContainerRoot a bounded height (a fixed height or flex-1 inside a sized column); without one the log never scrolls."
|
|
98
|
+
- "Call scrollToBottom from useChatContainer when the reader sends a message, so their own turn is always in view."
|
|
99
|
+
- "Only scrolling up stops following; content changes alone never do."
|
|
100
|
+
- "ChatScrollButton is not positioned; place it, usually absolute at the bottom centre of the root."
|
|
101
|
+
canonicalSnippet: |
|
|
102
|
+
import {
|
|
103
|
+
ChatContainerRoot, ChatContainerContent, ChatScrollButton, ChatMessage,
|
|
104
|
+
} from "@adres/mgda-ui"
|
|
105
|
+
|
|
106
|
+
<ChatContainerRoot className="ax:h-120">
|
|
107
|
+
<ChatContainerContent className="ax:gap-lg ax:p-md">
|
|
108
|
+
<ChatMessage from="user">{question}</ChatMessage>
|
|
109
|
+
<ChatMessage from="assistant">{answer}</ChatMessage>
|
|
110
|
+
</ChatContainerContent>
|
|
111
|
+
<ChatScrollButton className="ax:absolute ax:bottom-sm ax:left-1/2 ax:-translate-x-1/2" />
|
|
112
|
+
</ChatContainerRoot>
|
|
113
|
+
reviewedAt: 2026-10-06
|
|
114
|
+
reviewedAgainstContractHash: "07ffc38de2ee"
|
|
115
|
+
---
|
|
116
|
+
|
|
117
|
+
## Usage
|
|
118
|
+
|
|
119
|
+
`ChatContainerRoot` holds the scroll state and positions its children.
|
|
120
|
+
`ChatContainerContent` is the scrolling log that holds the turns; it starts at
|
|
121
|
+
the bottom and follows new and streaming content while the reader is there.
|
|
122
|
+
Once they scroll up it stays put, and `ChatScrollButton` appears: a round
|
|
123
|
+
arrow, which reads "New messages" when content arrived while they were away.
|
|
124
|
+
Clicking it scrolls smoothly back down and resumes following.
|
|
125
|
+
|
|
126
|
+
`useChatContainer` returns `isAtBottom`, `hasUnseen` and `scrollToBottom` for
|
|
127
|
+
custom controls inside the root. Call `scrollToBottom` when the reader sends a
|
|
128
|
+
message so their turn is always in view.
|
|
129
|
+
|
|
130
|
+
## Anatomy
|
|
131
|
+
|
|
132
|
+
- `ChatContainerRoot` - relative column that owns the scroll state.
|
|
133
|
+
- `ChatContainerContent` - the scrolling `role="log"` that holds the turns.
|
|
134
|
+
- `ChatScrollButton` - jump-to-latest button, shown only while scrolled up.
|
|
135
|
+
- `useChatContainer` - scroll state and `scrollToBottom` for custom parts.
|
|
@@ -0,0 +1,224 @@
|
|
|
1
|
+
---
|
|
2
|
+
# >>> DERIVED - regenerated by `npm run knowledge:sync`. Do not edit. <<<
|
|
3
|
+
derived:
|
|
4
|
+
schemaVersion: 1
|
|
5
|
+
id: chat-message
|
|
6
|
+
sourceFile: packages/design-system/src/components/chat-message.tsx
|
|
7
|
+
client: true
|
|
8
|
+
category: web-app-ai
|
|
9
|
+
categoryFromBarrel: web-app-ai
|
|
10
|
+
barrelExported: true
|
|
11
|
+
importPath: "@adres/mgda-ui"
|
|
12
|
+
exports:
|
|
13
|
+
- name: ChatAvatar
|
|
14
|
+
kind: component
|
|
15
|
+
typeText: "ForwardRefExoticComponent<ChatAvatarProps & RefAttributes<HTMLSpanElement>>"
|
|
16
|
+
- name: ChatAvatarProps
|
|
17
|
+
kind: type
|
|
18
|
+
- name: ChatDivider
|
|
19
|
+
kind: component
|
|
20
|
+
typeText: "ForwardRefExoticComponent<ChatDividerProps & RefAttributes<HTMLDivElement>>"
|
|
21
|
+
- name: ChatDividerProps
|
|
22
|
+
kind: type
|
|
23
|
+
- name: ChatMessage
|
|
24
|
+
kind: component
|
|
25
|
+
typeText: "ForwardRefExoticComponent<ChatMessageProps & RefAttributes<HTMLElement>>"
|
|
26
|
+
- name: ChatMessageFrom
|
|
27
|
+
kind: type
|
|
28
|
+
- name: ChatMessageProps
|
|
29
|
+
kind: type
|
|
30
|
+
- name: ChatMessageStatus
|
|
31
|
+
kind: type
|
|
32
|
+
primaryExport: ChatMessage
|
|
33
|
+
subcomponents:
|
|
34
|
+
- ChatAvatar
|
|
35
|
+
- ChatDivider
|
|
36
|
+
props:
|
|
37
|
+
ChatAvatar:
|
|
38
|
+
- name: children
|
|
39
|
+
type: ReactNode
|
|
40
|
+
required: false
|
|
41
|
+
declaredIn: self
|
|
42
|
+
doc: "Replaces the default bot icon, e.g. with an `AvatarImage`."
|
|
43
|
+
- name: size
|
|
44
|
+
type: "\"2xl\" | \"lg\" | \"md\" | \"sm\" | \"xl\" | \"xs\""
|
|
45
|
+
required: false
|
|
46
|
+
declaredIn: avatar
|
|
47
|
+
ChatDivider:
|
|
48
|
+
- name: label
|
|
49
|
+
type: string
|
|
50
|
+
required: true
|
|
51
|
+
declaredIn: self
|
|
52
|
+
doc: "Short system note, e.g. \"Today\" or \"Conversation restarted\"."
|
|
53
|
+
ChatMessage:
|
|
54
|
+
- name: actions
|
|
55
|
+
type: ReactNode
|
|
56
|
+
required: false
|
|
57
|
+
declaredIn: self
|
|
58
|
+
doc: "Assistant only. Usually `MessageActions`; sits after `meta` in the footer row."
|
|
59
|
+
- name: attachments
|
|
60
|
+
type: ReactNode
|
|
61
|
+
required: false
|
|
62
|
+
declaredIn: self
|
|
63
|
+
doc: "Content under the bubble, such as listing cards or a sources line."
|
|
64
|
+
- name: avatar
|
|
65
|
+
type: ReactNode
|
|
66
|
+
required: false
|
|
67
|
+
declaredIn: self
|
|
68
|
+
doc: "Assistant only. None by default; pass `<ChatAvatar />` to show one beside the turn."
|
|
69
|
+
- name: bare
|
|
70
|
+
type: boolean
|
|
71
|
+
required: false
|
|
72
|
+
declaredIn: self
|
|
73
|
+
doc: "Drops the bubble so `children` lay out freely, e.g. steps, tool runs or a cited answer."
|
|
74
|
+
- name: bodyClassName
|
|
75
|
+
type: string
|
|
76
|
+
required: false
|
|
77
|
+
declaredIn: self
|
|
78
|
+
doc: "Extra classes for the column that holds the bubble and footer."
|
|
79
|
+
- name: from
|
|
80
|
+
type: ChatMessageFrom
|
|
81
|
+
required: true
|
|
82
|
+
declaredIn: self
|
|
83
|
+
doc: "Who wrote it. Named `from` so it never clashes with the ARIA `role` attribute."
|
|
84
|
+
- name: meta
|
|
85
|
+
type: ReactNode
|
|
86
|
+
required: false
|
|
87
|
+
declaredIn: self
|
|
88
|
+
doc: "Small muted footer text, e.g. the time or \"Delivered · 10:42\"."
|
|
89
|
+
- name: onRetry
|
|
90
|
+
type: "(() => void)"
|
|
91
|
+
required: false
|
|
92
|
+
declaredIn: self
|
|
93
|
+
- name: status
|
|
94
|
+
type: ChatMessageStatus
|
|
95
|
+
required: false
|
|
96
|
+
declaredIn: self
|
|
97
|
+
doc: "User only. `failed` tints the bubble and swaps `meta` for a retry line."
|
|
98
|
+
extendsProps:
|
|
99
|
+
- "React.HTMLAttributes<HTMLElement>"
|
|
100
|
+
variants:
|
|
101
|
+
from:
|
|
102
|
+
kind: enum
|
|
103
|
+
options:
|
|
104
|
+
- assistant
|
|
105
|
+
- user
|
|
106
|
+
default: null
|
|
107
|
+
on: ChatMessage
|
|
108
|
+
status:
|
|
109
|
+
kind: enum
|
|
110
|
+
options:
|
|
111
|
+
- sent
|
|
112
|
+
- failed
|
|
113
|
+
default: sent
|
|
114
|
+
on: ChatMessage
|
|
115
|
+
size:
|
|
116
|
+
kind: enum
|
|
117
|
+
options:
|
|
118
|
+
- sm
|
|
119
|
+
- md
|
|
120
|
+
- xs
|
|
121
|
+
- lg
|
|
122
|
+
- xl
|
|
123
|
+
- "2xl"
|
|
124
|
+
default: sm
|
|
125
|
+
on: ChatAvatar
|
|
126
|
+
variantSource: prop-union
|
|
127
|
+
compoundVariants: []
|
|
128
|
+
sizeMaps: []
|
|
129
|
+
dataSlots:
|
|
130
|
+
- chat-divider
|
|
131
|
+
- chat-message
|
|
132
|
+
dependsOn:
|
|
133
|
+
internal:
|
|
134
|
+
- avatar
|
|
135
|
+
- separator
|
|
136
|
+
- text
|
|
137
|
+
- text-link
|
|
138
|
+
lib:
|
|
139
|
+
- cn
|
|
140
|
+
hooks: []
|
|
141
|
+
external:
|
|
142
|
+
- lucide-react
|
|
143
|
+
- react
|
|
144
|
+
contexts: []
|
|
145
|
+
stories:
|
|
146
|
+
- exportName: Default
|
|
147
|
+
id: components-chatmessage--default
|
|
148
|
+
- exportName: Conversation
|
|
149
|
+
id: components-chatmessage--conversation
|
|
150
|
+
- exportName: FailedUserMessage
|
|
151
|
+
id: components-chatmessage--failed-user-message
|
|
152
|
+
- exportName: WithAvatar
|
|
153
|
+
id: components-chatmessage--with-avatar
|
|
154
|
+
- exportName: CustomContent
|
|
155
|
+
id: components-chatmessage--custom-content
|
|
156
|
+
storybookTitle: Components/ChatMessage
|
|
157
|
+
docsId: components-chatmessage--documentation
|
|
158
|
+
argTypeOptions:
|
|
159
|
+
from:
|
|
160
|
+
- assistant
|
|
161
|
+
- user
|
|
162
|
+
status:
|
|
163
|
+
- sent
|
|
164
|
+
- failed
|
|
165
|
+
resolvedCleanly: true
|
|
166
|
+
contractHash: b63239d6c9a2
|
|
167
|
+
factsHash: "309973a564c7"
|
|
168
|
+
# >>> AUTHORED - humans own everything below this line. <<<
|
|
169
|
+
status: beta
|
|
170
|
+
summary: "One turn in a chat with an assistant: a primary-tinted bubble with actions for the assistant, a muted end-aligned bubble with delivery and retry for the user."
|
|
171
|
+
useWhen:
|
|
172
|
+
- "rendering the messages of an assistant or chat conversation"
|
|
173
|
+
- "an assistant turn holds custom content such as steps, tool runs or a cited answer"
|
|
174
|
+
- "a system note or date break sits between turns (ChatDivider)"
|
|
175
|
+
useInstead:
|
|
176
|
+
- id: card
|
|
177
|
+
when: "the content is not a turn in a conversation"
|
|
178
|
+
related:
|
|
179
|
+
- message-actions
|
|
180
|
+
- avatar
|
|
181
|
+
a11y:
|
|
182
|
+
notes:
|
|
183
|
+
- "Each turn is an article named \"Assistant message\" or \"Your message\"; wrap the list in role=\"log\" so new turns are announced."
|
|
184
|
+
- "A failed user turn renders Retry as a real button."
|
|
185
|
+
- "ChatDivider is role=\"separator\" with its label as the accessible name."
|
|
186
|
+
- "An avatar is decorative when shown; the article label already names the speaker."
|
|
187
|
+
radixHandles: false
|
|
188
|
+
pitfalls:
|
|
189
|
+
- "Use from, not role: role is the ARIA attribute and overrides the article's semantics."
|
|
190
|
+
- "String children get the message text style; pass your own Text when children are elements."
|
|
191
|
+
- "Assistant turns have no avatar by default; pass avatar={<ChatAvatar />} to show one."
|
|
192
|
+
- "meta is hidden on a failed user turn; the retry line takes its place."
|
|
193
|
+
canonicalSnippet: |
|
|
194
|
+
import { ChatMessage, MessageActions } from "@adres/mgda-ui"
|
|
195
|
+
|
|
196
|
+
<ChatMessage from="user" meta="Delivered · 10:41">{question}</ChatMessage>
|
|
197
|
+
<ChatMessage
|
|
198
|
+
from="assistant"
|
|
199
|
+
actions={<MessageActions copyText={answer} />}
|
|
200
|
+
meta="10:42"
|
|
201
|
+
>
|
|
202
|
+
{answer}
|
|
203
|
+
</ChatMessage>
|
|
204
|
+
reviewedAt: 2026-10-07
|
|
205
|
+
reviewedAgainstContractHash: "b63239d6c9a2"
|
|
206
|
+
---
|
|
207
|
+
|
|
208
|
+
## Usage
|
|
209
|
+
|
|
210
|
+
`ChatMessage` renders one turn. Set `from` to `assistant` or `user`. Assistant
|
|
211
|
+
turns sit in a `bg-primary-weaker` bubble at the start of the column, with
|
|
212
|
+
`attachments` underneath and a footer row of `meta` (the time, aligned to the bubble edge) then `actions`; pass `avatar={<ChatAvatar />}` to show
|
|
213
|
+
an avatar beside them. User turns align to the end in a muted 24px rounded
|
|
214
|
+
bubble with a `meta` line such as "Delivered · 10:41"; `status="failed"`
|
|
215
|
+
tints the bubble red and swaps `meta` for "Not delivered" with a Retry button
|
|
216
|
+
calling `onRetry`. `bare` drops the bubble on either side; `bodyClassName` changes the
|
|
217
|
+
assistant column gap. Each turn is a `group/message`, so
|
|
218
|
+
`MessageActions revealOnHover` can show actions on hover.
|
|
219
|
+
|
|
220
|
+
## Anatomy
|
|
221
|
+
|
|
222
|
+
- `ChatMessage` - the turn: avatar, bubble or bare content, attachments, footer.
|
|
223
|
+
- `ChatAvatar` - the assistant's mark; a small tinted avatar with a bot icon, opt-in via `avatar`.
|
|
224
|
+
- `ChatDivider` - a labelled rule between turns for system notes and date breaks.
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
---
|
|
2
|
+
# >>> DERIVED - regenerated by `npm run knowledge:sync`. Do not edit. <<<
|
|
3
|
+
derived:
|
|
4
|
+
schemaVersion: 1
|
|
5
|
+
id: checkbox-card
|
|
6
|
+
sourceFile: packages/design-system/src/components/checkbox-card.tsx
|
|
7
|
+
client: true
|
|
8
|
+
category: web-app-form-controls
|
|
9
|
+
categoryFromBarrel: web-app-form-controls
|
|
10
|
+
barrelExported: true
|
|
11
|
+
importPath: "@adres/mgda-ui"
|
|
12
|
+
exports:
|
|
13
|
+
- name: CheckboxCard
|
|
14
|
+
kind: component
|
|
15
|
+
typeText: "ForwardRefExoticComponent<CheckboxCardProps & RefAttributes<HTMLButtonElement>>"
|
|
16
|
+
- name: CheckboxCardDescription
|
|
17
|
+
kind: component
|
|
18
|
+
typeText: "ForwardRefExoticComponent<HTMLAttributes<HTMLParagraphElement> & RefAttributes<HTMLParagraphElement>>"
|
|
19
|
+
- name: CheckboxCardGroup
|
|
20
|
+
kind: component
|
|
21
|
+
typeText: "ForwardRefExoticComponent<CheckboxCardGroupProps & RefAttributes<HTMLDivElement>>"
|
|
22
|
+
- name: CheckboxCardGroupProps
|
|
23
|
+
kind: type
|
|
24
|
+
- name: CheckboxCardOrientation
|
|
25
|
+
kind: type
|
|
26
|
+
- name: CheckboxCardProps
|
|
27
|
+
kind: type
|
|
28
|
+
- name: CheckboxCardSize
|
|
29
|
+
kind: type
|
|
30
|
+
- name: CheckboxCardTitle
|
|
31
|
+
kind: component
|
|
32
|
+
typeText: "ForwardRefExoticComponent<HTMLAttributes<HTMLParagraphElement> & RefAttributes<HTMLParagraphElement>>"
|
|
33
|
+
primaryExport: CheckboxCard
|
|
34
|
+
subcomponents:
|
|
35
|
+
- CheckboxCardDescription
|
|
36
|
+
- CheckboxCardGroup
|
|
37
|
+
- CheckboxCardTitle
|
|
38
|
+
props:
|
|
39
|
+
CheckboxCard:
|
|
40
|
+
- name: children
|
|
41
|
+
type: ReactNode
|
|
42
|
+
required: false
|
|
43
|
+
declaredIn: self
|
|
44
|
+
- name: className
|
|
45
|
+
type: string
|
|
46
|
+
required: false
|
|
47
|
+
declaredIn: self
|
|
48
|
+
- name: size
|
|
49
|
+
type: "\"base\" | \"lg\" | \"sm\""
|
|
50
|
+
required: false
|
|
51
|
+
declaredIn: self
|
|
52
|
+
variantKey: true
|
|
53
|
+
CheckboxCardGroup:
|
|
54
|
+
- name: compact
|
|
55
|
+
type: boolean
|
|
56
|
+
required: false
|
|
57
|
+
declaredIn: self
|
|
58
|
+
- name: orientation
|
|
59
|
+
type: CheckboxCardOrientation
|
|
60
|
+
required: false
|
|
61
|
+
declaredIn: self
|
|
62
|
+
- name: size
|
|
63
|
+
type: CheckboxCardSize
|
|
64
|
+
required: false
|
|
65
|
+
declaredIn: self
|
|
66
|
+
variantKey: true
|
|
67
|
+
extendsProps:
|
|
68
|
+
- "VariantProps<typeof checkboxCardVariants>"
|
|
69
|
+
- "Pick< React.ComponentPropsWithoutRef<typeof CheckboxPrimitive.Root>, \"checked\" | \"defaultChecked\" | \"onCheckedChange\" | \"disabled\" | \"name\" | \"value\" | \"required\" >"
|
|
70
|
+
variants:
|
|
71
|
+
size:
|
|
72
|
+
kind: enum
|
|
73
|
+
options:
|
|
74
|
+
- sm
|
|
75
|
+
- base
|
|
76
|
+
- lg
|
|
77
|
+
default: base
|
|
78
|
+
on: CheckboxCard
|
|
79
|
+
variantSource: cva
|
|
80
|
+
compoundVariants: []
|
|
81
|
+
sizeMaps:
|
|
82
|
+
- CHECK_SIZE
|
|
83
|
+
- COMPACT_LAYOUT
|
|
84
|
+
dataSlots:
|
|
85
|
+
- checkbox-card-check
|
|
86
|
+
- checkbox-card-title
|
|
87
|
+
dependsOn:
|
|
88
|
+
internal: []
|
|
89
|
+
lib:
|
|
90
|
+
- cn
|
|
91
|
+
hooks: []
|
|
92
|
+
external:
|
|
93
|
+
- "@radix-ui/react-checkbox"
|
|
94
|
+
- class-variance-authority
|
|
95
|
+
- lucide-react
|
|
96
|
+
- react
|
|
97
|
+
contexts:
|
|
98
|
+
- name: CheckboxCardGroupContext
|
|
99
|
+
type: CheckboxCardGroupContextValue
|
|
100
|
+
default: null
|
|
101
|
+
stories:
|
|
102
|
+
- exportName: Default
|
|
103
|
+
id: components-checkboxcard--default
|
|
104
|
+
storybookTitle: Components/CheckboxCard
|
|
105
|
+
docsId: components-checkboxcard--documentation
|
|
106
|
+
argTypeOptions: {}
|
|
107
|
+
resolvedCleanly: true
|
|
108
|
+
contractHash: "82df47acbb1e"
|
|
109
|
+
factsHash: "8defa7684e0f"
|
|
110
|
+
# >>> AUTHORED - humans own everything below this line. <<<
|
|
111
|
+
status: stable
|
|
112
|
+
summary: "A large clickable card acting as a checkbox - a bordered surface with a title/description and a trailing check indicator, for multi-select option grids."
|
|
113
|
+
useWhen:
|
|
114
|
+
- "presenting several independently-selectable options as prominent cards rather than plain checkboxes - plan add-ons, feature toggles, settings with a title and description each"
|
|
115
|
+
useInstead:
|
|
116
|
+
- id: checkbox
|
|
117
|
+
when: "a compact list of options fits a plain checkbox and label better than a full card"
|
|
118
|
+
- id: radio-card
|
|
119
|
+
when: "only one option among several can be selected"
|
|
120
|
+
related:
|
|
121
|
+
- checkbox
|
|
122
|
+
- radio-card
|
|
123
|
+
a11y:
|
|
124
|
+
notes:
|
|
125
|
+
- "The actual Radix checkbox input is visually hidden (sr-only) inside a real label, so clicking anywhere on the card toggles it, and the accessible name comes from CheckboxCardTitle/CheckboxCardDescription's text content rather than a separate aria-label."
|
|
126
|
+
- "CheckboxCardGroup sets role=\"group\" for a labeled cluster of related checkboxes - pair it with a visible heading and aria-labelledby when the group's purpose is not obvious from surrounding context."
|
|
127
|
+
keyboard:
|
|
128
|
+
- "Native Radix checkbox keyboard behavior on the hidden input - Space toggles the focused card; Tab moves between cards."
|
|
129
|
+
radixHandles: true
|
|
130
|
+
pitfalls:
|
|
131
|
+
- "Each CheckboxCard manages its own checked state independently - CheckboxCardGroup only supplies shared size/layout context (size, compact, orientation), not any select-all or shared value logic."
|
|
132
|
+
- "compact is what collapses the cards into a connected strip (shared borders, only the first/last corners rounded) - size alone does not change this shape."
|
|
133
|
+
- "CheckboxCardTitle and CheckboxCardDescription rely on their data-slot attributes for the checked-state color styling defined on the parent card - swapping either for a plain paragraph silently drops the selected-state title tint."
|
|
134
|
+
canonicalSnippet: |
|
|
135
|
+
import { CheckboxCard, CheckboxCardDescription, CheckboxCardGroup, CheckboxCardTitle } from "@adres/mgda-ui"
|
|
136
|
+
|
|
137
|
+
<CheckboxCardGroup className="ax:max-w-md">
|
|
138
|
+
<CheckboxCard defaultChecked>
|
|
139
|
+
<CheckboxCardTitle>Email alerts</CheckboxCardTitle>
|
|
140
|
+
<CheckboxCardDescription>Receive updates about your account.</CheckboxCardDescription>
|
|
141
|
+
</CheckboxCard>
|
|
142
|
+
<CheckboxCard>
|
|
143
|
+
<CheckboxCardTitle>SMS alerts</CheckboxCardTitle>
|
|
144
|
+
<CheckboxCardDescription>Get text messages for urgent events.</CheckboxCardDescription>
|
|
145
|
+
</CheckboxCard>
|
|
146
|
+
</CheckboxCardGroup>
|
|
147
|
+
reviewedAt: 2026-08-31
|
|
148
|
+
reviewedAgainstContractHash: "82df47acbb1e"
|
|
149
|
+
---
|
|
150
|
+
|
|
151
|
+
## Usage
|
|
152
|
+
|
|
153
|
+
`CheckboxCard` turns a checkbox into a full clickable card - reach for it when
|
|
154
|
+
options deserve more visual weight than a plain `Checkbox` and label row (plan
|
|
155
|
+
add-ons, feature toggles, settings with a title and description each). For a
|
|
156
|
+
single-select version of the same pattern, use `RadioCard` instead.
|
|
157
|
+
|
|
158
|
+
`CheckboxCardGroup` only supplies shared `size`/`compact`/`orientation` layout
|
|
159
|
+
context - each `CheckboxCard` inside still manages its own checked state
|
|
160
|
+
independently; there is no built-in select-all or shared value.
|
|
161
|
+
|
|
162
|
+
Set `compact` to collapse the cards into a connected strip with shared
|
|
163
|
+
borders (only the first and last corners rounded) instead of a spaced grid.
|
|
164
|
+
|
|
165
|
+
## Anatomy
|
|
166
|
+
|
|
167
|
+
| Part | Role |
|
|
168
|
+
| --- | --- |
|
|
169
|
+
| `CheckboxCardGroup` | Layout wrapper. Owns `size`, `compact`, `orientation`, shared via context. Sets `role="group"`. |
|
|
170
|
+
| `CheckboxCard` | One card. Wraps a visually-hidden Radix checkbox in a real `<label>`, so the whole card is the click target. |
|
|
171
|
+
| `CheckboxCardTitle` | The card's heading. Its `data-slot` drives the checked-state color tint defined on the parent card. |
|
|
172
|
+
| `CheckboxCardDescription` | Supporting text below the title. |
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
---
|
|
2
|
+
# >>> DERIVED - regenerated by `npm run knowledge:sync`. Do not edit. <<<
|
|
3
|
+
derived:
|
|
4
|
+
schemaVersion: 1
|
|
5
|
+
id: checkbox
|
|
6
|
+
sourceFile: packages/design-system/src/components/checkbox.tsx
|
|
7
|
+
client: true
|
|
8
|
+
category: web-app-form-controls
|
|
9
|
+
categoryFromBarrel: web-app-form-controls
|
|
10
|
+
barrelExported: true
|
|
11
|
+
importPath: "@adres/mgda-ui"
|
|
12
|
+
exports:
|
|
13
|
+
- name: Checkbox
|
|
14
|
+
kind: component
|
|
15
|
+
typeText: "ForwardRefExoticComponent<CheckboxProps & RefAttributes<HTMLButtonElement>>"
|
|
16
|
+
- name: CheckboxProps
|
|
17
|
+
kind: type
|
|
18
|
+
primaryExport: Checkbox
|
|
19
|
+
subcomponents: []
|
|
20
|
+
props:
|
|
21
|
+
Checkbox:
|
|
22
|
+
- name: size
|
|
23
|
+
type: "\"base\" | \"lg\" | \"sm\""
|
|
24
|
+
required: false
|
|
25
|
+
declaredIn: self
|
|
26
|
+
variantKey: true
|
|
27
|
+
extendsProps:
|
|
28
|
+
- "React.ComponentPropsWithoutRef<typeof CheckboxPrimitive.Root>"
|
|
29
|
+
- "VariantProps<typeof checkboxVariants>"
|
|
30
|
+
variants:
|
|
31
|
+
size:
|
|
32
|
+
kind: enum
|
|
33
|
+
options:
|
|
34
|
+
- sm
|
|
35
|
+
- base
|
|
36
|
+
- lg
|
|
37
|
+
default: base
|
|
38
|
+
on: Checkbox
|
|
39
|
+
variantSource: cva
|
|
40
|
+
compoundVariants: []
|
|
41
|
+
sizeMaps:
|
|
42
|
+
- ICON_SIZE
|
|
43
|
+
dataSlots: []
|
|
44
|
+
dependsOn:
|
|
45
|
+
internal: []
|
|
46
|
+
lib:
|
|
47
|
+
- cn
|
|
48
|
+
hooks: []
|
|
49
|
+
external:
|
|
50
|
+
- "@radix-ui/react-checkbox"
|
|
51
|
+
- class-variance-authority
|
|
52
|
+
- lucide-react
|
|
53
|
+
- react
|
|
54
|
+
contexts: []
|
|
55
|
+
stories:
|
|
56
|
+
- exportName: Default
|
|
57
|
+
id: components-checkbox--default
|
|
58
|
+
- exportName: Checked
|
|
59
|
+
id: components-checkbox--checked
|
|
60
|
+
storybookTitle: Components/Checkbox
|
|
61
|
+
docsId: components-checkbox--documentation
|
|
62
|
+
argTypeOptions: {}
|
|
63
|
+
resolvedCleanly: true
|
|
64
|
+
contractHash: "38d59aafd860"
|
|
65
|
+
factsHash: e579584aec93
|
|
66
|
+
# >>> AUTHORED - humans own everything below this line. <<<
|
|
67
|
+
status: stable
|
|
68
|
+
summary: "A tri-state (checked, unchecked, indeterminate) checkbox, built on Radix Checkbox."
|
|
69
|
+
useWhen:
|
|
70
|
+
- "a form-bound boolean or tri-state selection, especially in a list, form, or table row - e.g. a select-all-with-indeterminate pattern"
|
|
71
|
+
useInstead:
|
|
72
|
+
- id: toggle
|
|
73
|
+
when: "the control is an immediate on/off setting that takes effect right away, not a form-bound selection to submit"
|
|
74
|
+
- id: radio-group
|
|
75
|
+
when: "only one option among several can be selected"
|
|
76
|
+
related:
|
|
77
|
+
- toggle
|
|
78
|
+
- radio-group
|
|
79
|
+
a11y:
|
|
80
|
+
notes:
|
|
81
|
+
- "checked accepts \"indeterminate\" as well as a boolean - use it for a parent select-all checkbox whose children are partially selected; Radix renders the Minus glyph automatically when checked=\"indeterminate\"."
|
|
82
|
+
- "Checkbox has no built-in label - pair it with a real label (wrapping both, or htmlFor pointing at the checkbox) so the control has an accessible name and a larger clickable hit target."
|
|
83
|
+
keyboard:
|
|
84
|
+
- "Native Radix button semantics - Space toggles the checkbox; it takes part in tab order automatically."
|
|
85
|
+
radixHandles: true
|
|
86
|
+
pitfalls:
|
|
87
|
+
- "indeterminate is not a stored value, only a checked state you pass in - usually derived from whether some-but-not-all children are selected. Clicking an indeterminate checkbox always resolves it to checked, never back to indeterminate, on its own."
|
|
88
|
+
- "size options are sm/base/lg - base, not md, is the name of the default middle size, unlike most other sized components in this system (Button, Input) which use sm/md/lg."
|
|
89
|
+
canonicalSnippet: |
|
|
90
|
+
import { Checkbox } from "@adres/mgda-ui"
|
|
91
|
+
|
|
92
|
+
<label className="ax:flex ax:items-center ax:gap-sm">
|
|
93
|
+
<Checkbox checked={checked} onCheckedChange={setChecked} />
|
|
94
|
+
<span>Accept terms</span>
|
|
95
|
+
</label>
|
|
96
|
+
reviewedAt: 2026-08-31
|
|
97
|
+
reviewedAgainstContractHash: "38d59aafd860"
|
|
98
|
+
---
|
|
99
|
+
|
|
100
|
+
## Usage
|
|
101
|
+
|
|
102
|
+
`Checkbox` is for a form-bound boolean or tri-state selection - reach for it
|
|
103
|
+
in lists, forms, or table rows, including select-all patterns where
|
|
104
|
+
`checked="indeterminate"` represents a partially-selected group. Reach for
|
|
105
|
+
`Toggle` instead when the control is an immediate setting rather than
|
|
106
|
+
something submitted with a form.
|
|
107
|
+
|
|
108
|
+
`Checkbox` renders no label of its own - always pair it with real label text,
|
|
109
|
+
either by wrapping both in a `<label>` (as in the example above) or pointing
|
|
110
|
+
a separate `<label htmlFor>` at it, so the control has an accessible name and
|
|
111
|
+
a larger clickable target than the box itself.
|