Skip to content

Build Daybreak: a habit tracker

Daybreak is a habit tracker built from fixed content. It shows the progress blocks and gradients at work: a summary ring over a picture, a ring or a Done badge on every habit, and bars for each day of the week. Download the Daybreak project (zip) to follow along or start from it; its README says how to make it your own.

Today: a summary ring over a sunrise, then habits with rings and Done badges.
Today
A habit: a gradient banner, three stats and a bar for each day.
A habit
Insights: four progress rings and weekly bars.
Insights

The numbers here are written into the screens. Connect a database and bind the same blocks to your own fields to make them live.

Each habit gets its own gradient, used for its icon tile, its ring and its bars. A rounded display font keeps it friendly.

{
"colors": {
"background": "#F4F2FB",
"surface": "#FFFFFF",
"primary": "#6D28D9",
"secondary": "#EC4899",
"text": "#1E1B4B",
"muted": "#6E6A8C",
"track": "#ECE9F7",
"on-photo-track": "#B79CF0"
},
"gradients": {
"dawn": {"colors": ["#6366F1", "#EC4899"], "direction": "diagonal"},
"sun": {"colors": ["#F59E0B", "#EC4899"], "direction": "diagonal"},
"mint": {"colors": ["#10B981", "#06B6D4"], "direction": "diagonal"},
"sky": {"colors": ["#3B82F6", "#8B5CF6"], "direction": "diagonal"}
},
"typography": {
"display": {
"fontFamily": "system",
"fontSize": 32,
"fontWeight": 700,
"lineHeight": 38,
"fontDesign": "rounded"
},
"headline": {
"fontFamily": "system",
"fontSize": 22,
"fontWeight": 700,
"lineHeight": 28,
"fontDesign": "rounded"
}
}
}

track is the empty part of a ring or bar: a progress block uses its style’s backgroundColor for the track and its color or gradient for the filled part.

A Cover with the sunrise illustration, a ProgressRing in white and two lines of text beside it:

{
"id": "summary",
"type": "Cover",
"props": {
"height": "lg",
"asset": "assets/sunrise.webp",
"alt": "A sunrise over purple hills.",
"scrim": "bottom",
"contentAlign": "bottom"
},
"style": {
"radius": "$radius.xl",
"shadow": "large",
"padding": "$spacing.lg",
"color": "$color.on-accent"
},
"children": [
{
"id": "summary-line",
"type": "Row",
"props": {},
"preset": "line",
"children": [
{
"id": "summary-ring",
"type": "ProgressRing",
"props": {"value": 33, "label": "Habits done today", "size": "md", "caption": "today"},
"style": {"color": "$color.on-accent", "backgroundColor": "$color.on-photo-track"}
},
{
"id": "summary-words",
"type": "Stack",
"props": {},
"preset": "grow",
"children": [
{
"id": "summary-title",
"type": "Text",
"props": {"text": "2 of 6 done"},
"preset": "white-headline"
},
{
"id": "summary-note",
"type": "Text",
"props": {"text": "A 12 day streak. Keep the morning going."},
"preset": "white-note"
}
]
}
]
}
]
}

Each habit is a tappable Card holding a Row: a gradient icon tile, the name and detail, and a ring for how far along it is today.

{
"id": "h-water",
"type": "Card",
"props": {},
"preset": "habit",
"children": [
{
"id": "h-water-line",
"type": "Row",
"props": {},
"preset": "line",
"children": [
{
"id": "h-water-icon",
"type": "Icon",
"props": {"name": "sparkles", "label": "Drink water", "size": "md", "tile": "rounded"},
"style": {"gradient": "$gradient.mint"}
},
{
"id": "h-water-words",
"type": "Stack",
"props": {},
"preset": "grow",
"children": [
{
"id": "h-water-name",
"type": "Text",
"props": {"text": "Drink water"},
"preset": "label"
},
{
"id": "h-water-detail",
"type": "Text",
"props": {"text": "6 of 8 glasses"},
"preset": "note"
}
]
},
{
"id": "h-water-ring",
"type": "ProgressRing",
"props": {"value": 75, "label": "Drink water", "size": "sm"},
"style": {"gradient": "$gradient.mint", "backgroundColor": "$color.track"}
}
]
}
]
}

A finished habit shows a Done badge instead of a ring:

{
"id": "h-run-done",
"type": "Badge",
"props": {"text": "Done", "icon": "check"},
"style": {"color": "$color.success", "backgroundColor": "$color.done-soft"}
}

The middle Stack has flex: 1, so it takes the width left over and the ring or badge keeps its own size.

A gradient Cover without a picture, then three stats in a three-column Grid:

{
"id": "run-cover",
"type": "Cover",
"props": {"height": "md", "contentAlign": "bottom"},
"style": {
"gradient": "$gradient.sun",
"radius": "$radius.xl",
"padding": "$spacing.lg",
"gap": "$spacing.xs",
"shadow": "large"
},
"children": [
{
"id": "run-icon",
"type": "Icon",
"props": {"name": "bolt", "label": "Running", "size": "xl"},
"style": {"color": "$color.on-accent"}
},
{
"id": "run-title",
"type": "Text",
"props": {"text": "Morning run"},
"preset": "white-display"
},
{
"id": "run-note",
"type": "Text",
"props": {"text": "Every weekday at 6:30 AM"},
"preset": "white-note"
}
]
}

A bar for each day of the week: a label, a ProgressBar that grows to fill the row, and the distance.

{
"id": "run-day-mon",
"type": "Row",
"props": {},
"preset": "line",
"children": [
{
"id": "run-day-mon-name",
"type": "Text",
"props": {"text": "Mon"},
"preset": "label",
"style": {"width": "auto"}
},
{
"id": "run-day-mon-bar",
"type": "ProgressBar",
"props": {"value": 100, "label": "Mon", "size": "md"},
"style": {"gradient": "$gradient.sun", "backgroundColor": "$color.track", "flex": 1}
},
{"id": "run-day-mon-km", "type": "Text", "props": {"text": "5.0 km"}, "preset": "note"}
]
}

A two-column Grid of rings, each with its own gradient:

{
"id": "i-water",
"type": "Stack",
"props": {},
"preset": "stat",
"children": [
{
"id": "i-water-ring",
"type": "ProgressRing",
"props": {"value": 82, "label": "Water", "size": "md"},
"style": {"gradient": "$gradient.mint", "backgroundColor": "$color.track"}
},
{"id": "i-water-name", "type": "Text", "props": {"text": "Water"}, "preset": "label"},
{
"id": "i-water-note",
"type": "Text",
"props": {"text": "23 of 28 days"},
"preset": "note"
}
]
}
{
"items": [
{"routeId": "today", "label": "Today", "icon": "sun"},
{"routeId": "insights", "label": "Insights", "icon": "chart"}
],
"style": "floating",
"material": "solid"
}
Terminal window
npx ynch check
npx ynch upload

Build a habit tracker called Daybreak in .ynch. Lavender background, white cards, a rounded display font and one gradient per habit. A Today tab with a summary ring over a sunrise picture and a list of habits, each with a gradient icon tile and a progress ring or a Done badge. Tapping Morning run opens a screen with a gradient banner, three stats and a progress bar for each day of the week. An Insights tab with four rings and weekly bars. Run npx ynch check until it passes.