@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,120 @@
|
|
|
1
|
+
---
|
|
2
|
+
# >>> DERIVED - regenerated by `npm run knowledge:sync`. Do not edit. <<<
|
|
3
|
+
derived:
|
|
4
|
+
schemaVersion: 1
|
|
5
|
+
id: tooltip
|
|
6
|
+
sourceFile: packages/design-system/src/components/tooltip.tsx
|
|
7
|
+
client: true
|
|
8
|
+
category: web-app-overlays
|
|
9
|
+
categoryFromBarrel: web-app-overlays
|
|
10
|
+
barrelExported: true
|
|
11
|
+
importPath: "@adres/mgda-ui"
|
|
12
|
+
exports:
|
|
13
|
+
- name: Tooltip
|
|
14
|
+
kind: component
|
|
15
|
+
radixSource: "@radix-ui/react-tooltip#Root"
|
|
16
|
+
typeText: "FC<TooltipProps>"
|
|
17
|
+
- name: TooltipContent
|
|
18
|
+
kind: component
|
|
19
|
+
typeText: "ForwardRefExoticComponent<TooltipContentProps & RefAttributes<HTMLDivElement>>"
|
|
20
|
+
- name: TooltipContentProps
|
|
21
|
+
kind: type
|
|
22
|
+
- name: TooltipProvider
|
|
23
|
+
kind: component
|
|
24
|
+
radixSource: "@radix-ui/react-tooltip#Provider"
|
|
25
|
+
typeText: "FC<TooltipProviderProps>"
|
|
26
|
+
- name: TooltipTrigger
|
|
27
|
+
kind: component
|
|
28
|
+
radixSource: "@radix-ui/react-tooltip#Trigger"
|
|
29
|
+
typeText: "ForwardRefExoticComponent<TooltipTriggerProps & RefAttributes<HTMLButtonElement>>"
|
|
30
|
+
primaryExport: Tooltip
|
|
31
|
+
subcomponents:
|
|
32
|
+
- TooltipContent
|
|
33
|
+
- TooltipProvider
|
|
34
|
+
- TooltipTrigger
|
|
35
|
+
props: {}
|
|
36
|
+
extendsProps: []
|
|
37
|
+
variants: {}
|
|
38
|
+
variantSource: none
|
|
39
|
+
compoundVariants: []
|
|
40
|
+
sizeMaps: []
|
|
41
|
+
dataSlots: []
|
|
42
|
+
dependsOn:
|
|
43
|
+
internal: []
|
|
44
|
+
lib:
|
|
45
|
+
- cn
|
|
46
|
+
hooks: []
|
|
47
|
+
external:
|
|
48
|
+
- "@radix-ui/react-tooltip"
|
|
49
|
+
- react
|
|
50
|
+
contexts: []
|
|
51
|
+
stories:
|
|
52
|
+
- exportName: Default
|
|
53
|
+
id: components-tooltip--default
|
|
54
|
+
storybookTitle: Components/Tooltip
|
|
55
|
+
docsId: components-tooltip--documentation
|
|
56
|
+
argTypeOptions: {}
|
|
57
|
+
resolvedCleanly: true
|
|
58
|
+
contractHash: "31db1aa44d25"
|
|
59
|
+
factsHash: "24dfe7587e75"
|
|
60
|
+
# >>> AUTHORED - humans own everything below this line. <<<
|
|
61
|
+
status: stable
|
|
62
|
+
summary: "A hover or focus-triggered label with no interactive content, built on Radix Tooltip."
|
|
63
|
+
useWhen:
|
|
64
|
+
- "adding a short, supplementary label that appears on hover or keyboard focus - an icon button's name, a truncated value's full text"
|
|
65
|
+
useInstead:
|
|
66
|
+
- id: popover
|
|
67
|
+
when: "the content needs to be interactive (buttons, links, a form) or triggered by a click"
|
|
68
|
+
- id: dropdown-menu
|
|
69
|
+
when: "the content is a list of selectable actions"
|
|
70
|
+
related:
|
|
71
|
+
- popover
|
|
72
|
+
a11y:
|
|
73
|
+
notes:
|
|
74
|
+
- "TooltipProvider must wrap the app (or at least the tooltip's subtree) once - it is not per-Tooltip, and a Tooltip will not work without an ancestor TooltipProvider."
|
|
75
|
+
- "Wrap the real trigger element with TooltipTrigger asChild the same way Popover/DropdownMenu do, so the tooltip's hover and focus handling attaches to the actual interactive element."
|
|
76
|
+
- "A tooltip is not a substitute for a real accessible name - an icon-only button still needs its own aria-label; the tooltip is supplementary, sighted-hover context, not the only source of the name for assistive tech."
|
|
77
|
+
keyboard:
|
|
78
|
+
- "Shows on keyboard focus as well as hover, and Escape dismisses it - unlike a pure CSS :hover tooltip, so keyboard-only users can still see it."
|
|
79
|
+
radixHandles: true
|
|
80
|
+
pitfalls:
|
|
81
|
+
- "TooltipContent is a passive label, not a place for interactive elements - putting a button or link inside a tooltip is a misuse; reach for Popover instead."
|
|
82
|
+
- "Content shown must stay genuinely short - the intentionally fast (100ms) show and hide animation and single-line-oriented styling assume a brief label, not a paragraph."
|
|
83
|
+
- "A missing TooltipProvider ancestor is a common integration bug - the Tooltip renders without erroring but never actually shows, since Radix's tooltip context has no default provider."
|
|
84
|
+
canonicalSnippet: |
|
|
85
|
+
import { Button, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "@adres/mgda-ui"
|
|
86
|
+
|
|
87
|
+
<TooltipProvider>
|
|
88
|
+
<Tooltip>
|
|
89
|
+
<TooltipTrigger asChild>
|
|
90
|
+
<Button variant="outline">Hover me</Button>
|
|
91
|
+
</TooltipTrigger>
|
|
92
|
+
<TooltipContent>Helpful tooltip text</TooltipContent>
|
|
93
|
+
</Tooltip>
|
|
94
|
+
</TooltipProvider>
|
|
95
|
+
reviewedAt: 2026-08-31
|
|
96
|
+
reviewedAgainstContractHash: "31db1aa44d25"
|
|
97
|
+
---
|
|
98
|
+
|
|
99
|
+
## Usage
|
|
100
|
+
|
|
101
|
+
`Tooltip` is for a short, non-interactive label shown on hover or keyboard
|
|
102
|
+
focus - an icon button's name, the full text behind a truncated value. Reach
|
|
103
|
+
for `Popover` instead the moment the content needs to be interactive or open
|
|
104
|
+
on click rather than hover.
|
|
105
|
+
|
|
106
|
+
`TooltipProvider` wraps the app (or the relevant subtree) once; it is not
|
|
107
|
+
per-`Tooltip`. Forgetting it is the most common integration mistake - the
|
|
108
|
+
component renders without an error but the tooltip never appears.
|
|
109
|
+
|
|
110
|
+
A tooltip is supplementary context, not the accessible name itself - an
|
|
111
|
+
icon-only trigger still needs its own `aria-label` for assistive tech.
|
|
112
|
+
|
|
113
|
+
## Anatomy
|
|
114
|
+
|
|
115
|
+
| Part | Role |
|
|
116
|
+
| --- | --- |
|
|
117
|
+
| `TooltipProvider` | Wraps the app or subtree once. Required for any `Tooltip` inside it to work. |
|
|
118
|
+
| `Tooltip` | Root. Holds open state for one tooltip instance. |
|
|
119
|
+
| `TooltipTrigger` | Shows the tooltip on hover or focus. Use `asChild` to wrap a real `Button` or icon. |
|
|
120
|
+
| `TooltipContent` | The label. Renders its own portal and positioning; keep its content brief. |
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
---
|
|
2
|
+
# >>> DERIVED - regenerated by `npm run knowledge:sync`. Do not edit. <<<
|
|
3
|
+
derived:
|
|
4
|
+
schemaVersion: 1
|
|
5
|
+
id: top-nav
|
|
6
|
+
sourceFile: packages/design-system/src/components/top-nav.tsx
|
|
7
|
+
client: true
|
|
8
|
+
category: web-app-layout-navigation
|
|
9
|
+
categoryFromBarrel: web-app-layout-navigation
|
|
10
|
+
barrelExported: true
|
|
11
|
+
importPath: "@adres/mgda-ui"
|
|
12
|
+
exports:
|
|
13
|
+
- name: Breadcrumbs
|
|
14
|
+
kind: component
|
|
15
|
+
typeText: "ForwardRefExoticComponent<BreadcrumbsProps & RefAttributes<HTMLElement>>"
|
|
16
|
+
- name: BreadcrumbsProps
|
|
17
|
+
kind: type
|
|
18
|
+
- name: TopNav
|
|
19
|
+
kind: component
|
|
20
|
+
typeText: "ForwardRefExoticComponent<TopNavProps & RefAttributes<HTMLElement>>"
|
|
21
|
+
- name: TopNavProps
|
|
22
|
+
kind: type
|
|
23
|
+
primaryExport: TopNav
|
|
24
|
+
subcomponents:
|
|
25
|
+
- Breadcrumbs
|
|
26
|
+
props:
|
|
27
|
+
Breadcrumbs:
|
|
28
|
+
- name: items
|
|
29
|
+
type: "{ label: string; href?: string | undefined; }[]"
|
|
30
|
+
required: true
|
|
31
|
+
declaredIn: self
|
|
32
|
+
- name: separator
|
|
33
|
+
type: ReactNode
|
|
34
|
+
required: false
|
|
35
|
+
declaredIn: self
|
|
36
|
+
doc: "Custom separator. Default: '/'."
|
|
37
|
+
TopNav:
|
|
38
|
+
- name: end
|
|
39
|
+
type: ReactNode
|
|
40
|
+
required: false
|
|
41
|
+
declaredIn: self
|
|
42
|
+
doc: "Right-aligned slot (search, notifications, user menu)."
|
|
43
|
+
- name: start
|
|
44
|
+
type: ReactNode
|
|
45
|
+
required: false
|
|
46
|
+
declaredIn: self
|
|
47
|
+
doc: "Left-aligned slot (typically breadcrumbs or a page title)."
|
|
48
|
+
extendsProps:
|
|
49
|
+
- "React.HTMLAttributes<HTMLElement>"
|
|
50
|
+
variants: {}
|
|
51
|
+
variantSource: none
|
|
52
|
+
compoundVariants: []
|
|
53
|
+
sizeMaps: []
|
|
54
|
+
dataSlots: []
|
|
55
|
+
dependsOn:
|
|
56
|
+
internal: []
|
|
57
|
+
lib:
|
|
58
|
+
- cn
|
|
59
|
+
hooks: []
|
|
60
|
+
external:
|
|
61
|
+
- react
|
|
62
|
+
contexts: []
|
|
63
|
+
stories:
|
|
64
|
+
- exportName: Default
|
|
65
|
+
id: components-topnav--default
|
|
66
|
+
storybookTitle: Components/TopNav
|
|
67
|
+
docsId: components-topnav--documentation
|
|
68
|
+
argTypeOptions: {}
|
|
69
|
+
resolvedCleanly: true
|
|
70
|
+
contractHash: "86f108bd34b0"
|
|
71
|
+
factsHash: f68fb2177011
|
|
72
|
+
# >>> AUTHORED - humans own everything below this line. <<<
|
|
73
|
+
status: stable
|
|
74
|
+
summary: "A sticky top app-shell bar with start/center/end slots, plus a Breadcrumbs helper for the start slot."
|
|
75
|
+
useWhen:
|
|
76
|
+
- "the app needs a persistent top bar (alongside or instead of a side Sidebar) for page context, search, and account/notification actions"
|
|
77
|
+
- "a breadcrumb trail for the current location (use the co-located Breadcrumbs)"
|
|
78
|
+
useInstead:
|
|
79
|
+
- id: page-header
|
|
80
|
+
when: "you need an in-content h1 + subtitle + actions row, not a sticky app-shell bar"
|
|
81
|
+
- id: sidebar
|
|
82
|
+
when: "the primary navigation should live in a persistent side column instead of (or in addition to) a top bar"
|
|
83
|
+
related:
|
|
84
|
+
- page-header
|
|
85
|
+
- sidebar
|
|
86
|
+
composesWith:
|
|
87
|
+
- search
|
|
88
|
+
- button
|
|
89
|
+
tokens:
|
|
90
|
+
- "--border"
|
|
91
|
+
- "--background"
|
|
92
|
+
- "--muted-foreground"
|
|
93
|
+
- "--foreground"
|
|
94
|
+
a11y:
|
|
95
|
+
notes:
|
|
96
|
+
- "TopNav renders a <header> with sticky top-0 positioning, so it stays a proper page landmark - don't nest a second <header> inside its start/end/children slots."
|
|
97
|
+
- "Breadcrumbs renders <nav aria-label=\"Breadcrumb\"> with an <ol>, and marks the current page's item with aria-current=\"page\" - the separator between items is aria-hidden."
|
|
98
|
+
requiredProps:
|
|
99
|
+
- "Breadcrumbs requires items; each entry needs label, and href only when that crumb should be a link"
|
|
100
|
+
keyboard:
|
|
101
|
+
- "Breadcrumb links are plain <a> elements - reachable and activatable via native link semantics. The current (last) item renders as plain text, not a link, so it is not a separate tab stop."
|
|
102
|
+
radixHandles: false
|
|
103
|
+
pitfalls:
|
|
104
|
+
- "TopNav's children prop is a third, center-aligned slot distinct from start/end - passing your page title as children centers it, which reads oddly next to breadcrumbs in start; most layouts want the title in start and leave children empty."
|
|
105
|
+
- "Breadcrumbs' last item is rendered as plain text even if it has an href - the component always treats the final entry as the current page, so a trailing href is silently unused for navigation."
|
|
106
|
+
subcomponentNotes:
|
|
107
|
+
Breadcrumbs: "A separate, standalone nav landmark - typically passed into TopNav's start slot, but composable anywhere a breadcrumb trail is needed."
|
|
108
|
+
rtl: "Layout uses flex with gap only (no physical left/right), so both TopNav's three slots and Breadcrumbs' item row mirror correctly under RTL with no extra work."
|
|
109
|
+
canonicalSnippet: |
|
|
110
|
+
import { TopNav, Breadcrumbs, Search } from "@adres/mgda-ui"
|
|
111
|
+
|
|
112
|
+
<TopNav
|
|
113
|
+
start={<Breadcrumbs items={[{ label: "Courses", href: "/courses" }, { label: "Algebra I" }]} />}
|
|
114
|
+
end={<Search placeholder="Search" />}
|
|
115
|
+
/>
|
|
116
|
+
reviewedAt: 2026-08-31
|
|
117
|
+
reviewedAgainstContractHash: "86f108bd34b0"
|
|
118
|
+
---
|
|
119
|
+
|
|
120
|
+
## Usage
|
|
121
|
+
|
|
122
|
+
TopNav is a sticky, blurred-background app-shell bar with three slots:
|
|
123
|
+
`start` (typically breadcrumbs or a page title), `children` (centered - use
|
|
124
|
+
sparingly, most layouts leave it empty), and `end` (search, notifications, a
|
|
125
|
+
user menu). It works standalone or alongside a `Sidebar` - the two don't
|
|
126
|
+
share any state.
|
|
127
|
+
|
|
128
|
+
`Breadcrumbs` is exported from the same file because it's the most common
|
|
129
|
+
`start` slot content, but it's fully independent and can be used anywhere a
|
|
130
|
+
breadcrumb trail is needed.
|
|
131
|
+
|
|
132
|
+
## Anatomy
|
|
133
|
+
|
|
134
|
+
- **TopNav** - the sticky bar itself: `start` / `children` / `end` slots in a
|
|
135
|
+
three-way flex row.
|
|
136
|
+
- **Breadcrumbs** - a standalone `<nav>` landmark rendering an ordered list
|
|
137
|
+
of crumbs; the last item is always the current page (plain text, not a
|
|
138
|
+
link) regardless of whether it has an `href`.
|