@app-studio/web 0.9.31 → 0.9.33
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/docs/components/Accordion.mdx +158 -0
- package/docs/components/Alert.mdx +123 -0
- package/docs/components/AspectRatio.mdx +55 -0
- package/docs/components/Avatar.mdx +85 -0
- package/docs/components/Background.mdx +522 -0
- package/docs/components/Badge.mdx +220 -0
- package/docs/components/Button.mdx +272 -0
- package/docs/components/Calendar.mdx +274 -0
- package/docs/components/Card.mdx +341 -0
- package/docs/components/Carousel.mdx +411 -0
- package/docs/components/Center.mdx +474 -0
- package/docs/components/Chart.mdx +232 -0
- package/docs/components/ChatInput.mdx +373 -0
- package/docs/components/Checkbox.mdx +66 -0
- package/docs/components/ColorInput.mdx +209 -0
- package/docs/components/ComboBox.mdx +364 -0
- package/docs/components/Command.mdx +252 -0
- package/docs/components/ContextMenu.mdx +219 -0
- package/docs/components/CountryPicker.mdx +123 -0
- package/docs/components/DatePicker.mdx +77 -0
- package/docs/components/DragAndDrop.mdx +539 -0
- package/docs/components/DropdownMenu.mdx +205 -0
- package/docs/components/File.mdx +8 -0
- package/docs/components/Flow.mdx +257 -0
- package/docs/components/Form.mdx +681 -0
- package/docs/components/Formik.mdx +621 -0
- package/docs/components/Gradient.mdx +271 -0
- package/docs/components/Horizontal.mdx +40 -0
- package/docs/components/HoverCard.mdx +140 -0
- package/docs/components/Icon.mdx +438 -0
- package/docs/components/Label.mdx +438 -0
- package/docs/components/Link.mdx +83 -0
- package/docs/components/Loader.mdx +527 -0
- package/docs/components/Menubar.mdx +124 -0
- package/docs/components/Message.mdx +571 -0
- package/docs/components/Modal.mdx +533 -0
- package/docs/components/NavigationMenu.mdx +165 -0
- package/docs/components/Pagination.mdx +150 -0
- package/docs/components/Password.mdx +121 -0
- package/docs/components/Resizable.mdx +148 -0
- package/docs/components/Select.mdx +126 -0
- package/docs/components/Separator.mdx +121 -0
- package/docs/components/Sidebar.mdx +147 -0
- package/docs/components/Slider.mdx +232 -0
- package/docs/components/Switch.mdx +62 -0
- package/docs/components/Table.mdx +409 -0
- package/docs/components/Tabs.mdx +215 -0
- package/docs/components/TagInput.mdx +528 -0
- package/docs/components/Text.mdx +163 -0
- package/docs/components/TextArea.mdx +136 -0
- package/docs/components/TextField.mdx +225 -0
- package/docs/components/Title.mdx +535 -0
- package/docs/components/Toast.mdx +165 -0
- package/docs/components/Toggle.mdx +141 -0
- package/docs/components/ToggleGroup.mdx +165 -0
- package/docs/components/Tooltip.mdx +191 -0
- package/docs/components/Tree.mdx +340 -0
- package/docs/components/Uploader.mdx +426 -0
- package/docs/components/Vertical.mdx +566 -0
- package/docs/components.md +285 -0
- package/package.json +1 -1
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
# Toggle
|
|
2
|
+
|
|
3
|
+
A user-interface element for toggling between on/off states.
|
|
4
|
+
|
|
5
|
+
### **Import**
|
|
6
|
+
```tsx
|
|
7
|
+
import { Toggle } from '@app-studio/web';
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
### **Default**
|
|
11
|
+
```tsx
|
|
12
|
+
import React from 'react';
|
|
13
|
+
import { Toggle } from '../Toggle';
|
|
14
|
+
|
|
15
|
+
export const DefaultDemo = () => {
|
|
16
|
+
return <Toggle>Default</Toggle>;
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
### **shape**
|
|
22
|
+
Optional property to determine the shape of the toggle component.
|
|
23
|
+
|
|
24
|
+
```tsx
|
|
25
|
+
import React from 'react';
|
|
26
|
+
import { Horizontal } from 'app-studio';
|
|
27
|
+
import { Toggle } from '../Toggle';
|
|
28
|
+
import { Shape } from '../Toggle/Toggle.type';
|
|
29
|
+
import { View } from 'app-studio';
|
|
30
|
+
export const ShapeDemo = () => (
|
|
31
|
+
<Horizontal gap={15}>
|
|
32
|
+
{['sharp', 'rounded', 'pillShaped'].map((border, index) => (
|
|
33
|
+
<View position="relative" key={index}>
|
|
34
|
+
<Toggle shape={border as Shape}>{border}</Toggle>
|
|
35
|
+
</View>
|
|
36
|
+
))}
|
|
37
|
+
</Horizontal>
|
|
38
|
+
);
|
|
39
|
+
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
### **isToggled**
|
|
43
|
+
Optional boolean to define the initial toggle state.
|
|
44
|
+
|
|
45
|
+
```tsx
|
|
46
|
+
import React from 'react';
|
|
47
|
+
import { Toggle } from '../Toggle';
|
|
48
|
+
|
|
49
|
+
export const IsToggledDemo = () => {
|
|
50
|
+
return (
|
|
51
|
+
<Toggle isToggled={true} isDisabled>
|
|
52
|
+
IsActive
|
|
53
|
+
</Toggle>
|
|
54
|
+
);
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
### **isDisabled**
|
|
60
|
+
Optional boolean to set the toggle component as disabled or not.
|
|
61
|
+
|
|
62
|
+
```tsx
|
|
63
|
+
import React from 'react';
|
|
64
|
+
import { Toggle } from '../Toggle';
|
|
65
|
+
|
|
66
|
+
export const IsDisabledDemo = () => {
|
|
67
|
+
return <Toggle isDisabled>IsDisabled</Toggle>;
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
### **variant**
|
|
73
|
+
Optional property to style the toggle component with predefined sets of visual types.
|
|
74
|
+
|
|
75
|
+
```tsx
|
|
76
|
+
import React from 'react';
|
|
77
|
+
import { Toggle } from '../Toggle';
|
|
78
|
+
import { Vertical } from 'app-studio';
|
|
79
|
+
import { Variant } from '../Toggle/Toggle.type';
|
|
80
|
+
|
|
81
|
+
export const VariantDemo = () => (
|
|
82
|
+
<Vertical gap={15}>
|
|
83
|
+
{['outline', 'link', 'ghost'].map((variant, index) => (
|
|
84
|
+
<Toggle key={index} variant={variant as Variant}>
|
|
85
|
+
{variant}
|
|
86
|
+
</Toggle>
|
|
87
|
+
))}
|
|
88
|
+
</Vertical>
|
|
89
|
+
);
|
|
90
|
+
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
### **colorScheme**
|
|
94
|
+
Optional string to set the color scheme for the toggle component's appearance.
|
|
95
|
+
|
|
96
|
+
```tsx
|
|
97
|
+
import React from 'react';
|
|
98
|
+
import { Toggle } from '../Toggle';
|
|
99
|
+
import { Horizontal } from 'app-studio';
|
|
100
|
+
|
|
101
|
+
export const ColorSchemeDemo = () => (
|
|
102
|
+
<Horizontal gap={10}>
|
|
103
|
+
{[
|
|
104
|
+
'theme.primary',
|
|
105
|
+
'theme.secondary',
|
|
106
|
+
'theme.warning',
|
|
107
|
+
'theme.success',
|
|
108
|
+
'theme.error',
|
|
109
|
+
].map((color, index) => (
|
|
110
|
+
<Toggle key={index} colorScheme={color}>
|
|
111
|
+
{color}
|
|
112
|
+
</Toggle>
|
|
113
|
+
))}
|
|
114
|
+
</Horizontal>
|
|
115
|
+
);
|
|
116
|
+
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
### **onToggle**
|
|
120
|
+
Optional function that triggers when the toggle state changes, receives the new state as an argument.
|
|
121
|
+
|
|
122
|
+
```tsx
|
|
123
|
+
import React from 'react';
|
|
124
|
+
import { useState } from 'react';
|
|
125
|
+
import { Toggle } from '../Toggle';
|
|
126
|
+
|
|
127
|
+
export const OnToggleDemo = () => {
|
|
128
|
+
const [isToggle, setIsToggled] = useState(false);
|
|
129
|
+
return (
|
|
130
|
+
<Toggle
|
|
131
|
+
onToggle={(state) => {
|
|
132
|
+
setIsToggled(state);
|
|
133
|
+
}}
|
|
134
|
+
>
|
|
135
|
+
{isToggle ? 'On' : 'Off'}
|
|
136
|
+
</Toggle>
|
|
137
|
+
);
|
|
138
|
+
};
|
|
139
|
+
|
|
140
|
+
```
|
|
141
|
+
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
# ToggleGroup
|
|
2
|
+
|
|
3
|
+
Enables selection from a group of toggle switches.
|
|
4
|
+
|
|
5
|
+
### **Import**
|
|
6
|
+
```tsx
|
|
7
|
+
import { ToggleGroup } from '@app-studio/web';
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
### **Default**
|
|
11
|
+
```tsx
|
|
12
|
+
import React from 'react';
|
|
13
|
+
import { ToggleGroup } from '../ToggleGroup';
|
|
14
|
+
|
|
15
|
+
export const DefaultDemo = () => {
|
|
16
|
+
const items = [
|
|
17
|
+
{ id: 'B', value: 'B' },
|
|
18
|
+
{ id: 'C', value: 'C' },
|
|
19
|
+
{ id: 'D', value: 'D' },
|
|
20
|
+
];
|
|
21
|
+
return <ToggleGroup items={items} />;
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
### **shape**
|
|
27
|
+
Optional shape prop to define the shape of toggle elements.
|
|
28
|
+
|
|
29
|
+
```tsx
|
|
30
|
+
import React from 'react';
|
|
31
|
+
import { DustBinIcon } from '../../Icon';
|
|
32
|
+
import { ToggleGroup } from '../ToggleGroup';
|
|
33
|
+
import { Shape } from '../ToggleGroup/ToggleGroup.type';
|
|
34
|
+
import { Horizontal } from 'app-studio';
|
|
35
|
+
import { View } from 'app-studio';
|
|
36
|
+
|
|
37
|
+
export const ShapeDemo = () => {
|
|
38
|
+
const items = [
|
|
39
|
+
{
|
|
40
|
+
id: 'item',
|
|
41
|
+
value: <DustBinIcon size={18} />,
|
|
42
|
+
isActive: true,
|
|
43
|
+
},
|
|
44
|
+
];
|
|
45
|
+
return (
|
|
46
|
+
<Horizontal gap={15}>
|
|
47
|
+
{['sharp', 'rounded', 'pillShaped'].map((border, index) => (
|
|
48
|
+
<View position="relative" key={index}>
|
|
49
|
+
<ToggleGroup items={items} shape={border as Shape} />
|
|
50
|
+
</View>
|
|
51
|
+
))}
|
|
52
|
+
</Horizontal>
|
|
53
|
+
);
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
### **items**
|
|
59
|
+
Mandatory array of items defining each toggle in the group.
|
|
60
|
+
|
|
61
|
+
```tsx
|
|
62
|
+
import React from 'react';
|
|
63
|
+
import { ToggleGroup } from '../ToggleGroup';
|
|
64
|
+
import { Text } from '../../Text/Text';
|
|
65
|
+
|
|
66
|
+
export const ItemsDemo = () => {
|
|
67
|
+
const items = [
|
|
68
|
+
{ id: 'B', value: <Text>B</Text> },
|
|
69
|
+
{ id: 'C', value: <Text>C</Text> },
|
|
70
|
+
{ id: 'D', value: <Text>D</Text> },
|
|
71
|
+
];
|
|
72
|
+
return <ToggleGroup items={items} />;
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
### **variant**
|
|
78
|
+
Optional variant prop to specify the visual style of the toggle group.
|
|
79
|
+
|
|
80
|
+
```tsx
|
|
81
|
+
import React from 'react';
|
|
82
|
+
import { Text } from '../../Text/Text';
|
|
83
|
+
import { ToggleGroup } from '../ToggleGroup';
|
|
84
|
+
import { Variant } from '../ToggleGroup/ToggleGroup.type';
|
|
85
|
+
import { Vertical } from 'app-studio';
|
|
86
|
+
|
|
87
|
+
export const VariantDemo = () => {
|
|
88
|
+
const items = [
|
|
89
|
+
{ id: 'B', value: <Text>B</Text> },
|
|
90
|
+
{ id: 'C', value: <Text>C</Text> },
|
|
91
|
+
{ id: 'D', value: <Text>D</Text> },
|
|
92
|
+
];
|
|
93
|
+
return (
|
|
94
|
+
<Vertical gap={15}>
|
|
95
|
+
{['outline', 'link', 'ghost'].map((variant, index) => (
|
|
96
|
+
<ToggleGroup key={index} items={items} variant={variant as Variant} />
|
|
97
|
+
))}
|
|
98
|
+
</Vertical>
|
|
99
|
+
);
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
### **colorScheme**
|
|
105
|
+
Optional colorScheme prop for theming the toggle group.
|
|
106
|
+
|
|
107
|
+
```tsx
|
|
108
|
+
import React from 'react';
|
|
109
|
+
import { ToggleGroup } from '../ToggleGroup';
|
|
110
|
+
import { Vertical } from 'app-studio';
|
|
111
|
+
import { Text } from '../../Text/Text';
|
|
112
|
+
|
|
113
|
+
export const ColorSchemeDemo = () => {
|
|
114
|
+
const items = [
|
|
115
|
+
{ id: 'B', value: <Text>B</Text> },
|
|
116
|
+
{ id: 'C', value: <Text>C</Text>, isActive: true },
|
|
117
|
+
{ id: 'D', value: <Text>D</Text>, isDisabled: true },
|
|
118
|
+
];
|
|
119
|
+
return (
|
|
120
|
+
<Vertical gap={10}>
|
|
121
|
+
{[
|
|
122
|
+
'theme.primary',
|
|
123
|
+
'theme.secondary',
|
|
124
|
+
'theme.warning',
|
|
125
|
+
'theme.success',
|
|
126
|
+
'theme.error',
|
|
127
|
+
].map((color, index) => (
|
|
128
|
+
<ToggleGroup key={index} items={items} colorScheme={color} />
|
|
129
|
+
))}
|
|
130
|
+
</Vertical>
|
|
131
|
+
);
|
|
132
|
+
};
|
|
133
|
+
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
### **onToggleChange**
|
|
137
|
+
Optional callback function that fires when the active toggle changes, providing the IDs of active toggles.
|
|
138
|
+
|
|
139
|
+
```tsx
|
|
140
|
+
import React, { useState } from 'react';
|
|
141
|
+
import { ToggleGroup } from '../ToggleGroup';
|
|
142
|
+
import { Text } from '../../Text/Text';
|
|
143
|
+
import { Vertical } from 'app-studio';
|
|
144
|
+
|
|
145
|
+
export const OnToggleChangeDemo = () => {
|
|
146
|
+
const [newItems, setNewItems] = useState<any>([]);
|
|
147
|
+
|
|
148
|
+
const items = [
|
|
149
|
+
{ id: 'B', value: <Text>B</Text> },
|
|
150
|
+
{ id: 'C', value: <Text>C</Text> },
|
|
151
|
+
{ id: 'D', value: <Text>D</Text> },
|
|
152
|
+
];
|
|
153
|
+
return (
|
|
154
|
+
<Vertical gap={10}>
|
|
155
|
+
<ToggleGroup
|
|
156
|
+
items={items}
|
|
157
|
+
onToggleChange={(items) => setNewItems(items)}
|
|
158
|
+
/>
|
|
159
|
+
Selected: {newItems}
|
|
160
|
+
</Vertical>
|
|
161
|
+
);
|
|
162
|
+
};
|
|
163
|
+
|
|
164
|
+
```
|
|
165
|
+
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
# Tooltip
|
|
2
|
+
|
|
3
|
+
A component that displays informative text when users hover over, focus on, or tap an element.
|
|
4
|
+
|
|
5
|
+
### **Import**
|
|
6
|
+
```tsx
|
|
7
|
+
import { Tooltip } from '@app-studio/web';
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
### **Default**
|
|
11
|
+
```tsx
|
|
12
|
+
import React from 'react';
|
|
13
|
+
import { Tooltip } from '../Tooltip';
|
|
14
|
+
import { Button } from '../../Button/Button';
|
|
15
|
+
|
|
16
|
+
export const DefaultTooltip = () => {
|
|
17
|
+
return (
|
|
18
|
+
<Tooltip content="This is a tooltip">
|
|
19
|
+
<Button>Hover Me</Button>
|
|
20
|
+
</Tooltip>
|
|
21
|
+
);
|
|
22
|
+
};
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
### **Positions**
|
|
26
|
+
Tooltips can be positioned relative to the trigger element.
|
|
27
|
+
|
|
28
|
+
```tsx
|
|
29
|
+
import React from 'react';
|
|
30
|
+
import { Tooltip } from '../Tooltip';
|
|
31
|
+
import { Button } from '../../Button/Button';
|
|
32
|
+
import { Horizontal } from 'app-studio';
|
|
33
|
+
|
|
34
|
+
export const TooltipPositionsExample = () => {
|
|
35
|
+
return (
|
|
36
|
+
<Horizontal gap={20}>
|
|
37
|
+
<Tooltip content="Tooltip on top" position="top">
|
|
38
|
+
<Button>Top</Button>
|
|
39
|
+
</Tooltip>
|
|
40
|
+
|
|
41
|
+
<Tooltip content="Tooltip on right" position="right">
|
|
42
|
+
<Button>Right</Button>
|
|
43
|
+
</Tooltip>
|
|
44
|
+
|
|
45
|
+
<Tooltip content="Tooltip on bottom" position="bottom">
|
|
46
|
+
<Button>Bottom</Button>
|
|
47
|
+
</Tooltip>
|
|
48
|
+
|
|
49
|
+
<Tooltip content="Tooltip on left" position="left">
|
|
50
|
+
<Button>Left</Button>
|
|
51
|
+
</Tooltip>
|
|
52
|
+
</Horizontal>
|
|
53
|
+
);
|
|
54
|
+
};
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
### **Variants**
|
|
58
|
+
Different visual styles for tooltips.
|
|
59
|
+
|
|
60
|
+
```tsx
|
|
61
|
+
import React from 'react';
|
|
62
|
+
import { Tooltip } from '../Tooltip';
|
|
63
|
+
import { Button } from '../../Button/Button';
|
|
64
|
+
import { Horizontal } from 'app-studio';
|
|
65
|
+
|
|
66
|
+
export const TooltipVariantsExample = () => {
|
|
67
|
+
return (
|
|
68
|
+
<Horizontal gap={20}>
|
|
69
|
+
<Tooltip content="Default tooltip style" variant="default">
|
|
70
|
+
<Button>Default</Button>
|
|
71
|
+
</Tooltip>
|
|
72
|
+
|
|
73
|
+
<Tooltip content="Light tooltip style" variant="light">
|
|
74
|
+
<Button>Light</Button>
|
|
75
|
+
</Tooltip>
|
|
76
|
+
|
|
77
|
+
<Tooltip content="Dark tooltip style" variant="dark">
|
|
78
|
+
<Button>Dark</Button>
|
|
79
|
+
</Tooltip>
|
|
80
|
+
</Horizontal>
|
|
81
|
+
);
|
|
82
|
+
};
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
### **Sizes**
|
|
86
|
+
Tooltips come in different sizes.
|
|
87
|
+
|
|
88
|
+
```tsx
|
|
89
|
+
import React from 'react';
|
|
90
|
+
import { Tooltip } from '../Tooltip';
|
|
91
|
+
import { Button } from '../../Button/Button';
|
|
92
|
+
import { Horizontal } from 'app-studio';
|
|
93
|
+
|
|
94
|
+
export const TooltipSizesExample = () => {
|
|
95
|
+
return (
|
|
96
|
+
<Horizontal gap={20}>
|
|
97
|
+
<Tooltip content="Small tooltip" size="sm">
|
|
98
|
+
<Button>Small</Button>
|
|
99
|
+
</Tooltip>
|
|
100
|
+
|
|
101
|
+
<Tooltip content="Medium tooltip" size="md">
|
|
102
|
+
<Button>Medium</Button>
|
|
103
|
+
</Tooltip>
|
|
104
|
+
|
|
105
|
+
<Tooltip content="Large tooltip with more content" size="lg">
|
|
106
|
+
<Button>Large</Button>
|
|
107
|
+
</Tooltip>
|
|
108
|
+
</Horizontal>
|
|
109
|
+
);
|
|
110
|
+
};
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
### **Custom Content**
|
|
114
|
+
Tooltips can contain rich content, not just text.
|
|
115
|
+
|
|
116
|
+
```tsx
|
|
117
|
+
import React from 'react';
|
|
118
|
+
import { Tooltip } from '../Tooltip';
|
|
119
|
+
import { Button } from '../../Button/Button';
|
|
120
|
+
import { Text } from '../../Text/Text';
|
|
121
|
+
import { Vertical } from 'app-studio';
|
|
122
|
+
|
|
123
|
+
export const CustomContentTooltip = () => {
|
|
124
|
+
return (
|
|
125
|
+
<Tooltip
|
|
126
|
+
content={
|
|
127
|
+
<Vertical padding={5}>
|
|
128
|
+
<Text fontWeight="bold">Custom Tooltip</Text>
|
|
129
|
+
<Text fontSize="12px">With rich content and styling</Text>
|
|
130
|
+
</Vertical>
|
|
131
|
+
}
|
|
132
|
+
views={{
|
|
133
|
+
content: {
|
|
134
|
+
backgroundColor: 'theme.primary',
|
|
135
|
+
color: 'color.white',
|
|
136
|
+
borderRadius: '8px',
|
|
137
|
+
},
|
|
138
|
+
arrow: {
|
|
139
|
+
backgroundColor: 'theme.primary',
|
|
140
|
+
},
|
|
141
|
+
}}
|
|
142
|
+
>
|
|
143
|
+
<Button variant="outline">Hover for Custom Tooltip</Button>
|
|
144
|
+
</Tooltip>
|
|
145
|
+
);
|
|
146
|
+
};
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
### **Compound Component Pattern**
|
|
150
|
+
For more control, you can use the compound component pattern.
|
|
151
|
+
|
|
152
|
+
```tsx
|
|
153
|
+
import React from 'react';
|
|
154
|
+
import { Tooltip } from '../Tooltip';
|
|
155
|
+
import { Button } from '../../Button/Button';
|
|
156
|
+
import { Text } from '../../Text/Text';
|
|
157
|
+
|
|
158
|
+
export const CompoundTooltip = () => {
|
|
159
|
+
return (
|
|
160
|
+
<Tooltip>
|
|
161
|
+
<Tooltip.Trigger>
|
|
162
|
+
<Button>Hover Me</Button>
|
|
163
|
+
</Tooltip.Trigger>
|
|
164
|
+
<Tooltip.Content>
|
|
165
|
+
<Text>This is a tooltip using compound components</Text>
|
|
166
|
+
</Tooltip.Content>
|
|
167
|
+
</Tooltip>
|
|
168
|
+
);
|
|
169
|
+
};
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
### **Integration with Other Components**
|
|
173
|
+
Tooltips can be easily integrated with other components.
|
|
174
|
+
|
|
175
|
+
```tsx
|
|
176
|
+
import React from 'react';
|
|
177
|
+
import { Tooltip } from '../Tooltip';
|
|
178
|
+
import { Button } from '../../Button/Button';
|
|
179
|
+
import { Icon } from '../../Icon/Icon';
|
|
180
|
+
|
|
181
|
+
export const IntegratedTooltip = () => {
|
|
182
|
+
return (
|
|
183
|
+
<Button>
|
|
184
|
+
Save
|
|
185
|
+
<Tooltip content="Save your changes">
|
|
186
|
+
<Icon name="info-circle" marginLeft={5} />
|
|
187
|
+
</Tooltip>
|
|
188
|
+
</Button>
|
|
189
|
+
);
|
|
190
|
+
};
|
|
191
|
+
```
|