suiss/ui ยท Interaction
Tip
A dismissible feature tip shown inline or as a popover, remembered once dismissed and sequenced in groups.
Tip is an open-source interaction from suiss/ui for React, React Native, SwiftUI and Jetpack Compose. The @esuiss/ui CLI copies its source into your project, so you own the code.
Tip recreates TipKit-style feature tips. Each tip has an id; once dismissed, the id is stored in localStorage and the tip no longer appears. Show a tip inline with TipCard, which expands into the layout, or attach it to a control with TipAnchor and TipPopover, which uses a non-modal popover with an arrow. Using the anchored control also dismisses its tip.
Wrap several tips in TipGroup to show them one at a time, in the order they mount; when one is dismissed, the next appears. Use tips sparingly to point out features people might otherwise miss.
Installation
Works in any project with a components.json. See Installation for the one-line registry setup. Or use the suiss/ui CLI:
- Install the following dependencies and add the
cnhelper:
- Copy and paste the following code into your project.
- Update the import paths to match your project setup.
Usage
Accessibility
TipCardrenders withrole="note".TipPopoveris labelled byTipTitleand described byTipDescription. It does not move focus when it opens or closes, and pressingEscapeor outside dismisses it.TipCloseis labelledDismiss tip.TipIconisaria-hidden.
API Reference
TipGroup
Shows the tips inside it one at a time, in order.
| Prop | Type | Default |
|---|---|---|
children | React.ReactNode | - |
Tip
Holds a single tip's visibility and dismissed state.
| Prop | Type | Default |
|---|---|---|
id | string | Required |
delay | number | 0 |
onDismiss | () => void | - |
children | React.ReactNode | - |
Give every Tip a stable, unique id; it is the key used to remember that the tip was dismissed. Place either a TipCard, or a TipAnchor with a TipPopover, inside it, and build the content with TipIcon, TipContent, TipTitle, TipDescription and TipClose. delay is the number of milliseconds to wait before showing the tip.
Dismissed tips are stored under tip: followed by the id in localStorage. When storage is unavailable, tips still dismiss for the current session. Call resetTips with a list of ids to clear their dismissed state, for example from a Show tips again control.
TipCard
An inline card that expands into the layout while the tip is visible.
Also accepts the props of React.ComponentProps<"div">.
TipAnchor
Wraps the control that a popover tip points to.
Also accepts the props of React.ComponentProps<"span">.
TipPopover
A popover with an arrow, positioned against TipAnchor.
| Prop | Type | Default |
|---|---|---|
side | "top" | "right" | "bottom" | "left" | "inline-start" | "inline-end" | "bottom" |
align | "start" | "center" | "end" | "center" |
sideOffset | number | 10 |
Also accepts the props of the primitive parts it wraps.
Position the popover with side, align and sideOffset, which default to bottom, center and 10 pixels.
TipIcon
The leading icon of the tip.
Also accepts the props of React.ComponentProps<"span">.
TipContent
The container for the title and description.
Also accepts the props of React.ComponentProps<"div">.
TipTitle
The tip's title.
Also accepts the props of React.ComponentProps<"p">.
TipDescription
The tip's supporting text.
Also accepts the props of React.ComponentProps<"p">.
TipClose
The button that dismisses the tip.
Also accepts the props of React.ComponentProps<"button">.
Each part sets a data-slot, such as tip-card or tip-popover, for styling.
Web preview
This code uses Tailwind classes that need Uniwind or NativeWind. With StyleSheet, pass the same values through the style props.
Tip shows a hint until the user dismisses it, then records the dismissal under its id so it does not return. It renders either as a TipCard placed in the layout, or as a TipPopover with an arrow pointing at a TipAnchor. Touching the anchor also dismisses the tip.
TipGroup shows several tips one at a time in the order they mount, moving to the next when one is dismissed. Use tips to introduce a feature or gesture the user may not discover.
Installation
- Install the following dependencies:
-
Copy the animated view into
components/ui/animated-view.tsx:
- Copy the primitives it uses into
components/primitives:
- Copy and paste the following code into
components/interactions/tip.tsx:
- Update the import paths to match your project setup.
- Install the following dependencies:
-
Copy the animated view into
components/ui/animated-view.tsx:
- Copy the primitives it uses into
components/primitives:
- Copy and paste the following code into
components/interactions/tip.tsx:
- Update the import paths to match your project setup.
- Install the following dependencies:
-
Copy the animated view into
components/ui/animated-view.tsx:
- Copy the primitives it uses into
components/primitives:
- Copy and paste the following code into
components/interactions/tip.tsx:
- Update the import paths to match your project setup.
-
Target iOS 17 or later.
-
Add the Swift package to your app:
- Copy the theme files every view uses:
- Copy the source:
- Add the files to your app target.
- Apply the Compose compiler plugin, enable Compose, set
compileSdkto 37 or higher andminSdkto 24 or higher, and add the dependencies:
- Copy the theme files every view uses:
- Copy the source and every file it uses:
- Update the
com.esuiss.uipackage names to match your project.
Usage
This code uses Tailwind classes that need Uniwind or NativeWind. With StyleSheet, pass the same values through the style props.
Examples
Card
An inline card tip with a TipIcon, TipTitle, TipDescription and TipClose inside a TipCard.

Accessibility
TipCardhas thenoterole.TipPopoveris non-modal, does not move focus, and is labelled byTipTitle.TipCloseis labelledDismiss tip.- The icon is hidden from screen readers.
API Reference
TipGroup
Shows its tips one at a time and supplies the storage.
| Prop | Type | Default |
|---|---|---|
storage | TipStorage | memoryStorage |
children | React.ReactNode | - |
By default dismissals are kept in memory and reset when the app restarts. To persist them, pass a storage adapter with getItem and setItem, sync or async, such as one backed by your app's key-value store. Keys are prefixed with tip:. resetTips(ids, storage) clears dismissals. The TipStorage type is exported.
Tip
One hint, identified by id.
| Prop | Type | Default |
|---|---|---|
id | string | Required |
delay | number | 0 |
onDismiss | () => void | - |
children | React.ReactNode | - |
Give each Tip a stable id, the key used to remember the dismissal. Compose TipIcon, TipContent with TipTitle and TipDescription, and TipClose inside a TipCard or TipPopover. For a popover, wrap the target in TipAnchor inside the same Tip. delay is the number of milliseconds to wait before showing. useTip returns visible and dismiss.
TipCard
Renders the tip inline as a card.
Also accepts the props of ViewProps.
TipAnchor
The element the popover points at.
Also accepts the props of ViewProps.
TipPopover
Renders the tip as a popover next to the anchor.
| Prop | Type | Default |
|---|---|---|
side | Side | "bottom" |
align | Align | "center" |
sideOffset | number | 10 |
portalHost | string | - |
Also accepts the props of React.ComponentProps<typeof PopoverPrimitive.Popup>.
sideOffset is the gap from the anchor. portalHost names a portal host to render into. Popovers are up to 320 points wide, and animations respect the system reduce motion setting. On iOS the popover renders in a full-window overlay so it appears above native screens.
TipIcon
A decorative icon slot.
Also accepts the props of ViewProps.
TipContent
Holds the title and description.
Also accepts the props of ViewProps.
TipTitle
The tip's heading.
Also accepts the props of React.ComponentProps<typeof Text>.
TipDescription
The tip's supporting text.
Also accepts the props of React.ComponentProps<typeof Text>.
TipClose
A button that dismisses the tip.
Also accepts the props of React.ComponentProps<typeof Pressable>.
TipStorage.getItem
| Parameter | Type | Default |
|---|---|---|
_ย key | String | - |
Returns String?.
TipStorage.setItem
| Parameter | Type | Default |
|---|---|---|
_ย key | String | - |
_ย value | String? | - |
InMemoryTipStorage
Takes no parameters.
| Property | Type |
|---|---|
static shared | InMemoryTipStorage |
resetTips
| Parameter | Type | Default |
|---|---|---|
_ย ids | [String] | - |
storage | any TipStorage | InMemoryTipStorage.shared |
TipGroup
Shows its tips one at a time and supplies the storage.
| Parameter | Type | Default |
|---|---|---|
storage | any TipStorage | InMemoryTipStorage.shared |
content | () -> Content | - |
Tip
One hint, identified by id.
| Parameter | Type | Default |
|---|---|---|
id | String | - |
delay | Duration | .zero |
storage | (any TipStorage)? | nil |
onDismiss | (() -> Void)? | nil |
content | () -> Content | - |
TipCard
Renders the tip inline as a card.
| Parameter | Type | Default |
|---|---|---|
content | () -> Content | - |
.tipPopover
| Parameter | Type | Default |
|---|---|---|
side | Edge | .bottom |
content | () -> Content | - |
TipIcon
A decorative icon slot.
| Parameter | Type | Default |
|---|---|---|
content | () -> Content | - |
TipContent
Holds the title and description.
| Parameter | Type | Default |
|---|---|---|
content | () -> Content | - |
TipTitle
The tip's heading.
| Parameter | Type | Default |
|---|---|---|
_ย title | LocalizedStringKey | - |
verbatim | String | - |
Overloads: init(_:), init(verbatim:).
TipDescription
The tip's supporting text.
| Parameter | Type | Default |
|---|---|---|
_ย description | LocalizedStringKey | - |
verbatim | String | - |
Overloads: init(_:), init(verbatim:).
TipClose
A button that dismisses the tip.
Takes no parameters.
TipStorage.getItem
| Parameter | Type | Default |
|---|---|---|
key | String | - |
Returns String?.
TipStorage.setItem
| Parameter | Type | Default |
|---|---|---|
key | String | - |
value | String | - |
MemoryTipStorage
Takes no parameters.
resetTips
| Parameter | Type | Default |
|---|---|---|
ids | List<String> | - |
storage | TipStorage | DefaultTipStorage |
TipGroup
Shows its tips one at a time and supplies the storage.
| Parameter | Type | Default |
|---|---|---|
storage | TipStorage | LocalTipStorage.current |
content | @Composable () -> Unit | - |
Tip
One hint, identified by id.
| Parameter | Type | Default |
|---|---|---|
id | String | - |
delayMillis | Long | 0 |
onDismiss | () -> Unit | {} |
content | @Composable () -> Unit | - |
TipCard
Renders the tip inline as a card.
| Parameter | Type | Default |
|---|---|---|
modifier | Modifier | Modifier |
content | @Composable () -> Unit | - |
TipAnchor
The element the popover points at.
| Parameter | Type | Default |
|---|---|---|
modifier | Modifier | Modifier |
content | @Composable () -> Unit | - |
TipPopover
Renders the tip as a popover next to the anchor.
| Parameter | Type | Default |
|---|---|---|
modifier | Modifier | Modifier |
side | PopupSide | PopupSide.Bottom |
align | PopupAlign | PopupAlign.Center |
sideOffset | Dp | 10.dp |
content | @Composable () -> Unit | - |
TipIcon
A decorative icon slot.
| Parameter | Type | Default |
|---|---|---|
modifier | Modifier | Modifier |
content | @Composable () -> Unit | - |
TipContent
Holds the title and description.
| Parameter | Type | Default |
|---|---|---|
modifier | Modifier | Modifier |
content | @Composable ColumnScope.() -> Unit | - |
TipTitle
The tip's heading.
| Parameter | Type | Default |
|---|---|---|
text | String | - |
modifier | Modifier | Modifier |
TipDescription
The tip's supporting text.
| Parameter | Type | Default |
|---|---|---|
text | String | - |
modifier | Modifier | Modifier |
TipClose
A button that dismisses the tip.
| Parameter | Type | Default |
|---|---|---|
modifier | Modifier | Modifier |
contentDescription | String | "Dismiss tip" |
