Skip to content

Commit f86c95b

Browse files
gabrieljablonskiGabriel Jablonski
authored andcommitted
docs: re-add "Content" example page
1 parent 1e77dd5 commit f86c95b

File tree

1 file changed

+75
-0
lines changed

1 file changed

+75
-0
lines changed

docs/docs/examples/content.mdx

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
---
2+
sidebar_position: 1
3+
---
4+
5+
# Content
6+
7+
Content in ReactTooltip component.
8+
9+
import { Tooltip } from 'react-tooltip'
10+
import 'react-tooltip/dist/react-tooltip.css'
11+
12+
export const TooltipAnchor = ({ children, id, ...rest }) => {
13+
return (
14+
<span
15+
id={id}
16+
style={{
17+
display: 'flex',
18+
justifyContent: 'center',
19+
alignItems: 'center',
20+
width: '60px',
21+
height: '60px',
22+
borderRadius: '60px',
23+
color: '#222',
24+
background: 'rgba(255, 255, 255, 1)',
25+
cursor: 'pointer',
26+
boxShadow: '3px 4px 3px rgba(0, 0, 0, 0.5)',
27+
border: '1px solid #333',
28+
}}
29+
{...rest}
30+
>
31+
{children}
32+
</span>
33+
)
34+
}
35+
36+
### Using `content`
37+
38+
```jsx
39+
import { Tooltip } from 'react-tooltip';
40+
import 'react-tooltip/dist/react-tooltip.css';
41+
42+
<a id="tooltip-anchor"> ◕‿‿◕ </a>
43+
<Tooltip anchorId="tooltip-anchor" content="hello world!" place="left" />
44+
```
45+
46+
<div style={{ display: 'flex', columnGap: '16px', justifyContent: 'center', paddingTop: '36px' }}>
47+
<TooltipAnchor id="tooltip-anchor">◕‿‿◕</TooltipAnchor>
48+
<Tooltip
49+
anchorId="tooltip-anchor"
50+
content="hello world!"
51+
/>
52+
</div>
53+
54+
### Using `data-tooltip-content`
55+
56+
```jsx
57+
import { Tooltip } from 'react-tooltip';
58+
import 'react-tooltip/dist/react-tooltip.css';
59+
60+
<a
61+
id="tooltip-anchor-data-tooltip-content"
62+
data-tooltip-content="hello world!"
63+
> ◕‿‿◕ </a>
64+
<Tooltip anchorId="tooltip-anchor-data-tooltip-content" />
65+
```
66+
67+
<div style={{ display: 'flex', columnGap: '16px', justifyContent: 'center', paddingTop: '36px' }}>
68+
<TooltipAnchor
69+
id="tooltip-anchor-data-tooltip-content"
70+
data-tooltip-content="hello world!"
71+
>
72+
◕‿‿◕
73+
</TooltipAnchor>
74+
<Tooltip anchorId="tooltip-anchor-data-tooltip-content" />
75+
</div>

0 commit comments

Comments
 (0)