OnboardingYakDocumentation
DocsBuild your onboarding
BUILD YOUR ONBOARDING

Answers and personalization

Capture answers, validate question screens, save variables, and personalize later screens.

Question inputs#

FormatInputValue received
textText field. Set fieldStyle to box, filled, underline, pill, or code (one box per character)String as entered
numberNumeric field and keypad, with the same fieldStyle options except codeString of digits
wheelScrolling (or a horizontal measuring tape with style: "ruler") numeric wheelNumber string in the base unit
dateDate wheelsISO date string
countrySearchable country pickerEnglish country name
Single choiceTap one optionSelected option label
Multiple choiceSelect several optionsComma-separated answer and selected values array
Interactive canvasTap hotspots on an image or blank canvasComma-separated labels and selected hotspot IDs
Photo inputChoose or take a photo; optional app-owned AI analysisPhoto reference plus selected photo details in callbacks

Interactive canvas#

Use an interactive canvas when people should tap locations or objects on a photo, map, diagram, or other image. In Studio, choose the Interactive canvas answer format, then upload a raster image or select one from Media. Add hotspots and position them by dragging on the preview or entering X/Y percentages.

SettingValuesWhat it changes
Canvas widthAutomatic, up to 300 pxCentered and capped to match the Studio phone preview.
Canvas height120–600 pxHeight of the tappable image area; the native viewport caps display height at 420 px.
Corner radius0–40 pxRounds the canvas and clips its background image to match.
Hotspot shapeCircle, Rounded, ChipCircle and Rounded show a marker with its label above; Chip places the label inside the button.
Hotspot sizeSmall, Medium, LargeChanges the tap target size.
Max selections1 to the number of hotspotsLimits how many hotspots a person may select.
Hotspot positionX and Y from 0–100%Places each hotspot relative to the canvas.

The background is optional. Use PNG, JPEG, WebP, or GIF; SVGs and videos are not supported. A blank canvas is useful for placing hotspots over an abstract layout or leaving room for a simple diagram image.

Interactive canvas flow data
{
  "kind": "Question",
  "answerType": "positionPicker",
  "positionPicker": {
    "background": "https://cdn.example.com/map.jpg",
    "height": 320,
    "cornerRadius": 18,
    "hotspotShape": "chip",
    "hotspotSize": "medium",
    "maxSelections": 2,
    "positions": [
      { "id": "park", "label": "Park", "x": 35, "y": 42 },
      { "id": "cafe", "label": "Coffee shop", "x": 72, "y": 68 }
    ]
  }
}

onAnswer receives the selected labels as a comma-separated answer and the stable hotspot IDs in its values array. Use those IDs for branching so changing the visible label does not break the branch.

Photo input and AI analysis#

Choose Photo input on a Question screen for a profile picture, progress photo, or another image the person chooses. In Studio, enable Camera, Library, or both. The React Native SDK draws the photo step, while your app supplies native picker access through onPhotoRequest; the app can keep the image local or upload it to storage you control.

Set the button's action to Analyze photo, then continue. When the person taps it, the app analyzes the photo, waits for the result, and moves on so the next screen can show it. If analysis fails, they see the error and can continue without it. onPhotoAnalyze calls your app, which can send the image to your own backend and return a short result, or { summary, scores } to fill score bars and rings: each score becomes a {score_<name>} variable. The SDK never calls an AI provider or stores provider keys. The person can continue without analysis.

Host app integration
<Onboarding
  {...onboardingProps}
  onPhotoRequest={async (screen, source) => {
    const asset = await pickPhotoWithYourNativePicker(source);
    if (!asset) return null; // cancelled
    const reference = await uploadPhotoIfNeeded(asset.uri);
    return { uri: asset.uri, reference };
  }}
  onPhotoAnalyze={async (screen, photo) => {
    return analyzePhotoWithYourBackend(photo.reference ?? photo.uri);
  }}
  onComplete={(answers, { variables, photos }) => {
    saveOnboarding({ answers, variables, photos });
  }}
/>

Picker return value: the recommended shape is { uri: asset.uri, reference }. Return null only when the person cancels. The SDK also accepts a URI string or the standard Expo ImagePicker { canceled, assets } result, and normalizes absolute file paths to file:// URIs. It needs a readable URI to show the chosen image and “Photo added” confirmation before Continue. If upload succeeds, keep the local asset.uri for the immediate preview and put the durable HTTPS URL in reference for later screens. If the local image cannot be loaded and a reference exists, the SDK tries the reference URL; if neither loads, it shows an integration error.

The picker and upload helpers above belong to your app. Ask for camera/library permission only when needed, explain why the image is collected, and apply your own retention and deletion rules. Local photo URIs are held in memory for this run and excluded from the SDK's resume storage. onComplete receives selected photo details separately in photos, keyed by question screen ID.

Set the photo question's variable to a stable name, such as profile_photo. The answer is a typed photo reference. On a later screen, choose that variable under the image's Personalized photo setting. Set photoInput.analysisVariable in Studio to save AI text as a separate reusable variable.

Photo question data
{
  "kind": "Question",
  "answerType": "photo",
  "variable": "profile_photo",
  "photoInput": {
    "sources": ["camera", "library"],
    "analysis": true,
    "analysisVariable": "photo_summary"
  }
}

Analysis is opt-in per screen and per person. For sensitive images, keep inference on your backend, avoid putting raw image data in text answers, and do not use analysis as a medical diagnosis.

Save and recall variables#

Set a question’s variable field to save the response by name. Reuse it later in titles, subtitles, buttons, loader steps, or checklist text as {name}. Add a fallback with {name|friend}.

Built-in tokens include {app_name}, {first_name}, {today}, and {weekday}. Variables are delivered to onAnswer and onComplete for your app to store or use.

Read answers after completion
onComplete={(answers, { variables }) => {
  saveProfile({ answers, variables });
}}

Branch the flow#

Use showIf to display a screen only when an earlier question matches one or more chosen answers. Screens that do not match are skipped, and Back follows the path the person actually saw.

Conditional screen
{
  "id": "weight-goal",
  "kind": "Question",
  "showIf": { "screen": "goal", "anyOf": ["Lose weight"] },
  "title": "What is your goal weight?",
  "subtitle": "We will use this to personalize your plan.",
  "button": "Continue",
  "accent": "#eef0e6"
}