2022-03-07 19:35:26 +00:00
|
|
|
# Tooltips Notes
|
|
|
|
|
|
|
|
|
|
This tooltip component was created to allow any content to be shown as a tooltip. You can place any
|
2023-11-07 21:15:49 +00:00
|
|
|
JSX inside of the `tipContent` prop. Also, very important, the `TooltipWrapper` is designed **ONLY**
|
2022-03-07 19:35:26 +00:00
|
|
|
to wrap text so make sure to use static text or text returned from a function.
|
|
|
|
|
|
|
|
|
|
## Use cases
|
|
|
|
|
|
|
|
|
|
1. As its own component
|
|
|
|
|
2. Within a form input element
|
|
|
|
|
|
|
|
|
|
## Examples
|
|
|
|
|
|
|
|
|
|
**As its own component (Basic)**
|
|
|
|
|
```jsx
|
|
|
|
|
<TooltipWrapper tipContent="After hovering, you will see this.">
|
|
|
|
|
The base text that contains the hover state
|
|
|
|
|
</TooltipWrapper>
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
**As its own component (Advanced)**
|
|
|
|
|
|
|
|
|
|
You can even make the tooltip more dynamic HTML:
|
|
|
|
|
|
|
|
|
|
```jsx
|
|
|
|
|
<TooltipWrapper
|
2023-11-07 21:15:49 +00:00
|
|
|
tipContent={
|
|
|
|
|
<>
|
2026-03-12 04:41:14 +00:00
|
|
|
The "snapshot" key includes the report's results.
|
2022-03-07 19:35:26 +00:00
|
|
|
<br />
|
2026-03-12 04:41:14 +00:00
|
|
|
These will be unique to your report.
|
2023-11-07 21:15:49 +00:00
|
|
|
</>
|
|
|
|
|
}
|
2022-03-07 19:35:26 +00:00
|
|
|
>
|
|
|
|
|
The data sent to your configured log destination will look similar
|
|
|
|
|
to the following JSON:
|
|
|
|
|
</TooltipWrapper>
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
**Within a form input element**
|
|
|
|
|
|
|
|
|
|
Inside a form input element, you only need to specify a `tooltip` prop for the input. This can be
|
2023-11-07 21:15:49 +00:00
|
|
|
any JSX as mentioned before.
|
2022-03-07 19:35:26 +00:00
|
|
|
|
|
|
|
|
```jsx
|
|
|
|
|
<InputField
|
|
|
|
|
label="Password"
|
|
|
|
|
error={errors.password}
|
|
|
|
|
name="password"
|
|
|
|
|
onChange={onInputChange("password")}
|
|
|
|
|
placeholder="Password"
|
|
|
|
|
value={password || ""}
|
|
|
|
|
type="password"
|
2024-01-18 15:48:44 +00:00
|
|
|
helpText= "Must include 12 characters, at least 1 number (e.g. 0 - 9), and at least 1 symbol (e.g. &*#)"
|
2022-03-07 19:35:26 +00:00
|
|
|
blockAutoComplete
|
2023-11-07 21:15:49 +00:00
|
|
|
tooltip={
|
|
|
|
|
<>
|
|
|
|
|
This password is temporary. This user will be asked to set a new password after logging in to the Fleet UI.<br /><br />
|
|
|
|
|
This user will not be asked to set a new password after logging in to fleetctl or the Fleet API.
|
|
|
|
|
</>
|
|
|
|
|
}
|
2022-03-07 19:35:26 +00:00
|
|
|
/>
|
|
|
|
|
```
|