Skip to content
This repository was archived by the owner on Nov 9, 2024. It is now read-only.

Commit 1c1cd28

Browse files
committed
docs: updates
1 parent 8076f2c commit 1c1cd28

File tree

1 file changed

+34
-31
lines changed

1 file changed

+34
-31
lines changed

README.md

Lines changed: 34 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -7,25 +7,17 @@
77
</div>
88

99
[Tippy.js](https://github.com/atomiks/tippyjs/) is the complete tooltip,
10-
popover, dropdown, and menu solution for the web, powered by Popper.js. It
11-
provides the logic and styling involved in all types of elements that pop out
12-
from the flow of the document and get overlaid on top of the UI, positioned next
13-
to a reference element.
10+
popover, dropdown, and menu solution for the web, powered by Popper.js.
1411

15-
This is a lightweight wrapper that lets you use it declaratively in React.
12+
It is an abstraction over Popper that provides the logic and optionally the
13+
styling involved in all types of elements that pop out from the flow of the
14+
document and get overlaid on top of the UI, positioned next to a reference
15+
element.
1616

17-
<!--
18-
## 💎 Examples
19-
20-
### Tooltips
21-
22-
- [Bootstrap 4 Style](https://codesandbox.io/s/mm61w3rrqx)
23-
- [Material Style](https://codesandbox.io/s/0y6pj161wp)
24-
25-
### Popovers
26-
27-
- [Accessible Emoji Reaction Picker](https://codesandbox.io/s/1vzvoo9mwl)
28-
-->
17+
This is a lightweight wrapper that lets you use it declaratively in React,
18+
providing full integration including headless rendering abilities. Tippy has
19+
virtually no restrictions over Popper, and gives you limitless control while
20+
providing useful behavior and defaults.
2921

3022
## 🚀 Installation
3123

@@ -45,9 +37,15 @@ Requires React 16.8+
4537

4638
There are two ways to use this component:
4739

48-
- **Default**: With the built-in DOM rendering and optionally the default CSS
49-
- **Headless**: With React's DOM rendering for better usage with CSS-in-JS and
50-
spring libraries e.g. `react-spring`
40+
- **Default**: With the built-in DOM rendering and optionally the default CSS.
41+
This is complete "out of the box" behavior and requires no setup. If you want
42+
something that just works, this is for you.
43+
- **Headless**: With React's DOM rendering for improved usage with CSS-in-JS and
44+
spring libraries. If you want greater control over your poppers to integrate
45+
fully with design systems (CSS-in-JS, spring animations, JSX SVG arrow
46+
rendering), this is for you.
47+
48+
You can use both of these in conjunction if you'd like however.
5149

5250
### Default Tippy
5351

@@ -86,7 +84,7 @@ import Tippy from '@tippyjs/react/headless';
8684
const HeadlessTippy = () => (
8785
<Tippy
8886
render={attrs => (
89-
<div className="box" {...attrs}>
87+
<div className="box" tabIndex="-1" {...attrs}>
9088
My tippy box
9189
</div>
9290
)}
@@ -176,7 +174,8 @@ in the `onCreate` lifecycle hook.
176174

177175
##### iOS click outside
178176

179-
Add this to your CSS to enable click outsides to work on iOS:
177+
Add this to your CSS to enable click outsides to work on iOS when not importing
178+
the CSS or using Headless Tippy:
180179

181180
```css
182181
.tippy-iOS {
@@ -235,10 +234,9 @@ complete list.
235234
```jsx
236235
<Tippy
237236
content="Tooltip"
238-
arrow={false}
239-
animation="scale"
240-
duration={0}
241-
delay={[300, 0]}
237+
interactive={true}
238+
interactiveBorder={20}
239+
delay={100}
242240
// ...and many more!
243241
>
244242
<button>Reference</button>
@@ -249,7 +247,8 @@ In addition, there are 3 more props added specifically for the React component.
249247

250248
### `className?: string`
251249

252-
> **Note**: This does not apply if using Headless Tippy
250+
> **Note**: This does not apply if using Headless Tippy, as you can set this on
251+
> the element yourself.
253252
254253
A React alternative to the `theme` prop. The className gets added to the tooltip
255254
element's class list as expected, without adding `-theme` as a suffix.
@@ -312,8 +311,9 @@ function App() {
312311
### Plugins
313312

314313
Tippy.js splits certain props into separate pieces of code called plugins to
315-
enable treeshaking, so that users who don't need the prop's functionality are
316-
not burdened with the cost of it.
314+
enable tree-shaking, so that components or routes that don't need the prop's
315+
functionality are not burdened with the bundle size cost of it. In addition,
316+
they enable a neat way to extend the functionality of tippy instances.
317317

318318
```jsx
319319
import Tippy from '@tippyjs/react';
@@ -351,7 +351,10 @@ You can nest the components like so:
351351

352352
A Hook for the
353353
[`createSingleton()`](https://atomiks.github.io/tippyjs/v6/addons/#singleton)
354-
addon.
354+
addon to re-use a single tippy element for many different reference element
355+
targets.
356+
357+
[View on CodeSandbox](https://codesandbox.io/s/unruffled-pasteur-4yy99?file=/src/App.js)
355358

356359
```jsx
357360
import Tippy, {useSingleton} from '@tippyjs/react';
@@ -400,7 +403,7 @@ function App() {
400403
<Tippy
401404
singleton={source}
402405
render={(attrs, content) => (
403-
<div className="box" {...attrs}>
406+
<div className="box" tabIndex="-1" {...attrs}>
404407
{content}
405408
</div>
406409
)}

0 commit comments

Comments
 (0)