Skip to content

Sleep Tracker Onboarding with Bedtime Picker

Sleep tracker onboarding screen with a bedtime and wake time picker, a 24-hour sleep dial that computes sleep duration, and a notification opt-in step.

Also known as: sleep app onboarding, bedtime picker ui, wake up time picker, sleep schedule setup screen, sleep duration calculator ui

Sleep Tracker Onboarding with Bedtime Picker live demo

Open in new tab

Pure CSS code (HTML, CSS, JS)

A dark sleep tracker onboarding screen in pure CSS and vanilla JavaScript: a welcome step with a bedtime picker and wake time picker, a 24-hour sleep dial that shows the sleep duration, and a notification opt-in step. It is an HTML mobile template for mobile sites and PWAs and can be packaged as a native app with Capacitor. Use it as the first-run flow of a sleep app UI, a sleep schedule setup screen or a wellness tracker.

How it works

The root .sto-app is a 430 px app column with a compact top bar (Back, the Driftwell brand, Skip), three .sto-seg progress segments and three [data-sto-panel] steps. A sticky .sto-footer holds the main button, whose label changes per step.

Step 1 shows two .sto-time cards. Each time value is a role="spinbutton" that reacts to Arrow and Page Up / Page Down keys; the buttons in .sto-stepper do the same. render() recalculates the duration across midnight and draws the .sto-ring-arc on a 24-hour ring with stroke-dasharray, then moves the moon and sun knobs. The .sto-chip presets set both times. Schedules under 4 or over 12 hours show an error.

Step 2 lists role="switch" toggles for a bedtime reminder, wind-down tips and a smart wake alarm, plus a reminder lead time group. "Allow notifications" simulates a permission prompt; "Not now" continues with notifications off.

Step 3 summarises the schedule. Dates such as "tonight" and the first report day are computed from the current date and shown without a year.

Customization

  • --sto-bg, --sto-surface and --sto-accent on .sto-app in style.css: night background, card colour and the lavender accent of buttons, arc and chips.
  • --sto-radius: corner rounding of cards, buttons and the summary list.
  • STEP_MINUTES in script.js: step size of the steppers and arrow keys, e.g. 5 or 30 minutes.
  • MIN_SLEEP, MAX_SLEEP and GOAL: the allowed schedule length and the range that counts as "Right on target".
  • data-sto-preset on each .sto-chip: bedtime and wake time in minutes after midnight, e.g. 1380,420 for 11:00 PM to 7:00 AM.
  • SMART_WINDOW: how many minutes before the alarm the smart wake window starts.
  • Replace the setTimeout in the step 2 branch of the next click handler with Notification.requestPermission() or a Capacitor notifications plugin.

Use cases

  • Sleep tracking apps: new users set their schedule before the first tracked night.
  • Smart alarm and white noise apps: collect wake time and reminder preferences in one flow.
  • Wellness and habit apps: add a sleep goal step to a wider onboarding.

Accessibility

Time values are spinbuttons with aria-valuenow and a readable aria-valuetext. Presets use aria-pressed, toggles use role="switch" with aria-checked, and the lead time group uses roving tabindex with arrow keys. The dial centre is a polite live region, step changes are announced through [data-sto-live] and focus moves to each step heading. Every control is at least 44 px tall, and switch motion is turned off for prefers-reduced-motion.

Sleep Tracker Onboarding with Bedtime Picker at a glance

Framework
Pure CSS
Code
HTML, CSS, JavaScript
JavaScript
Vanilla JavaScript, no jQuery
Dependencies
fonts.googleapis.com
Layout
Mobile-first app screen, centred on wider screens, dark design
Category
Onboarding Screens
License
Free for personal and commercial use

Questions about this template

Can I use the Sleep Tracker Onboarding with Bedtime Picker code for free?

Yes. You can copy or download the code and use it in personal and commercial projects, including client work. No sign-up is needed. Reselling it as part of a component library or template collection is not allowed; see the license.

How do I add it to my website?

Load fonts.googleapis.com from a CDN (the links are under Requirements). Paste the HTML where the component should appear, add the CSS to your stylesheet and load the JavaScript before the closing </body> tag. Download HTML gives you a complete page with everything already linked.

Does it need jQuery or a JavaScript framework?

No. The script is plain vanilla JavaScript, so it works without jQuery, React or Vue. You can still use the markup inside those frameworks.

Can I turn this screen into an iOS or Android app?

Yes. It is plain HTML, CSS and JavaScript, so it works in a mobile website or progressive web app as it is. To ship it as a store app, put it in the web folder of a Capacitor or Cordova project and build it for iOS and Android; replace the sample data with calls to your own API.

How does it look on a desktop screen?

The screen is designed for phones. On wider screens it stays at phone width in the middle of the page, so it still looks like an app. The live demo opens at mobile width; use the Tablet and Desktop buttons to check other sizes.

Requirements

Add these to your page (already included in the download):

  • <link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Nunito:wght@400;600;700;800&display=swap">
Sleep Tracker Onboarding with Bedtime Picker – free Pure CSS onboarding screen template
Sleep Tracker Onboarding with Bedtime Picker · free Pure CSS onboarding screen template

More Onboarding Screens

Budget App Onboarding with Spending Goals – free Bootstrap 6 onboarding screen template

Budget App Onboarding with Spending Goals

Budget app onboarding screen with a welcome step, spending goal chips, a savings target stepper and an optional bank connect sheet: a mobile finance app setup flow.

Language Learning App Onboarding – free Bootstrap 6 onboarding screen template

Language Learning App Onboarding

Language learning app onboarding screen with flag language picker, level choice, daily goal and progress bar: a three-step mobile app onboarding flow with swipe support.

News App Topic Picker Onboarding – free Tailwind CSS onboarding screen template

News App Topic Picker Onboarding

News app topic picker onboarding screen: follow topics as chips with follower counts, search them and continue once three interests are selected.

Meditation App Onboarding with Goals – free Pure CSS onboarding screen template

Meditation App Onboarding with Goals

Meditation app onboarding screen where users pick goals as selectable cards, set a daily reminder time and days, then see their plan, with a step counter.

Banking App Welcome and Permissions – free Bootstrap 5 onboarding screen template

Banking App Welcome and Permissions

Banking app welcome screen with a notifications and Face ID permission flow, clear explanations, Allow and Not now buttons and a setup summary.

Fitness App Onboarding Screens – free Tailwind CSS onboarding screen template

Fitness App Onboarding Screens

Fitness app onboarding screens with three swipeable steps, SVG illustrations, progress dots, Skip and Get started, built as a mobile app intro walkthrough.