Next.js

How to set up Flows in your Next.js application.

Next

Flows makes it easy to add product adoption experiences into your React app built with Next.js. Integrating Flows into your app enables you to create interactive workflows, user onboarding, guided tours, in-app messaging, and more.

This guide walks you through integrating Flows into your Next.js app using the React SDK and components package to get you started.

Check out our template projects for examples of how to implement Flows in your application.

Install the React SDK and components package

You can install the Flows React SDK from npm:

npm i @flows/react @flows/react-components

Integrate FlowsProvider in your application

Create a Flows client component that wraps your application with the FlowsProvider. Then add the Flows component to your root layout.

"use client";

import Link from "next/link";

import { FlowsProvider } from "@flows/react";
import * as components from "@flows/react-components";
import * as tourComponents from "@flows/react-components/tour";

import "@flows/react-components/index.css";

export default function Flows({ children }) {
  return (
    <FlowsProvider
      organizationId="YOUR_ORGANIZATION_ID" // Find this in Settings > General
      userId="YOUR_USER_ID" // Replace this with user id from your app
      environment="production" // Default environment
      components={{ ...components }}
      tourComponents={{ ...tourComponents }}
      LinkComponent={Link}
    >
      {children}
    </FlowsProvider>
  );
}

For a full list of supported properties, see the FlowsProvider documentation. For an example of how to create a custom component, see the Next.js template project.

Create your first workflow

That's it! You're now ready to create your first workflow. See our quickstart guide for more information.

Last updated on

On this page