shadcn.io is not affiliated with official shadcn/ui
Nutritionist Plan Builder Profile Block for React Aria
A nutritionist's example plan builder: a plan control and a calorie slider that work out the macro split in grams and percent, drawn as a three-part bar, then four meals that take their share of the calories.
Installation
Overview
Let a visitor try a day of eating, with this nutritionist plan builder profile for React with React Aria. A compact header says it is an example and nothing is prescribed, and the hairline frame under it opens on the nutritionist, labelled as a sample profile. A band holds two controls: a Segment Group for the plan (Balanced, High-protein or Plant-forward) with that plan's dietary tags under it, and a Slider for the day's calories from 1,400 to 2,600. The macro split is worked out from both: grams of protein, carbohydrate and fat, and percentages shared by largest remainder so they always add up to 100, drawn as a three-part bar and spelled out line by line in a Data List. Four meal slots take their share of the calories, each with an example dish, and their calories add up to the day. The foot, ruled by Guides, holds a status line. It's built from Segment Group, Slider, Data List, Badge, Avatar and Guides, with a CSS entrance only. For a nutrition practice, a health coach's page or any profile that shows a plan.
FAQ
How do I fill it with my own plans?
Edit PLANS. Each has an id, a name, a split of the calories between protein, carbohydrate and fat, four example dishes in the order of MEALS, and its dietary tags. MEALS lists the slots with their share of the day, and MIN_KCAL, MAX_KCAL and STEP_KCAL set the slider. The grams, the percentages and each meal's calories are worked out from them.
How is the split worked out?
Protein and carbohydrate are four calories a gram and fat nine, so each macro's grams come from its share of the day's calories. The percentages are then shared out from those grams by the largest-remainder method, so they always add up to 100, and the meal calories are rounded the same way so the four slots add up to the day.
Is this nutrition advice?
No. It is a labelled sample: the person, the plans and the dishes are invented, nothing here prescribes or diagnoses, and the header and the status line say so. Replace it with your own content and keep a line like that if you show real plans.