intro
TimeRangePicker
An organism for selecting a time range, composing two TimePicker molecules with integrated boundaries.
TimeRangePicker
The TimeRangePicker organism follows the Curva & Concreto doctrine. It wraps two TimePicker molecules in a grid layout to facilitate start and end time selection while natively enforcing dynamic minimum and maximum bounds between the inputs.
Specimen
Basic Usage
With Constraints (min/max)
Validation State
Usage
<script> import { TimeRangePicker } from 'cobogo';
let start = '09:00'; let end = '17:00';</script>
<TimeRangePicker bind:start bind:end />Dynamic Constraints
The TimeRangePicker intrinsically limits choices to prevent illogical time ranges. If a start time is selected, the end time’s internal min attribute is set to that start time. If an end time is selected, the start time’s max is restricted.
You can also pass global min and max limits:
<TimeRangePicker bind:start bind:end min="08:00" max="18:00" />Integration with FormField
Like all form inputs in COBOGÓ, TimeRangePicker integrates seamlessly with the FormField wrapper. When placed inside a FormField, the TimeRangePicker automatically inherits the wrapper’s id (appending -start and -end suffixes), aria-describedby, and invalid validation state.
<FormField label="Meeting Time" id="meeting" invalid> <TimeRangePicker bind:start bind:end /> <div slot="message">The selected time range is invalid.</div></FormField>Props
| Prop | Type | Default | Description |
|---|---|---|---|
start | string | undefined | The start time value (bindable). |
end | string | undefined | The end time value (bindable). |
min | string | undefined | The global minimum allowed time (e.g., ‘09:00’). |
max | string | undefined | The global maximum allowed time (e.g., ‘18:00’). |
disabled | boolean | false | Disables both time inputs. |
invalid | boolean | false | Applies the invalid state to both inputs. Overridden by FormField context if present. |
size | 'sm' | 'md' | 'lg' | 'md' | The size variant of the inputs. |