You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
| multiline | data-multiline | Bool | true, false | support `<br>`, `<br />` to make multiline |
86
86
| className | data-class | String || extra custom class, can use !important to overwrite react-tooltip's default class |
87
-
| html | data-html | Bool | true, false |`<p data-tip="<p>HTML tooltip</p>" data-html={true}></p>` or `<ReactTooltip html={true} />`, but see [Security Note](#security-note) below.<br/>When using JSX, see [this note](#jsx-note) below. |
87
+
| html | data-html | Bool | true, false |`<p data-tip="<p>HTML tooltip</p>" data-html={true}></p>` or `<ReactTooltip html={true} />`, but see [Security Note](#security-note) below.<br/>When using JSX, see [this note](#jsx-note) below. |
88
88
| delayHide | data-delay-hide | Number ||`<p data-tip="tooltip" data-delay-hide='1000'></p>` or `<ReactTooltip delayHide={1000} />`|
89
89
| delayShow | data-delay-show | Number ||`<p data-tip="tooltip" data-delay-show='1000'></p>` or `<ReactTooltip delayShow={1000} />`|
90
90
| delayUpdate | data-delay-update | Number ||`<p data-tip="tooltip" data-delay-update='1000'></p>` or `<ReactTooltip delayUpdate={1000} />` Sets a delay in calling getContent if the tooltip is already shown and you mouse over another target |
91
91
| insecure | null | Bool | true, false | Whether to inject the style header into the page dynamically (violates CSP style-src but is a convenient default) |
92
92
| border | data-border | Bool | true, false | Add one pixel white border |
93
+
| borderClass | data-border-class | String | e.g. custom-border-class | A custom class name to use for the border - enabled by the `border` prop |
93
94
| textColor | data-text-color | String | e.g. red | Popup text color |
94
95
| backgroundColor | data-background-color | String | e.g. yellow | Popup background color |
95
96
| borderColor | data-border-color | String | e.g. green | Popup border color - enabled by the `border` value |
@@ -109,8 +110,10 @@ Notes:
109
110
The `html` option allows a tooltip to directly display raw HTML. This is a security risk if any of that content is supplied by the user. Any user-supplied content must be sanitized, using a package like [sanitize-html](https://www.npmjs.com/package/sanitize-html). We chose not to include sanitization after discovering it [increased our package size](https://github.com/wwayne/react-tooltip/issues/429) too much - we don't want to penalize people who don't use the `html` option.
110
111
111
112
#### JSX Note
113
+
112
114
You can use React's [`renderToStaticMarkup`-function](https://reactjs.org/docs/react-dom-server.html#rendertostaticmarkup) to use JSX instead of HTML. You still need to set `data-html={true}`.
113
115
**Example:**
116
+
114
117
```jsx
115
118
importReactDOMServerfrom'react-dom/server';
116
119
[...]
@@ -186,22 +189,22 @@ Same for empty children, if you don't want show the tooltip when the children is
186
189
187
190
### 3. Tooltip not binding to dynamic content
188
191
189
-
When you render `<ReactTooltip>` ahead of dynamic content, and are using `data-for={id}` attributes
190
-
on new dynamic content, the tooltip will not register its event listener.
192
+
When you render `<ReactTooltip>` ahead of dynamic content, and are using `data-for={id}` attributes
193
+
on new dynamic content, the tooltip will not register its event listener.
191
194
192
195
For example, you render a generic tooltip in the root of your app, then load a list of content async.
193
196
Elements in the list use the `data-for={id}` attribute to bind the tooltip on hover.
194
197
Since the tooltip has already scanned for data-tip these new elements will not trigger.
195
198
196
-
One workaround for this is to trigger `ReactTooltip.rebuild()` after the data load to scan for the attribute again,
199
+
One workaround for this is to trigger `ReactTooltip.rebuild()` after the data load to scan for the attribute again,
0 commit comments