Package Exports
- trail-js
Readme
π§ trail-js
A flexible, minimalistic walkthrough library for React apps. Build guided user tours with step-by-step overlays, tooltips, and logic-based navigation. Perfect for onboarding, product tours, and in-app guidanceβfully customizable and framework-agnostic.
π Try the Interactive Demo
Explore a live walkthrough experience using all of trail-js' features.
Conditional steps, lifecycle events, custom UIsβsee it all in action.
Click, explore, and learn how powerful simple guidance can be!
π§° Features
- πͺ Step-by-step Overlays: Highlight any DOM element with tooltips and callouts.
- ποΈ Custom Navigation UI: Override navigation controls with your own components.
- β‘ Conditional Logic: Use
canGoNext()
to enable/disable step transitions. - π Lifecycle Hooks: Add
onEnter
callbacks for side effects or state updates. - π§ State-Aware: Dynamically change steps based on your app state.
- π¨ Custom Styling: Control placement, animation, and appearance of tooltips.
- π Framework-Agnostic API: Bring your own UI components and controls.
- π¦ Fully Typed: TypeScript-first developer experience.
π¦ Installation
# npm
npm install trail-js
π API Reference
Property | Type | Description |
---|---|---|
selector |
string |
CSS selector to attach tooltip |
content |
ReactNode |
Tooltip content |
placement |
"top" | "bottom" | "left" | "right" |
Position relative to target |
canGoNext |
() => boolean |
Optional function to gate progress |
onEnter |
() => void |
Callback fired when step is shown |
customNavigation |
({ goNext, goPrev, close }) => JSX |
Custom nav component override |