aidos-ui 4.0.0 → 4.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.
Files changed (93) hide show
  1. package/.claude/settings.local.json +14 -1
  2. package/CLAUDE.md +72 -0
  3. package/dist/BaseButton.js.map +1 -1
  4. package/dist/BaseLink.js.map +1 -1
  5. package/dist/BaseListItem.d.ts +1 -1
  6. package/dist/Calendar.d.ts +2 -2
  7. package/dist/DarkMode.js.map +1 -1
  8. package/dist/DatePicker.js.map +1 -1
  9. package/dist/Dialog.d.ts +3 -3
  10. package/dist/Dialog.js.map +1 -1
  11. package/dist/Dropdown.js.map +1 -1
  12. package/dist/Icon.d.ts +3 -3
  13. package/dist/Icon.js +2 -21
  14. package/dist/Icon.js.map +1 -1
  15. package/dist/Interactable.js.map +1 -1
  16. package/dist/NextJSRouterState.js.map +1 -1
  17. package/dist/OnVisible.d.ts +1 -1
  18. package/dist/OnVisible.js.map +1 -1
  19. package/dist/Popover.d.ts +3 -3
  20. package/dist/Popover.js.map +1 -1
  21. package/dist/Providers.d.ts +2 -2
  22. package/dist/RangeInput.d.ts +1 -1
  23. package/dist/RootView.js.map +1 -1
  24. package/dist/Select.d.ts +0 -1
  25. package/dist/Storage.d.ts +2 -1
  26. package/dist/Storage.js.map +1 -1
  27. package/dist/Stream.js.map +1 -1
  28. package/dist/Text.js.map +1 -1
  29. package/dist/TextInput.d.ts +3 -2
  30. package/dist/TextInput.js +13 -4
  31. package/dist/TextInput.js.map +1 -1
  32. package/dist/TextPairing.js.map +1 -1
  33. package/dist/Tooltip.d.ts +2 -2
  34. package/dist/Tooltip.js.map +1 -1
  35. package/dist/aria.js.map +1 -1
  36. package/dist/hash.js.map +1 -1
  37. package/dist/jss.d.ts +6 -6
  38. package/dist/jss.js +2 -2
  39. package/dist/jss.js.map +1 -1
  40. package/dist/numberToBase.js.map +1 -1
  41. package/dist/stateMachineContextFactory.js.map +1 -1
  42. package/dist/useCookie.js.map +1 -1
  43. package/dist/useKeyboard.js.map +1 -1
  44. package/dist/useNavigation.js.map +1 -1
  45. package/dist/useRefEffect.js.map +1 -1
  46. package/next-env.d.ts +2 -1
  47. package/next.config.js +2 -1
  48. package/package.json +27 -20
  49. package/src/BaseListItem.tsx +1 -1
  50. package/src/Calendar.tsx +2 -2
  51. package/src/Dialog.tsx +3 -3
  52. package/src/Icon.tsx +4 -30
  53. package/src/Popover.tsx +3 -3
  54. package/src/Providers.tsx +1 -1
  55. package/src/RangeInput.tsx +1 -1
  56. package/src/Storage.tsx +1 -1
  57. package/src/TextInput.tsx +17 -5
  58. package/src/Tooltip.tsx +2 -2
  59. package/src/docs/mdx.tsx +40 -0
  60. package/src/docs/searchIndex.ts +1 -1
  61. package/src/jss.tsx +3 -3
  62. package/src/pages/Badge.mdx +136 -14
  63. package/src/pages/Button.mdx +121 -63
  64. package/src/pages/Calendar.mdx +196 -2
  65. package/src/pages/Card.mdx +123 -47
  66. package/src/pages/Checkbox.mdx +103 -28
  67. package/src/pages/Dialog.mdx +172 -7
  68. package/src/pages/FlexLayout.mdx +185 -51
  69. package/src/pages/Hashing.mdx +199 -8
  70. package/src/pages/Icon.mdx +150 -42
  71. package/src/pages/IconButton.mdx +127 -116
  72. package/src/pages/Link.mdx +118 -47
  73. package/src/pages/List.mdx +167 -283
  74. package/src/pages/ListHeader.mdx +157 -27
  75. package/src/pages/Popover.mdx +177 -55
  76. package/src/pages/ProgressBar.mdx +186 -6
  77. package/src/pages/ProgressCircle.mdx +196 -13
  78. package/src/pages/RangeInput.mdx +189 -61
  79. package/src/pages/Tabs.mdx +202 -346
  80. package/src/pages/Text.mdx +102 -81
  81. package/src/pages/TextInput.mdx +169 -44
  82. package/src/pages/TextPairing.mdx +164 -115
  83. package/src/pages/TimeInput.mdx +142 -37
  84. package/src/pages/Tooltip.mdx +99 -12
  85. package/src/pages/_app.tsx +13 -3
  86. package/src/pages/css-in-js.mdx +196 -83
  87. package/src/pages/navigation.mdx +122 -20
  88. package/src/pages/useCookie.mdx +168 -7
  89. package/src/pages/useKeyboard.mdx +242 -5
  90. package/src/pages/useNavigation.mdx +244 -16
  91. package/src/pages/usePromise.mdx +271 -6
  92. package/src/pages/useRefEffect.mdx +230 -28
  93. package/tsconfig.json +13 -4
@@ -1,155 +1,204 @@
1
1
  import { TextPairing } from "../TextPairing";
2
2
  import { Column } from "../Column";
3
- import { ListDivider } from "../ListDivider";
3
+ import { Row } from "../Row";
4
4
  import { Icon } from "../Icon";
5
5
  import { cssVar } from "../jss";
6
6
 
7
7
  # TextPairing
8
8
 
9
- The `TextPairing` is a seemingly simple component that can be used to represent multiple visual ideas. Many of the other components use it to create more complex elements.
9
+ A versatile component for displaying a headline with optional body text and add-ons. TextPairing is the building block for list items, cards, and other compound components.
10
10
 
11
- In its simplest form a `TextPairing` is formed of two text elements (headline and body) laid out vertically. However it accepts multiple props to enable much more complex representations.
11
+ ---
12
12
 
13
- <Column
14
- jss={{ [" > *"]: { borderBottom: `1px solid ${cssVar("--divider")}` } }}
15
- >
16
- <TextPairing headline="Headline" body="Body" />
17
- <TextPairing headline="Headline" headlineBold body="Body" />
18
- <TextPairing
19
- headline="Headline"
20
- headlineBold
21
- headlineSize="large"
22
- body="Body"
23
- />
13
+ ## Props
14
+
15
+ | Prop | Type | Required | Default | Description |
16
+ |------|------|----------|---------|-------------|
17
+ | `headline` | `ReactNode` | Yes | - | Primary text content |
18
+ | `body` | `ReactNode` | No | - | Secondary text below headline |
19
+ | `headlineColor` | `TextColor` | No | `"primary"` | Headline text color |
20
+ | `headlineSize` | `Size` | No | `"medium"` | Headline text size |
21
+ | `headlineBold` | `boolean` | No | `false` | Bold headline text |
22
+ | `headlineAddOn` | `ReactNode` | No | - | Element displayed after headline |
23
+ | `bodyColor` | `TextColor` | No | `"secondary"` | Body text color |
24
+ | `bodySize` | `Size` | No | `"medium"` | Body text size |
25
+ | `addOn` | `ReactNode` | No | - | Element displayed beside the text content |
26
+ | `addOnPosition` | `"start"` \| `"end"` | No | `"start"` | Add-on placement |
27
+ | `gap` | `Gap` | No | `"small"` | Space between add-on and text |
28
+ | `padding` | `Padding` | No | - | Internal padding |
29
+ | `align` | `Align` | No | `"stretch"` | Vertical alignment |
30
+ | `grow` | `boolean` | No | `false` | Allow component to grow |
31
+ | `shrink` | `boolean` | No | `false` | Allow component to shrink |
32
+
33
+ ---
34
+
35
+ ## Basic usage
36
+
37
+ At its simplest, TextPairing displays a headline and body text vertically stacked.
38
+
39
+ <Column gap="large">
40
+ <TextPairing headline="Headline" body="Body text goes here" />
41
+ <TextPairing headline="Bold headline" headlineBold body="With supporting body text" />
42
+ </Column>
43
+
44
+ ```js
45
+ <TextPairing headline="Headline" body="Body text" />
46
+
47
+ <TextPairing
48
+ headline="Bold headline"
49
+ headlineBold
50
+ body="With supporting body text"
51
+ />
52
+ ```
53
+
54
+ ---
55
+
56
+ ## Customizing text styles
57
+
58
+ Control the size and color of both headline and body independently.
59
+
60
+ <Column gap="large">
24
61
  <TextPairing
25
- headline="Headline"
26
- headlineBold
62
+ headline="Large headline"
27
63
  headlineSize="large"
28
- body="Body"
29
- bodyColor="subtle"
30
- />
31
- <TextPairing
32
- headline="Headline"
33
64
  headlineBold
34
- headlineSize="large"
35
- body="Body"
36
- bodyColor="subtle"
65
+ body="Smaller subtle body"
37
66
  bodySize="small"
38
- />
39
- <TextPairing
40
- headline="Headline"
41
- headlineBold
42
- headlineSize="large"
43
- body="Body"
44
67
  bodyColor="subtle"
45
- bodySize="small"
46
- addOn={<Icon icon="fa-bicycle" color="primary" size="xxlarge" />}
47
68
  />
48
69
  <TextPairing
49
- headline="Headline"
50
- headlineBold
51
- headlineSize="large"
52
- body="Body"
53
- bodyColor="subtle"
54
- bodySize="small"
55
- addOn={<Icon icon="fa-bicycle" color="primary" size="xxlarge" />}
56
- gap="medium"
70
+ headline="Highlight headline"
71
+ headlineColor="highlight"
72
+ body="Secondary body text"
73
+ bodyColor="secondary"
57
74
  />
75
+ </Column>
76
+
77
+ ```js
78
+ <TextPairing
79
+ headline="Large headline"
80
+ headlineSize="large"
81
+ headlineBold
82
+ body="Smaller subtle body"
83
+ bodySize="small"
84
+ bodyColor="subtle"
85
+ />
86
+
87
+ <TextPairing
88
+ headline="Highlight headline"
89
+ headlineColor="highlight"
90
+ body="Secondary body text"
91
+ />
92
+ ```
93
+
94
+ ---
95
+
96
+ ## With add-on
97
+
98
+ Add icons, avatars, or other elements alongside the text content. Control placement with `addOnPosition`.
99
+
100
+ <Column gap="large">
58
101
  <TextPairing
59
- headline="Headline"
60
- headlineBold
61
- headlineSize="large"
62
- body="Body"
63
- bodyColor="subtle"
64
- bodySize="small"
65
- addOn={<Icon icon="fa-bicycle" color="primary" size="xxlarge" />}
102
+ headline="Notification"
103
+ body="You have a new message"
104
+ addOn={<Icon icon="fa-bell" color="highlight" size="large" />}
66
105
  gap="medium"
67
- addOnPosition="end"
68
106
  />
69
107
  <TextPairing
70
- headline="Headline"
71
- headlineBold
72
- headlineSize="large"
73
- body="Body"
74
- bodyColor="subtle"
75
- bodySize="small"
76
- addOn={<Icon icon="fa-bicycle" color="primary" size="xxlarge" />}
77
- headlineAddOn={<Icon icon="fa-plus" color="primary" size="small" />}
78
- gap="medium"
108
+ headline="Settings"
109
+ body="Configure your preferences"
110
+ addOn={<Icon icon="fa-cog" color="secondary" size="large" />}
79
111
  addOnPosition="end"
112
+ gap="medium"
80
113
  />
81
114
  </Column>
82
115
 
83
116
  ```js
84
- <Column
85
- jss={{ [" > *"]: { borderBottom: `1px solid ${cssVar("--divider")}` } }}
86
- >
87
- <TextPairing headline="Headline" body="Body" />
88
- <TextPairing headline="Headline" headlineBold body="Body" />
89
- <TextPairing
90
- headline="Headline"
91
- headlineBold
92
- headlineSize="large"
93
- body="Body"
94
- />
95
- <TextPairing
96
- headline="Headline"
97
- headlineBold
98
- headlineSize="large"
99
- body="Body"
100
- bodyColor="subtle"
101
- />
102
- <TextPairing
103
- headline="Headline"
104
- headlineBold
105
- headlineSize="large"
106
- body="Body"
107
- bodyColor="subtle"
108
- bodySize="small"
109
- />
110
- <TextPairing
111
- headline="Headline"
112
- headlineBold
113
- headlineSize="large"
114
- body="Body"
115
- bodyColor="subtle"
116
- bodySize="small"
117
- addOn={<Icon icon="fa-bicycle" color="primary" size="xxlarge" />}
118
- />
119
- <TextPairing
120
- headline="Headline"
121
- headlineBold
122
- headlineSize="large"
123
- body="Body"
124
- bodyColor="subtle"
125
- bodySize="small"
126
- addOn={<Icon icon="fa-bicycle" color="primary" size="xxlarge" />}
127
- gap="medium"
128
- />
117
+ // Add-on at start (default)
118
+ <TextPairing
119
+ headline="Notification"
120
+ body="You have a new message"
121
+ addOn={<Icon icon="fa-bell" color="highlight" size="large" />}
122
+ gap="medium"
123
+ />
124
+
125
+ // Add-on at end
126
+ <TextPairing
127
+ headline="Settings"
128
+ body="Configure your preferences"
129
+ addOn={<Icon icon="fa-cog" color="secondary" size="large" />}
130
+ addOnPosition="end"
131
+ gap="medium"
132
+ />
133
+ ```
134
+
135
+ ---
136
+
137
+ ## With headline add-on
138
+
139
+ Place small elements directly after the headline text, such as badges or status indicators.
140
+
141
+ <Column gap="large">
129
142
  <TextPairing
130
- headline="Headline"
143
+ headline="New feature"
131
144
  headlineBold
132
- headlineSize="large"
133
- body="Body"
134
- bodyColor="subtle"
135
- bodySize="small"
136
- addOn={<Icon icon="fa-bicycle" color="primary" size="xxlarge" />}
137
- gap="medium"
138
- addOnPosition="end"
145
+ headlineAddOn={<Icon icon="fa-star" color="highlight" size="small" />}
146
+ body="Check out what's new"
139
147
  />
148
+ </Column>
149
+
150
+ ```js
151
+ <TextPairing
152
+ headline="New feature"
153
+ headlineBold
154
+ headlineAddOn={<Icon icon="fa-star" color="highlight" size="small" />}
155
+ body="Check out what's new"
156
+ />
157
+ ```
158
+
159
+ ---
160
+
161
+ ## Complete example
162
+
163
+ Combining all options for a rich list item appearance.
164
+
165
+ <Column gap="medium">
140
166
  <TextPairing
141
- headline="Headline"
167
+ headline="John Doe"
142
168
  headlineBold
143
169
  headlineSize="large"
144
- body="Body"
170
+ headlineAddOn={<Icon icon="fa-check-circle" color="highlight" size="small" />}
171
+ body="Senior Software Engineer"
145
172
  bodyColor="subtle"
146
173
  bodySize="small"
147
- addOn={<Icon icon="fa-bicycle" color="primary" size="xxlarge" />}
148
- headlineAddOn={<Icon icon="fa-plus" color="primary" size="small" />}
174
+ addOn={<Icon icon="fa-user" color="primary" size="xlarge" />}
149
175
  gap="medium"
150
- addOnPosition="end"
176
+ padding="medium"
151
177
  />
152
178
  </Column>
179
+
180
+ ```js
181
+ <TextPairing
182
+ headline="John Doe"
183
+ headlineBold
184
+ headlineSize="large"
185
+ headlineAddOn={<Icon icon="fa-check-circle" color="highlight" size="small" />}
186
+ body="Senior Software Engineer"
187
+ bodyColor="subtle"
188
+ bodySize="small"
189
+ addOn={<Icon icon="fa-user" color="primary" size="xlarge" />}
190
+ gap="medium"
191
+ padding="medium"
192
+ />
153
193
  ```
154
194
 
155
195
  ---
196
+
197
+ ## Use cases
198
+
199
+ TextPairing is commonly used within:
200
+
201
+ - **List items** - Display title and description with icons
202
+ - **Cards** - Header sections with titles and subtitles
203
+ - **Navigation** - Menu items with labels and descriptions
204
+ - **Settings** - Option labels with explanatory text
@@ -1,45 +1,49 @@
1
1
  import { Column } from "../Column";
2
+ import { Row } from "../Row";
2
3
  import { TimeInput } from "../TimeInput";
3
4
  import { Icon } from "../Icon";
5
+ import { Span } from "../Text";
4
6
 
5
7
  # TimeInput
6
8
 
7
- The `TimeInput` component can be used to get the time (hour and minute) from the user.
9
+ A styled time picker component that wraps the native HTML `<input type="time">` element. Returns hours and minutes as a Date object.
10
+
11
+ ---
12
+
13
+ ## Props
14
+
15
+ | Prop | Type | Default | Description |
16
+ |------|------|---------|-------------|
17
+ | `time` | `Date` | Required | Current time value |
18
+ | `onTimeChange` | `(date: Date) => void` | Required | Called when time changes |
19
+ | `bare` | `boolean` | `false` | Remove border and background styling |
20
+ | `disabled` | `boolean` | - | Disables the input |
21
+ | `addOn` | `ReactNode` | - | Icon or element to display |
22
+ | `addOnPosition` | `"start" \| "end"` | `"start"` | Position of the add-on |
23
+ | `gap` | `Gap` | `"none"` | Space between elements |
24
+ | `padding` | `Padding` | `"small"` | Container padding |
25
+
26
+ ---
27
+
28
+ ## Basic usage
8
29
 
9
30
  <Column gap="medium" jss={{ maxWidth: 150 }}>
10
31
  <TimeInput time={new Date()} onTimeChange={() => {}} />
11
- <TimeInput
12
- addOn={<Icon icon="fa-clock-o" color="primary" size="medium" />}
13
- time={new Date()}
14
- onTimeChange={() => {}}
15
- />
16
- <TimeInput
17
- addOn={<Icon icon="fa-clock-o" color="primary" size="medium" />}
18
- addOnPosition="end"
19
- time={new Date()}
20
- onTimeChange={() => {}}
21
- />
22
- <TimeInput bare time={new Date()} onTimeChange={() => {}} />
23
- <TimeInput
24
- bare
25
- addOn={<Icon icon="fa-clock-o" color="primary" size="medium" />}
26
- time={new Date()}
27
- onTimeChange={() => {}}
28
- />
29
- <TimeInput
30
- bare
31
- addOn={<Icon icon="fa-clock-o" color="primary" size="medium" />}
32
- addOnPosition="end"
33
- time={new Date()}
34
- onTimeChange={() => {}}
35
- />
36
- <TimeInput disabled time={new Date()} onTimeChange={() => {}} />
37
- <TimeInput bare disabled time={new Date()} onTimeChange={() => {}} />
38
32
  </Column>
39
33
 
40
34
  ```js
41
- <Column gap="medium" jss={{ maxWidth: 150 }}>
42
- <TimeInput time={new Date()} onTimeChange={() => {}} />
35
+ const [time, setTime] = useState(new Date());
36
+
37
+ <TimeInput time={time} onTimeChange={setTime} />
38
+ ```
39
+
40
+ ---
41
+
42
+ ## With icon
43
+
44
+ Add a clock icon for visual context:
45
+
46
+ <Column gap="medium" jss={{ maxWidth: 200 }}>
43
47
  <TimeInput
44
48
  addOn={<Icon icon="fa-clock-o" color="primary" size="medium" />}
45
49
  time={new Date()}
@@ -51,6 +55,32 @@ The `TimeInput` component can be used to get the time (hour and minute) from the
51
55
  time={new Date()}
52
56
  onTimeChange={() => {}}
53
57
  />
58
+ </Column>
59
+
60
+ ```js
61
+ // Icon at start (default)
62
+ <TimeInput
63
+ addOn={<Icon icon="fa-clock-o" color="primary" size="medium" />}
64
+ time={time}
65
+ onTimeChange={setTime}
66
+ />
67
+
68
+ // Icon at end
69
+ <TimeInput
70
+ addOn={<Icon icon="fa-clock-o" color="primary" size="medium" />}
71
+ addOnPosition="end"
72
+ time={time}
73
+ onTimeChange={setTime}
74
+ />
75
+ ```
76
+
77
+ ---
78
+
79
+ ## Bare variant
80
+
81
+ The bare variant removes the border and background, useful for inline editing:
82
+
83
+ <Column gap="medium" jss={{ maxWidth: 200 }}>
54
84
  <TimeInput bare time={new Date()} onTimeChange={() => {}} />
55
85
  <TimeInput
56
86
  bare
@@ -58,16 +88,91 @@ The `TimeInput` component can be used to get the time (hour and minute) from the
58
88
  time={new Date()}
59
89
  onTimeChange={() => {}}
60
90
  />
61
- <TimeInput
62
- bare
63
- addOn={<Icon icon="fa-clock-o" color="primary" size="medium" />}
64
- addOnPosition="end"
65
- time={new Date()}
66
- onTimeChange={() => {}}
67
- />
91
+ </Column>
92
+
93
+ ```js
94
+ <TimeInput bare time={time} onTimeChange={setTime} />
95
+
96
+ <TimeInput
97
+ bare
98
+ addOn={<Icon icon="fa-clock-o" color="primary" size="medium" />}
99
+ time={time}
100
+ onTimeChange={setTime}
101
+ />
102
+ ```
103
+
104
+ ---
105
+
106
+ ## Disabled state
107
+
108
+ <Column gap="medium" jss={{ maxWidth: 200 }}>
68
109
  <TimeInput disabled time={new Date()} onTimeChange={() => {}} />
69
110
  <TimeInput bare disabled time={new Date()} onTimeChange={() => {}} />
70
111
  </Column>
112
+
113
+ ```js
114
+ <TimeInput disabled time={time} onTimeChange={setTime} />
115
+ <TimeInput bare disabled time={time} onTimeChange={setTime} />
116
+ ```
117
+
118
+ ---
119
+
120
+ ## Working with Date objects
121
+
122
+ The component works with JavaScript Date objects. Only the hours and minutes are used:
123
+
124
+ ```js
125
+ function ScheduleForm() {
126
+ const [startTime, setStartTime] = useState(new Date());
127
+ const [endTime, setEndTime] = useState(new Date());
128
+
129
+ // Get just the time portion
130
+ const formatTime = (date) => {
131
+ return date.toLocaleTimeString("en-US", {
132
+ hour: "2-digit",
133
+ minute: "2-digit",
134
+ });
135
+ };
136
+
137
+ return (
138
+ <Column gap="medium">
139
+ <Row gap="medium" align="center">
140
+ <Span>From:</Span>
141
+ <TimeInput time={startTime} onTimeChange={setStartTime} />
142
+ </Row>
143
+ <Row gap="medium" align="center">
144
+ <Span>To:</Span>
145
+ <TimeInput time={endTime} onTimeChange={setEndTime} />
146
+ </Row>
147
+ <Span color="secondary">
148
+ Selected: {formatTime(startTime)} - {formatTime(endTime)}
149
+ </Span>
150
+ </Column>
151
+ );
152
+ }
71
153
  ```
72
154
 
73
155
  ---
156
+
157
+ ## Setting initial time
158
+
159
+ ```js
160
+ // Current time
161
+ const [time, setTime] = useState(new Date());
162
+
163
+ // Specific time (e.g., 9:30 AM)
164
+ const [time, setTime] = useState(() => {
165
+ const date = new Date();
166
+ date.setHours(9, 30, 0, 0);
167
+ return date;
168
+ });
169
+ ```
170
+
171
+ ---
172
+
173
+ ## Accessibility
174
+
175
+ - Uses native `<input type="time">` for full browser accessibility support
176
+ - Focus states are visually indicated
177
+ - Works with keyboard navigation
178
+ - Screen readers announce the input purpose
@@ -1,28 +1,115 @@
1
1
  import { Button } from "../Button";
2
+ import { IconButton } from "../IconButton";
3
+ import { Row } from "../Row";
2
4
  import { Tooltip } from "../Tooltip";
3
5
 
4
6
  # Tooltip
5
7
 
6
- The `Tooltip` component can be used to display light contextual information about an element. The content of a tooltip should not be interactable (to make it accessible interactable elements should be dialgs) so they only accept content of type `string`.
8
+ Displays contextual information when hovering over an element. Tooltips are for informational text only and should not contain interactive content.
7
9
 
8
- <Tooltip content="Tooltip here">
9
- <Button
10
- bare
11
- label="Hover to show tooltip"
12
- color="positive"
13
- onClick={() => {}}
14
- />
10
+ ---
11
+
12
+ ## Props
13
+
14
+ | Prop | Type | Required | Default | Description |
15
+ |------|------|----------|---------|-------------|
16
+ | `content` | `string` | Yes | - | Text to display in the tooltip |
17
+ | `children` | `ReactNode` | Yes | - | Element that triggers the tooltip on hover |
18
+ | `tag` | `keyof HTMLElementTagNameMap` | No | - | HTML tag for the wrapper element |
19
+ | `jss` | `JSS` | No | - | Custom styles for the wrapper |
20
+
21
+ ---
22
+
23
+ ## Basic usage
24
+
25
+ Wrap any element with `Tooltip` to show contextual information on hover:
26
+
27
+ <Row gap="large" padding="xlarge">
28
+ <Tooltip content="This confirms the action">
29
+ <Button bare color="positive" onClick={() => {}}>
30
+ Hover me
31
+ </Button>
32
+ </Tooltip>
33
+ </Row>
34
+
35
+ ```js
36
+ <Tooltip content="This confirms the action">
37
+ <Button bare color="positive" onClick={() => {}}>
38
+ Hover me
39
+ </Button>
15
40
  </Tooltip>
41
+ ```
42
+
43
+ ---
44
+
45
+ ## With IconButton
46
+
47
+ Tooltips are especially useful with icon-only buttons to explain their purpose:
48
+
49
+ <Row gap="large" padding="xlarge">
50
+ <Tooltip content="Save document">
51
+ <IconButton bare icon="fa-save" size="medium" color="secondary" onClick={() => {}} />
52
+ </Tooltip>
53
+ <Tooltip content="Print document">
54
+ <IconButton bare icon="fa-print" size="medium" color="secondary" onClick={() => {}} />
55
+ </Tooltip>
56
+ <Tooltip content="Share with others">
57
+ <IconButton bare icon="fa-share" size="medium" color="secondary" onClick={() => {}} />
58
+ </Tooltip>
59
+ </Row>
16
60
 
17
61
  ```js
18
- <Tooltip content="Tooltip here">
19
- <Button
62
+ <Tooltip content="Save document">
63
+ <IconButton
20
64
  bare
21
- label="Hover to show tooltip"
22
- color="positive"
65
+ icon="fa-save"
66
+ size="medium"
67
+ color="secondary"
23
68
  onClick={() => {}}
24
69
  />
25
70
  </Tooltip>
26
71
  ```
27
72
 
28
73
  ---
74
+
75
+ ## Behavior
76
+
77
+ - **Shows on hover**: Tooltip appears when mouse enters the wrapped element
78
+ - **Hides on leave**: Tooltip disappears when mouse leaves
79
+ - **Keyboard dismissal**: Pressing Escape or Tab closes the tooltip
80
+ - **Click dismissal**: Clicking anywhere closes the tooltip
81
+
82
+ ---
83
+
84
+ ## Accessibility considerations
85
+
86
+ Tooltips should contain only supplementary information:
87
+
88
+ - **Do**: Use for hints, descriptions, or labels
89
+ - **Don't**: Put interactive elements (buttons, links) inside tooltips
90
+ - **Don't**: Put essential information only in tooltips
91
+
92
+ For interactive floating content, use `Popover` instead.
93
+
94
+ ```js
95
+ // Good - informational tooltip
96
+ <Tooltip content="Keyboard shortcut: Ctrl+S">
97
+ <Button color="primary" onClick={save}>Save</Button>
98
+ </Tooltip>
99
+
100
+ // Bad - essential information hidden
101
+ <Tooltip content="Click here to delete your account permanently">
102
+ <Button color="negative" onClick={delete}>Delete</Button>
103
+ </Tooltip>
104
+ ```
105
+
106
+ ---
107
+
108
+ ## Tooltip vs Popover
109
+
110
+ | Use Tooltip | Use Popover |
111
+ |-------------|-------------|
112
+ | Simple text hints | Interactive content |
113
+ | Non-essential information | Menus, forms, selections |
114
+ | Keyboard shortcuts | Actions requiring user input |
115
+ | Brief descriptions | Multi-step interactions |