@molecule/app-time-slot-picker-vue
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-vueHow it works
@molecule/app-time-slot-picker-vue 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 { createApp, defineComponent, h, ref } from 'vue'
import { TimeSlotPicker } from '@molecule/app-time-slot-picker-vue'
const DeliveryStep = defineComponent({
setup() {
const selected = ref<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 () =>
h(TimeSlotPicker, {
slots,
selectedId: selected.value,
onSelect: (slot) => {
selected.value = slot.id
},
layout: 'grid',
columns: 3,
title: 'Pick a delivery window',
})
},
})
createApp(DeliveryStep).mount('#app')Works with: @molecule/app-ui, @molecule/app-ui-vue, @molecule/app-vue
Reference
Time-slot picker for delivery / appointment / reservation flows — the Vue
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.tsJSDoc, not this file.
Quick Start
import { createApp, defineComponent, h, ref } from 'vue'
import { TimeSlotPicker } from '@molecule/app-time-slot-picker-vue'
const DeliveryStep = defineComponent({
setup() {
const selected = ref<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 () =>
h(TimeSlotPicker, {
slots,
selectedId: selected.value,
onSelect: (slot) => {
selected.value = slot.id
},
layout: 'grid',
columns: 3,
title: 'Pick a delivery window',
})
},
})
createApp(DeliveryStep).mount('#app')
Type
feature
Installation
npm install @molecule/app-time-slot-picker-vue @molecule/app-ui @molecule/app-ui-vue @molecule/app-vue vue
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 a VNode. */
label: VNodeChild
/** Optional secondary line — date, fee, capacity: text or a VNode. */
meta?: VNodeChild
/** 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: a prop, or the same-named slot. */
title?: VNodeChild
/** Extra classes. */
className?: string
}
Constants
TimeSlotPicker
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.
const TimeSlotPicker: DefineComponent<
ExtractPropTypes<{
slots: { type: PropType<TimeSlot[]>; default: () => never[] }
selectedId: StringConstructor
onSelect: { type: PropType<(slot: TimeSlot) => void>; default: undefined }
layout: { type: PropType<'list' | 'grid'>; default: string }
columns: { type: PropType<2 | 3 | 4>; default: number }
title: null
className: StringConstructor
}>,
() => VNode,
{},
{},
{},
ComponentOptionsMixin,
ComponentOptionsMixin,
{},
string,
PublicProps,
Readonly<
ExtractPropTypes<{
slots: { type: PropType<TimeSlot[]>; default: () => never[] }
selectedId: StringConstructor
onSelect: { type: PropType<(slot: TimeSlot) => void>; default: undefined }
layout: { type: PropType<'list' | 'grid'>; default: string }
columns: { type: PropType<2 | 3 | 4>; default: number }
title: null
className: StringConstructor
}>
> &
Readonly<{}>,
{
slots: TimeSlot[]
onSelect: (slot: TimeSlot) => void
layout: 'list' | 'grid'
columns: 2 | 3 | 4
},
{},
{},
{},
string,
ComponentProvideOptions,
true,
{},
any
>
props— Component props (seeTimeSlotPickerProps).
Returns: The time-slot picker component.
Injection Notes
Requirements
Peer dependencies:
@molecule/app-ui^1.0.1@molecule/app-ui-vue^1.1.0@molecule/app-vue^3.13.0 || ^4.0.0vue^3.4.0
Runtime Dependencies
-
@molecule/app-ui -
@molecule/app-ui-vue -
@molecule/app-vue -
vue -
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/metaare 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) — choosecolumnsfor your narrowest supported viewport or switch tolayout="list"on mobile. -
Selection is conveyed by
aria-checked+ bolder font only — add a selected surface viaclassNamelogic in your wrapper if the state reads too subtle. -
Disabled slots are dimmed and non-clickable (
onSelectnever fires for them). -
Node-valued props (
title, and an item'slabel/meta) arrive as a prop or as the same-named slot fortitle.
Translations
Translation strings are provided by @molecule/app-locales-time-slot-picker.