Skip to content

Commit d50dde7

Browse files
docs: imperative mode
1 parent f53d1c9 commit d50dde7

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

docs/docs/examples/imperative-mode.mdx

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -70,13 +70,23 @@ interface TooltipImperativeProps {
7070
}
7171
```
7272

73-
- `open()` opens the tooltip programatically. All of the function arguments are optional
73+
#### Methods
74+
75+
:::info
76+
77+
The imperative methods <b>can</b> be applied alongside regular tooltip usage. For example, you could use just `close()` to close a regular tooltip after an API request is finished.
78+
79+
:::
80+
81+
- `open()` opens the tooltip programatically. All of the arguments are optional
7482
- `anchorSelect` overrides the selector currently in use. Ideally, it should match only one element (e.g. `#some-element`)
7583
- `position` overrides the tooltip position. Behaves the same way as the `position` tooltip prop
7684
- `place` overrides the tooltip placement relative to the anchor. Behaves the same was the `place` tooltip prop
7785
- `content` overrides the tooltip content
7886
- `close()` closes the tooltip programatically
7987

88+
#### Internal state
89+
8090
:::note
8191

8292
These are read-only. Updating their values has no effect on the tooltip.
@@ -87,12 +97,6 @@ These are read-only. Updating their values has no effect on the tooltip.
8797
- `place` is the current tooltip placement relative to the anchor element. Can differ from the `place` tooltip prop if the tooltip is close to the edges of its container
8898
- `isOpen` indicates whether the tooltip is currently being shown or not
8999

90-
:::info
91-
92-
The imperative methods <b>can</b> be applied alongside regular tooltip usage. For example, you could use just `close()` to close a regular tooltip after an API request is finished.
93-
94-
:::
95-
96100
```jsx
97101
import { useRef } from 'react';
98102
import { Tooltip, TooltipImperativeProps } from 'react-tooltip';

0 commit comments

Comments
 (0)