npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

@onboardjs/react

v0.4.8

Published

Official React bindings for OnboardJS.

Readme

@onboardjs/react

npm version License: MIT Discord

Build Status npm downloads

Official React bindings for @onboardjs/core: Build fully custom, dynamic onboarding flows in React and Next.js with maximum flexibility.


✨ Features

  • Headless-first: Bring your own UI—OnboardJS manages the logic.
  • React Hooks API: Use useOnboarding() to access state and actions.
  • Context-based: OnboardingProvider manages and distributes onboarding state.
  • Custom Step Components: Map any step to your own React component.
  • Dynamic Steps: Define steps at runtime, allowing for flexible flows.
  • Persistence: Built-in localStorage support, or plug in your own (e.g., Supabase).
  • TypeScript-first: Full type safety and autocompletion.
  • Next.js Ready: Works with App Router and Pages Router.
  • Plugins: Extend functionality with custom plugins.

🚀 Quickstart

1. Install

npm install @onboardjs/core @onboardjs/react
yarn add @onboardjs/core @onboardjs/react
# or
pnpm add @onboardjs/core @onboardjs/react
# or
bun add @onboardjs/core @onboardjs/react

2. Define Your Steps and Components

// config/onboarding.ts
import { OnboardingStep } from '@onboardjs/core';
import { StepComponentProps } from '@onboardjs/react';

const WelcomeStep: React.FC<StepComponentProps<{ title: string }>> = ({ payload }) => (
  <div>
    <h1>{payload.title}</h1>
    <p>Welcome to the app!</p>
  </div>
);

const NameStep: React.FC<StepComponentProps<{ fieldKey: string }>> = ({ payload, onDataChange }) => (
  <input
    placeholder="Your name"
    onChange={e => onDataChange({ [payload.fieldKey]: e.target.value }, e.target.value.length > 1)}
  />
);

export const steps: OnboardingStep[] = [
  {
    id: 'welcome',
    type: 'CUSTOM_COMPONENT',
    payload: { componentKey: 'welcome', title: 'Hello from OnboardJS!' },
    nextStep: 'name',
  },
  {
    id: 'name',
    type: 'CUSTOM_COMPONENT',
    payload: { componentKey: 'name', fieldKey: 'userName' },
    nextStep: null,
  },
];

export const stepRegistry = {
  // Map step IDs to React components
  welcome: WelcomeStep,
  name: NameStep,

  // Map step types to React components
  INFORMATION: InformationTypeStep,
};

3. Wrap Your App with OnboardingProvider

'use client'

import { OnboardingProvider } from '@onboardjs/react'
import { steps, stepRegistry } from '@/config/onboarding'

export default function OnboardingPage() {
    return (
        <OnboardingProvider
            steps={steps}
            componentRegistry={stepRegistry}
            localStoragePersistence={{
                key: 'onboarding_v1',
                // ttl: 1000 * 60 * 60 * 24, // 1 day (optional)
            }}
        >
            <OnboardingUI />
        </OnboardingProvider>
    )
}

4. Build Your UI with useOnboarding

'use client'
import { useOnboarding } from '@onboardjs/react'

export default function OnboardingUI({ stepsConfig, stepComponentRegistry }) {
    const { state, next, isLoading, renderStep } = useOnboarding()

    if (!state || !state.currentStep) return <p>Loading...</p>
    if (state.isCompleted) return <p>Onboarding complete! 🎉</p>

    return (
        <div>
            <h2>{state.currentStep.title}</h2>
            {renderStep()}
            <button onClick={() => next()} disabled={isLoading || !state.canGoNext}>
                Next
            </button>
        </div>
    )
}

📝 Next.js Integration

  • Client Components: OnboardingProvider and any component using useOnboarding must be a Client Component ('use client';).
  • Persistence: Use localStoragePersistence for out-of-the-box device bound progress saving, or provide your own handlers for Supabase, Neon, etc.
  • Examples: See onboardjs/apps/examples.

📚 Documentation & Community


Build onboarding your way. Star the repo, join the community, and help us shape the future of onboarding for React and Next.js!