Ultra-lightweight, framework-agnostic user onboarding, guided tour, product walkthrough, interactive tutorial, and step-by-step help library for web applications
npm install @raj-dev/tourlitebash
npm install @raj-dev/tourlite
`
๐ Quick Start
`javascript
import Tourlite from "@raj-dev/tourlite";
const tour = new Tourlite({
steps: [
{
element: "#create-btn",
content: "Click here to create your first item"
},
{
element: ".settings",
content: "Manage preferences here"
},
{
element: document.querySelector(".profile"),
content: "View your profile"
}
]
});
tour.start();
`
๐ Usage Examples
$3
`javascript
import Tourlite from "@raj-dev/tourlite";
const tour = new Tourlite({
steps: [
{
element: "#welcome-card",
content: "Welcome! This is your dashboard."
},
{
element: "#create-button",
content: "Click here to create a new item."
},
{
element: ".settings-icon",
content: "Access your settings from here."
}
]
});
// Start the tour
document.getElementById("start-tour-btn").addEventListener("click", () => {
tour.start();
});
`
$3
`javascript
const tour = new Tourlite({
steps: [
{
element: "#header", // ID selector
content: "This is the header"
},
{
element: ".nav-item", // Class selector
content: "Navigation items"
},
{
element: "[data-tour='step3']", // Attribute selector
content: "Custom attribute selector"
}
]
});
`
$3
`javascript
const button = document.querySelector("#my-button");
const card = document.getElementById("feature-card");
const tour = new Tourlite({
steps: [
{
element: button, // Direct DOM element reference
content: "This button does something special"
},
{
element: card,
content: "This card contains important information"
}
]
});
`
$3
`javascript
const tour = new Tourlite({ steps: [...] });
// Start tour
tour.start();
// Navigate programmatically
tour.next(); // Go to next step
tour.prev(); // Go to previous step
tour.end(); // End the tour
tour.destroy(); // Alias for end()
// Check if tour is active
if (tour.isActive) {
console.log("Tour is running");
}
`
$3
Customize the tour appearance to match your brand:
`javascript
const tour = new Tourlite({
steps: [
{
element: "#feature-1",
content: "This is a custom themed tour!"
},
{
element: "#feature-2",
content: "Notice the custom colors and styling."
}
],
theme: {
primaryColor: "#ff5722", // Orange primary buttons
primaryTextColor: "#ffffff", // White text on primary
secondaryColor: "#f5f5f5", // Light gray secondary buttons
secondaryTextColor: "#333333", // Dark text on secondary
tooltipBg: "#1e1e1e", // Dark tooltip background
tooltipTextColor: "#ffffff", // White tooltip text
fontFamily: "Inter, sans-serif" // Custom font
}
});
tour.start();
`
Theme is optional - If no theme is provided, Tourlite uses beautiful defaults (white tooltip, blue buttons). You can customize any or all theme properties.
$3
Track tour events with optional callbacks:
`javascript
const tour = new Tourlite({
steps: [
{
element: "#welcome",
content: "Welcome to the tour!"
},
{
element: "#feature",
content: "This is a key feature."
}
],
onStart() {
console.log("Tour started");
// Track analytics, show welcome message, etc.
},
onDone() {
console.log("Tour completed!");
localStorage.setItem("tour_seen", "true");
// Mark tour as completed, show completion message, etc.
},
onClose() {
console.log("Tour closed early");
localStorage.setItem("tour_seen", "true");
// Handle early exit, track abandonment, etc.
}
});
tour.start();
`
Callback behavior:
- onStart() - Fired when tour.start() is called
- onDone() - Fired only when user completes the last step (clicks "Finish")
- onClose() - Fired when user exits early (close button, Esc key, or overlay click)
๐ฎ API Reference
$3
#### new Tourlite(options)
Creates a new tour instance.
Parameters:
| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| options | Object | Yes | Configuration object |
| options.steps | Array | Yes | Array of tour steps |
| options.theme | Object | No | Optional theme customization object |
| options.onStart | Function | No | Callback fired when tour starts |
| options.onDone | Function | No | Callback fired when user completes the last step |
| options.onClose | Function | No | Callback fired when user exits early (close button or Esc) |
Step Object:
| Property | Type | Required | Description |
|----------|------|----------|-------------|
| element | String \| HTMLElement | Yes | CSS selector or DOM element to highlight |
| content | String | Yes | Text content to display in tooltip |
Theme Object (Optional):
| Property | Type | Required | Description |
|----------|------|----------|-------------|
| theme.primaryColor | String | No | Primary button background color (e.g., "#007bff") |
| theme.primaryTextColor | String | No | Primary button text color (e.g., "#ffffff") |
| theme.secondaryColor | String | No | Secondary button background color (e.g., "#ffffff") |
| theme.secondaryTextColor | String | No | Secondary button text color (e.g., "#333333") |
| theme.tooltipBg | String | No | Tooltip background color (e.g., "#ffffff") |
| theme.tooltipTextColor | String | No | Tooltip text color (e.g., "#333333") |
| theme.fontFamily | String | No | Font family for tooltip (e.g., "Inter, sans-serif") |
$3
#### tour.start()
Starts the tour from the first step.
`javascript
tour.start();
`
#### tour.end()
Ends the tour and cleans up all DOM elements and event listeners.
`javascript
tour.end();
`
#### tour.next()
Advances to the next step. If already on the last step, ends the tour.
`javascript
tour.next();
`
#### tour.prev()
Goes back to the previous step. Does nothing if already on the first step.
`javascript
tour.prev();
`
#### tour.destroy()
Alias for end(). Ends the tour and cleans up all resources.
`javascript
tour.destroy();
`
โจ๏ธ Keyboard Navigation
Tourlite includes full keyboard support:
| Key | Action |
|-----|--------|
| Esc | Close/end the tour |
| โ (Arrow Right) | Next step |
| โ (Arrow Left) | Previous step |
๐จ Styling & Theming
Tourlite injects minimal CSS automatically. All styles use the ut-* prefix to avoid conflicts:
- .ut-overlay - The dark overlay background (fades in)
- .ut-tooltip - The tooltip container (slides up and fades in)
- .ut-content - Tooltip text content
- .ut-btn - Navigation buttons
- .ut-highlight - Highlighted element (z-index boost)
$3
Tourlite includes lightweight CSS-only animations:
- Overlay: Smooth fade-in (150ms)
- Tooltip: Slide-up and fade-in (150ms)
Animations are subtle and performant, using CSS @keyframes with no JavaScript overhead.
$3
The recommended way to customize Tourlite is through the theme option, which uses CSS variables:
`javascript
const tour = new Tourlite({
steps: [...],
theme: {
primaryColor: "#ff5722",
primaryTextColor: "#ffffff",
tooltipBg: "#1e1e1e",
tooltipTextColor: "#ffffff",
fontFamily: "Inter, sans-serif"
}
});
`
$3
You can also override styles using CSS if needed:
`css
.ut-tooltip {
background: #your-color !important;
border-radius: 12px !important;
}
.ut-btn-primary {
background: #your-brand-color !important;
}
`
Note: Theme customization via the theme option is preferred as it's more maintainable and doesn't require !important flags.
๐ Browser Support
Tourlite works in all modern browsers that support:
- ES2020+ features
- ES Modules
- getBoundingClientRect()
- classList API
Tested in:
- โ
Chrome 90+
- โ
Firefox 88+
- โ
Safari 14+
- โ
Edge 90+
๐ Bundle Size
| Format | Size | Gzipped |
|--------|------|---------|
| ESM | 5.2 KB | ~1.8 KB |
| UMD | 5.4 KB | ~1.9 KB |
๐ฏ Why Tourlite?
Tourlite is the perfect solution for adding interactive product tours, user onboarding flows, step-by-step tutorials, feature highlights, and contextual help to your web application. Whether you're building a SaaS product, web app, dashboard, or any interactive website, Tourlite provides a lightweight, performant way to guide users through your interface.
$3
| Feature | Tourlite | Intro.js | Shepherd | UserGuiding |
|---------|----------|----------|----------|-------------|
| Bundle Size | 5.2 KB | ~10 KB | ~45 KB | ~50+ KB |
| Dependencies | 0 | 0 | 2+ | Multiple |
| Framework Support | All | All | All | Limited |
| DOM Nodes | 2 | Multiple | Multiple | Multiple |
| API Complexity | Simple | Medium | Complex | Complex |
| Performance | Excellent | Good | Good | Good |
| Customization | Easy | Medium | Complex | Limited |
$3
- Product Tours - Introduce new features and guide users through your application
- User Onboarding - Welcome new users and help them get started
- Feature Highlights - Draw attention to important features and updates
- Interactive Tutorials - Create step-by-step guides for complex workflows
- Contextual Help - Provide in-app assistance and tooltips
- Product Walkthroughs - Showcase your product's capabilities
- User Journey Mapping - Guide users through specific user flows
- In-App Training - Train users on how to use your application
$3
1. Minimalism - Only essential features, no bloat
2. Performance - Reuses DOM nodes, no unnecessary reflows
3. Simplicity - Easy to understand and customize
4. Compatibility - Works everywhere, no framework lock-in
5. Accessibility - Keyboard navigation and semantic HTML
6. Developer Experience - Clean API, comprehensive documentation
๐ ๏ธ Development
`bash
Clone the repository
git clone
cd ppp
Install dependencies
npm install
Build the library
npm run build
Watch mode for development
npm run dev
``