INTEGRATIONS / SESSION SETUP
A few steps, one draft.
Combine a Stepper, locale-aware Number Fields and a Time Picker in a complete setup workflow. The application owns the final save.
Start with the complete flow.
The session setup block collects workspace details, session preferences and a final review. Back navigation keeps values, each step validates before continuing, and focus moves to the first invalid control or the new step heading.
npx shadcn@latest add https://ui.bld8.dev/r/session-setup.jsonThe Stepper, Number Field and Time Picker are independently installable. Next.js and Vite starters include the same editable source.
Connect the save callback.
'use client';
import {SessionSetup} from '@bld8/blocks';
export default function Setup() {
return <SessionSetup storageKey="my-session-draft-v1"
onSave={async (values, {signal, requestId}) => {
const response = await fetch('/api/session-preferences', {
method:'POST', signal,
headers:{'Content-Type':'application/json',
'Idempotency-Key':requestId},
body:JSON.stringify(values)
});
if (!response.ok) throw new Error('Preferences could not be saved.');
}} />;
}Registry installs use your local bld8/blocks/session-setup path. The callback receives validated, non-null numeric/time values and an AbortSignal. The requestId stays stable for retries of the same values in the mounted form. Your server must authenticate, authorise, validate and enforce idempotency. Persist a host workflow ID if you need that guarantee across reloads or sessions. No endpoint or account system is included.
Failed saves retain the review and its values. Cancel save aborts the signal and ignores late completion. A request may already have committed remotely; reconcile with your service after an uncertain result.
Drafts and storage boundaries.
The default uses sessionStorage for this browser origin and tab, including the current step and finished summary. Pass storage=null for page-only state, or supply a stable getItem/setItem adapter. Give independent forms distinct storageKey values. Initial values seed a mounted form; remount when starting a different workflow.
Unsupported draft data is left intact until the user changes the form. A storage failure preserves values in the page and explains the limitation. The draft contains preferences, not authentication state. No storage is consulted during server rendering.
import {parseSessionDraft,validateSessionPreferences}
from '@bld8/blocks/session-preferences';
const draft = parseSessionDraft(storedText);
const errors = validateSessionPreferences(values);
// Validate authenticated ownership and business rules on the server too.Numbers and wall-clock time.
Number Field uses Base UI parsing with Intl.NumberFormat. Keep numbers as numbers or null, choose explicit limits and positive steps, and use allowOutOfRange when typed values should remain visible for application validation. Buttons, keyboard arrows and Home/End keep bounded stepping; wheel scrubbing stays off.
Time Picker stores HH:mm or null. Labels can use locale defaults or an explicit h12/h23 cycle. Supported intervals are 5, 10, 15, 20, 30 and 60 minutes, anchored to midnight. Min/max limits are inclusive and within the same day; disabledTimes marks exact unavailable choices.
import {createTimeOptions,parseTimeValue} from '@bld8/ui/time-options';
const options = createTimeOptions({
minTime:'09:00', maxTime:'17:00', interval:15,
locale:'en-US', hourCycle:'h12'
});
// Label: 9:30 AM; value: 09:30
const minutes = parseTimeValue('09:30'); // 570This block records a preferred wall-clock time and an IANA region. It does not create a calendar reservation. A date, availability checks and explicit daylight-saving resolution belong to a scheduling service.
Motion and keyboard flow.
Stepper exposes the current step with aria-current and completion with readable state text. The host decides which steps are available and validates navigation. Fields, action rows and headings share alignment; small eased transitions introduce each step while preserving a steady desktop action area. Reduced-motion changes apply immediately. Phone layouts stack the sequence, fields and summary in reading order.