fleet/frontend/components/TooltipWrapper
Gabriel Hernandez a950e9d095
Feat/update query doc sidepanel (#8214)
* create new components for query side panel

* add reusable icon component that uses svg for icons

* integrate with new osquery_fleet_schema.json data

* update UI to work with osquery_fleet_schema.json

* add remark-gfm to safely support direct urls in markdown

* move fleet ace into markdown component so we can render code with ace editor

* add testing for new query sidebar

* remove incomplete tests for query sidepanel
2022-10-14 17:45:57 +01:00
..
_styles.scss Fleet UI: Add optional tooltip delay used on compatibility tooltip (#8065) 2022-10-04 10:03:51 -04:00
index.tsx New tooltips! (#4326) 2022-02-28 13:25:06 -08:00
README.md Increase minimum password length to 12 characters (#5712) 2022-05-18 12:03:00 -05:00
TooltipWrapper.stories.tsx New tooltips! (#4326) 2022-02-28 13:25:06 -08:00
TooltipWrapper.tsx Feat/update query doc sidepanel (#8214) 2022-10-14 17:45:57 +01:00

Tooltips Notes

This tooltip component was created to allow any content to be shown as a tooltip. You can place any HTML inside of the tipContent prop. Also, very important, the TooltipWrapper is designed ONLY 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)

<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:

<TooltipWrapper
  tipContent={`
    The &quot;snapshot&quot; key includes the query&apos;s results. 
    <br />
    These will be unique to your query.
  `}
>
  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 text or HTML as mentioned before.

<InputField
  label="Password"
  error={errors.password}
  name="password"
  onChange={onInputChange("password")}
  placeholder="Password"
  value={password || ""}
  type="password"
  hint={[
    "Must include 12 characters, at least 1 number (e.g. 0 - 9), and at least 1 symbol (e.g. &*#)",
  ]}
  blockAutoComplete
  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.
  `}
/>