@molecule/app-time-slot-picker-solid

Feature · time-slot-picker · App (browser) · v1.1.2 · Apache-2.0

Pick a delivery / appointment slot from a list of available time windows

npm install @molecule/app-time-slot-picker-solid

npm · Source on GitHub

How it works

@molecule/app-time-slot-picker-solid is a ready-made time-slot-picker feature for the app (browser) side. It composes the core interfaces it needs, so it works with whichever providers your app has bonded.

import { createSignal } from 'solid-js'

import { TimeSlotPicker } from '@molecule/app-time-slot-picker-solid'

export function DeliveryStep() {
  const [selected, setSelected] = createSignal<string>()
  const slots = [
    { id: 'am', label: '9:00–12:00', meta: '3 spots left' },
    { id: 'pm', label: '14:00–17:00', meta: 'Available' },
    { id: 'eve', label: '18:00–20:00', disabled: true, meta: 'Full' },
  ]
  return (
    <TimeSlotPicker
      slots={slots}
      selectedId={selected()}
      onSelect={(slot) => setSelected(slot.id)}
      layout="grid"
      columns={3}
      title="Pick a delivery window"
    />
  )
}

Works with: @molecule/app-solid, @molecule/app-ui, @molecule/app-ui-solid

Reference

Time-slot picker for delivery / appointment / reservation flows — the Solid counterpart of @molecule/app-time-slot-picker-react.

Exports TimeSlotPicker and the TimeSlot type, with the same props (React names) and the same DOM for the same input.

Auto-generated, AI-first package reference for the molecule.dev ecosystem. It is written to be read by coding agents as much as by people, and is generated from this package's source — edit src/index.ts JSDoc, not this file.

Quick Start

import { createSignal } from 'solid-js'

import { TimeSlotPicker } from '@molecule/app-time-slot-picker-solid'

export function DeliveryStep() {
  const [selected, setSelected] = createSignal<string>()
  const slots = [
    { id: 'am', label: '9:00–12:00', meta: '3 spots left' },
    { id: 'pm', label: '14:00–17:00', meta: 'Available' },
    { id: 'eve', label: '18:00–20:00', disabled: true, meta: 'Full' },
  ]
  return (
    <TimeSlotPicker
      slots={slots}
      selectedId={selected()}
      onSelect={(slot) => setSelected(slot.id)}
      layout="grid"
      columns={3}
      title="Pick a delivery window"
    />
  )
}

Type

feature

Installation

npm install @molecule/app-time-slot-picker-solid @molecule/app-solid @molecule/app-ui @molecule/app-ui-solid solid-js

API

Interfaces

TimeSlot

Represents a single selectable time slot with an optional meta line and disabled state.

interface TimeSlot {
  /** Stable identity, used as the list key and compared with `selectedId`. */
  id: string
  /** Display label — `'14:00–16:00'`, `'Morning (9–12)'`, etc.: text or JSX. */
  label: JSX.Element
  /** Optional secondary line — date, fee, capacity: text or JSX. */
  meta?: JSX.Element
  /** When true, slot is disabled (full / past / unavailable). */
  disabled?: boolean
}

TimeSlotPickerProps

Props accepted by the TimeSlotPicker component.

interface TimeSlotPickerProps {
  /** The selectable slots, rendered in order. */
  slots: TimeSlot[]
  /** Currently selected slot id. */
  selectedId?: string
  /** Called when an enabled slot is picked. */
  onSelect: (slot: TimeSlot) => void
  /** Layout — `'list'` stacks vertically (mobile), `'grid'` lays out in columns. */
  layout?: 'list' | 'grid'
  /** Grid column count (only for `layout='grid'`). Defaults to `2`. */
  columns?: 2 | 3 | 4
  /** Optional title above the slots. */
  title?: JSX.Element
  /** Extra classes. */
  className?: string
}

Functions

TimeSlotPicker(props)

Picker for delivery / appointment / reservation time slots. Each slot shows a label + optional secondary meta (date, fee, remaining capacity). Disabled slots are dimmed and not clickable.

Selection is conveyed by aria-checked plus a bolder label only; the component keeps no state, so the caller persists the pick from onSelect.

function TimeSlotPicker(props: TimeSlotPickerProps): JSX.Element
  • props — Component props (see TimeSlotPickerProps).

Returns: The rendered time-slot picker.

Injection Notes

Requirements

Peer dependencies:

  • @molecule/app-solid ^3.14.0 || ^4.0.0
  • @molecule/app-ui ^1.0.1
  • @molecule/app-ui-solid ^1.1.0
  • solid-js ^1.8.0

Runtime Dependencies

  • @molecule/app-solid

  • @molecule/app-ui

  • @molecule/app-ui-solid

  • solid-js

  • Must render inside the app's i18n provider and with a ClassMap bond wired (useTranslation() / getClassMap() throw otherwise).

  • The picker has NO date/timezone logic — label/meta are opaque nodes. Format times in the user's locale AND timezone yourself before passing them.

  • layout="grid" uses a FIXED column count (no breakpoint collapse) — choose columns for your narrowest supported viewport or switch to layout="list" on mobile.

  • Selection is conveyed by aria-checked + bolder font only — add a selected surface via className logic in your wrapper if the state reads too subtle.

  • Disabled slots are dimmed and non-clickable (onSelect never fires for them).

Translations

Translation strings are provided by @molecule/app-locales-time-slot-picker.