# Time picker

Source: https://ecosphere.dev/docs/forms/time-picker (Ecosphere 1.5). Install `vue-ecosphere` for Vue 3 or `react-ecosphere` for React 18.2+/19: same components, props, markup and stylesheet.

A time field and the list of times that opens from it.

`import { EcoTimePicker } from "vue-ecosphere"`

## Time field

Times are banded Morning and Afternoon. Type any time the list does not hold.

Vue (vue-ecosphere):

```vue
<EcoTimePicker v-model="sendAt" label="Send at" hint="Your timezone, GMT+5:30."
  start="08:00" end="14:00" :step="30" first />
```

React (react-ecosphere):

```tsx
const [sendAt, setSendAt] = useState("09:30");

<EcoTimePicker value={sendAt} onChange={setSendAt} label="Send at" hint="Your timezone, GMT+5:30."
  start="08:00" end="14:00" step={30} first />
```

## Empty

Vue (vue-ecosphere):

```vue
<EcoTimePicker v-model="reminder" label="Reminder" placeholder="HH:MM AM" first />
```

React (react-ecosphere):

```tsx
const [reminder, setReminder] = useState("");

<EcoTimePicker value={reminder} onChange={setReminder} label="Reminder" placeholder="HH:MM AM" first />
```

## API

Vue (vue-ecosphere):

| Name | Type | Default | Description |
| --- | --- | --- | --- |
| `v-model` | `string` | "" | 24-hour HH:mm. The field shows 09:30 AM and stays typeable. |
| `v-model:open` | `boolean` | false | Whether the list is open. |
| `step` | `number` | 30 | Minutes between options. |
| `start / end` | `string` | "08:00" / "18:00" | First and last option, HH:mm. Offer the times people actually pick. |
| `hour12` | `boolean` | true | 09:30 AM rather than 09:30. |
| `label / required / hint / error / invalid / first / disabled / placeholder / id` | `—` | — | Field props. Say the timezone in the hint. |
| `Keyboard` | `—` | — | ArrowDown opens; arrows, Home and End move, Enter picks, Escape closes. |

React (react-ecosphere):

| Name | Type | Default | Description |
| --- | --- | --- | --- |
| `value / onChange` | `string` | "" | 24-hour HH:mm (defaultValue when uncontrolled). The field shows 09:30 AM and stays typeable; a typed time commits on the native change event (blur or Enter). |
| `open / onOpenChange` | `boolean` | false | Whether the list is open. |
| `step` | `number` | 30 | Minutes between options. |
| `start / end` | `string` | "08:00" / "18:00" | First and last option, HH:mm. Offer the times people actually pick. |
| `hour12` | `boolean` | true | 09:30 AM rather than 09:30. |
| `label / required / hint / error / invalid / first / disabled / placeholder / id` | `—` | — | Field props. Say the timezone in the hint. |
| `Keyboard` | `—` | — | ArrowDown opens; arrows, Home and End move, Enter picks, Escape closes. |
