Skip to content

Conditional Navigation

ChiefVenzox edited this page Jun 5, 2026 · 1 revision

Conditional Navigation

NotebookFlowKit supports both linear and answer-based navigation.

Linear Navigation

Use a string next value to move to a fixed screen.

{
  "id": "welcome",
  "type": "text",
  "title": "Welcome",
  "next": "goal"
}

Answer-Based Routing

Use an object next value to route based on the user's answer.

{
  "id": "goal",
  "type": "choice",
  "title": "What is your goal?",
  "options": ["Focus", "Fitness", "Learning"],
  "next": {
    "Fitness": "fitness_setup",
    "Learning": "learning_setup",
    "default": "focus_setup"
  }
}

If the user selects Fitness, the flow advances to fitness_setup.

If the user selects Learning, the flow advances to learning_setup.

If no specific route matches, the default route is used.

Multi-Choice Routing

For multiChoice screens, NotebookFlowKit checks selected answers in order and uses the first selected option that has a route.

{
  "id": "topics",
  "type": "multiChoice",
  "title": "Pick topics",
  "options": ["SwiftUI", "Python", "Design"],
  "next": {
    "SwiftUI": "swiftui_path",
    "Python": "python_path",
    "default": "general_path"
  }
}

Text Input Routing

Text input screens can also use routes, matching the exact entered text.

{
  "id": "access_code",
  "type": "input",
  "title": "Enter your access code",
  "next": {
    "BETA": "beta_setup",
    "default": "standard_setup"
  }
}

Validation

All route targets are validated by NotebookFlowLoader.

If a route points to a missing screen, loading fails before the flow renders.

Clone this wiki locally