Developer docs / UI components

Goals & tracking

Description

As members chat and log, they create records such as meals. These components list, edit and summarize them, and show progress against the member's daily goals.

MealList

Description

An interactive list of meals.

Basic usage

tsx
{{code.b0}}

Props

PropTypeDescription
meals (required)Meal[]The meals to show.
isLoadingbooleanIf true, shows the loading state. Defaults to false.
allowDeletebooleanIf true, the user can swipe a meal to delete it. Defaults to false.
onMealPress(meal: Meal) => voidCalled when the user taps a meal.
onDeleteMeal(mealId: string) => voidCalled when the user deletes a meal.
showTrackingItemsbooleanIf true, shows each meal's tracking item bubbles.

TrackingItemsSummary and StreakTracking

Description

TrackingItemsSummary shows the member's progress on their daily tracking items (for example protein or water) for the selected day. StreakTracking shows their streak cards. Both take data from getTrackingItemsProgress.

Basic usage

tsx
{{code.b1}}

TrackingItemsSummary props

PropTypeDescription
trackingItemsProgress (required)TrackingGroup[]trackingItemsProgress from getTrackingItemsProgress.
selectedDateDateThe day to show.
isLoadingbooleanIf true, shows the loading state.
hideTargetbooleanIf true, hides each item's target.

StreakTracking props

PropTypeDescription
streaks (required)Streak[]streakCards from getTrackingItemsProgress.
onReviewProgress(streakType: string) => voidCalled when the user taps "Review your progress", which medication streaks show.

MealDetail

Description

Shows one meal's details and lets the user edit its ingredients and portions, save it or delete it.

Basic usage

tsx
{{code.b2}}

Props

PropTypeDescription
mealIdstringThe meal to load. Not needed when you pass initialMeal.
initialMealMealA meal you already have; it is shown without fetching.
onDonePress (required)() => voidCalled when the user is done with the meal.
onSave(meal: Meal) => voidCalled with the saved meal after the user saves an edit.
onDelete(mealId: string) => voidCalled when the user deletes the meal.
onNavigateToChat(params: ChatSearchParams) => voidCalled when an edited meal should be re-analyzed in the meal-logging chat. Render Chat with these params (see Chat & coach UI).
isReadOnlybooleanIf true, the user cannot edit or delete the meal. Defaults to false.
chatSessionIdstringThe chat session the meal belongs to.
defaultExpandedbooleanIf true, the meal details start expanded. Defaults to false.
allowBarcodeScanningbooleanLets the user scan a barcode when adding or editing an ingredient. Defaults to true.
hideEditMenubooleanHides the edit menu (the three dots), e.g. for an unsaved draft.

LogPicker

Description

A button that opens a sheet where the user chooses what to log: a meal, or weight and body metrics.

Basic usage

tsx
{{code.b3}}

Props

PropTypeDescription
weightProgress (required){ weightGoal: PlanArtifactWeight | null; weightTracking: WeightTracking | null }The result of getWeightProgress.
bodyCompositionBodyComposition | nullThe result of getBodyComposition.
onUpdateTracking() => Promise<void>Called after the user saves a weight or body metrics entry, so you can refresh your data.
onUpdateWeightGoal() => voidCalled when the user taps the weight goal to edit it.
onLogMeal(meal: Meal) => voidCalled when a meal is logged.
onMealDeleted(mealId: string) => voidCalled after the user deletes a logged meal from the sheet.
onPhotoCapture(images: CameraImage[]) => voidCalled when the user takes photos with the Photo option.
onChatTap() => voidCalled when the user picks the Chat option.

FIOPicker

Description

A button that opens a sheet of "Figure it out" chats, such as restaurants, recipes and cravings.

Basic usage

tsx
{{code.b4}}

Props

PropTypeDescription
onNavigateToChat (required)(params: ChatSearchParams) => voidCalled with the chosen module's chat params.
← Chat and coach UI Next: Measurements →