Basic usage
FeatureTip wraps the element it explains and shows a tip next to it. The tip has a close button.
Once it is closed, it is remembered in localStorage under tipId and the tip never shows again in
that browser.
import {Button, FeatureTip} from '@pleo-io/telescope'
;<FeatureTip tipId="categories_onboarding" content="Add your first category" side="bottom">
<Button variant="primary">Add category</Button>
</FeatureTip>Use a tipId that is unique and stable. Changing it shows the tip again for users who dismissed the
previous one.
Hiding the tip
Use isTipHidden to temporarily hide the tip, for example when it doesn't apply to the current
view. This doesn't mark the tip as dismissed.
To hide it programmatically and mark it as dismissed, pass a ref and call hide().
const ref = React.useRef<FeatureTipRef>(null)
<FeatureTip ref={ref} tipId="import" content="Import your tags here">
<Button variant="secondary" onClick={() => ref.current?.hide()}>
Import
</Button>
</FeatureTip>To show a dismissed tip again, for example in tests, call resetFeatureTipState(tipId).
Localisation
The label of the close button is provided by the FeatureTip.CloseButton translation of the
TelescopeProvider.
Accessibility
- The close button is a
buttonlabelled with theFeatureTip.CloseButtontranslation. - The tip is rendered in a Popover and is reachable with the keyboard.
API reference
Shows a "tooltip" next to a wrapped component with some explanation It is used to guide users that are new to the app. The tip can be closed and it never shows up in the same browser again
| Prop | Type | Default |
|---|---|---|
content (required)The content of the tip. | enumnull, string, number, bigint, false, true, ReactElement<unknown, string | JSXElementConstructor<any>>, Iterable<ReactNode>, ReactPortal, Promise<AwaitedReactNode> | |
isTipHiddenHides the tip without marking it as dismissed. | boolean | |
maxWidthMaximum width of the tip, in pixels. | enumnumber | undefined | 280 |
sideThe side of the wrapped element the tip is rendered on. | enum"left" | "top" | "right" | "bottom" | undefined | |
tipId (required)Unique id of the tip. Dismissal is remembered per id in | string |