Skip to content

Time Picker

A time picker component for selecting time values only.

Installation

bash
npx @galaxy-stack/nebula-cli@latest add time-picker
bash
pnpm dlx @galaxy-stack/nebula-cli@latest add time-picker
bash
yarn dlx @galaxy-stack/nebula-cli@latest add time-picker
bash
bunx @galaxy-stack/nebula-cli@latest add time-picker
bash
# If you have installed galaxy-design globally
galaxy-design add time-picker

Dependencies

This component automatically installs the following dependencies:

  • React: class-variance-authority
  • Vue: class-variance-authority
  • Angular: class-variance-authority
  • React Native: Not available (use native picker)
  • Flutter: Not available (use built-in TimePicker)

No manual installation needed!

Usage

Basic Example

tsx
import { TimePicker } from "@/components/ui/time-picker"

export default function TimePickerDemo() {
  return <TimePicker placeholder="Pick a time" />
}
vue
<script setup lang="ts">
import { TimePicker } from '@/components/ui/time-picker'
</script>

<template>
  <TimePicker placeholder="Pick a time" />
</template>

12-Hour Format

tsx
import { TimePicker } from "@/components/ui/time-picker"

export default function TimePicker12h() {
  return <TimePicker placeholder="Pick a time" format="12h" />
}
vue
<script setup lang="ts">
import { TimePicker } from '@/components/ui/time-picker'
</script>

<template>
  <TimePicker placeholder="Pick a time" format="12h" />
</template>

API Reference

Props

PropTypeDefaultDescriptionFramework Support
timeDateundefinedSelected timeAll
defaultTimeDateundefinedDefault selected timeAll
placeholderstring'Pick a time'Placeholder textAll
disabledbooleanfalseDisable the pickerAll
format`'12h''24h'`'24h'Time format
className / classstring''CSS class namesAll
clearablebooleantrueShow clear buttonAll

Accessibility

  • Keyboard Navigation: Arrow keys to adjust time, Enter to confirm
  • Screen Reader: Uses proper ARIA labels and live regions
  • Focus Management: Focus trap in dropdown
  • WCAG Compliance: WCAG 2.1 Level AA compliant

Author

Bùi Trọng Hiếu (kevinbui)

License

MIT © 2025 Bùi Trọng Hiếu (kevinbui)

Released under the MIT License.