Skip to content

Onboarding

Screens for getting started: onboarding, creating a workspace, accepting an invite and a multi-step setup wizard.

Installation & usage

npx @youj/cli add app-onboarding

Also installs async-button, button, card, empty, field, grid-backdrops, icon-check-circle, icon-rocket, icon-sparkles, icon-user-plus, icon-x, illustrations, input, input-group, presence-list, radio-group, stepper, youj-core, youj-presets, youj-ui-core.

The CLI copies the block to blocks/app/onboarding.tsx with every component it uses, so it’s yours to edit.

Every prop is optional and falls back to the demo, so it renders as you see it until you pass your own. Give it your data, rewrite or translate its strings through copy, and connect its actions:

onboarding-view.tsx
'use client'

import Link from 'next/link'
import { Onboarding, type OnboardingProps } from '@/blocks/app/onboarding'

export function OnboardingView({ presets }: Pick<OnboardingProps, 'presets'>) {
  return (
    <Onboarding
      presets={presets}
      copy={{ page: 'Set up your workspace' }}
      linkComponent={Link}
      onFinish={(setup) => {
        // your code
      }}
      onStepChange={(step) => {
        // your code
      }}
      onOpenDashboard={() => {
        // your code
      }}
    />
  )
}

Reference

Props13 props, 1 types

Props

Onboarding props
PropType
onFinish(setup: OnboardingSetup) => unknown

Creates the workspace from the answers; resolve to show "You're all set", throw to show why it failed.

default a demo wait

a demo wait
illustrationIllustrationSlot

The welcome step's picture: a scene from the illustrations by id, your own node, or null for the sparkles icon.

default 'team'

'team'
brand{ name: string; logo?: ReactNode }

The product the welcome names.

default Northwind

Northwind
defaultValuesPartial<OnboardingSetup>

Answers filled in at the start, e.g. the company name from sign-up.

–
presetsstring[]

The theme presets to choose from, by id.

default every preset

every preset
stepnumber

The open step (0–3), controlled. Pair it with onStepChange.

–
defaultStepnumber

The step open at first, uncontrolled.

default 0

0
onStepChange(step: number) => void

Called with the step a Back, Get started or Continue moves to.

–
dashboardHrefstring

Where "Open your dashboard" goes; without it the button calls onOpenDashboard.

–
onOpenDashboard() => void

Called from "Open your dashboard".

–
linkComponentElementType

Renders the dashboard link, e.g. Next.js Link.

default 'a'

'a'
headingLevel1 | 2 | 3

The page title's level (visually hidden); step titles sit one below.

default 1

1
copyPartial<OnboardingCopy>

Any of the flow's strings, to rewrite or translate.

–

OnboardingSetup

OnboardingSetup props
PropType
nameRequiredstring–
themestring

The picked theme preset's id, else the app's own preset's; undefined when neither is a preset.

–
invitesRequiredstring[]–
Strings40 keys for copy

Strings

copy takes any of these keys; the rest keep their defaults. A key whose text holds a value (a count, a name) takes a function.

pagestepperstepWelcomestepWorkspacestepThemestepInvitewelcomeTitlewelcomeDescriptionnameTitlenameDescriptionnameLabelnamePlaceholdernameRequiredurlurlPrefixurlFallbackurlDescriptionthemeTitlethemeDescriptionthemeGroupthemePreviewinviteTitleinviteDescriptionemailemailPlaceholderemailInvalidemailTakenaddinvitesremovebackstartcontinuefinishingfinishedfinishfaileddoneTitledoneDescriptionopenDashboard
Built from11 components
Accessibilitylandmarks, headings, forms, progress

Accessibility

Each screen is a main with one heading (h1 by default; headingLevel changes it). Onboarding’s step indicator is labelled, its theme choice is a labelled radio group, and Enter moves to the next step from its text fields. Create workspace announces the result of the address check in a live region. Setup wizard announces step changes in a live region and labels its review sections. Accept invite shows the inviter’s avatar with alt text. Links and buttons are real a and button elements with the kit’s focus ring.