beartropy/ui
Beartropy UI is a small Laravel UI package providing ready-made components and helpers to speed up building admin and front-end screens. Drop in common layouts, forms, and UI utilities to get a consistent look fast with minimal setup.
<x-bt-time-picker />
TimePicker → extends BeartropyComponenttime-picker.blade.php → uses base/input-trigger-base.blade.php (trigger) + base/dropdown-base.blade.php (dropdown)resources/views/presets/time-picker.php (wheel colors per color key)input preset for label/trigger stylingresources/js/modules/time-picker.js → registered as Alpine.data('beartropyTimepicker', ...)lang/en/ui.php keys: hour, minute_short, second_short, select_time, now, clear| Prop | PHP Type | Default | Blade Attribute |
|---|---|---|---|
| id | ?string |
auto-generated | id="my-picker" |
| name | ?string |
falls back to id | name="start_time" |
| label | ?string |
null |
label="Time" |
| color | ?string |
null |
color="blue" or magic: blue |
| value | mixed |
null |
value="14:30" |
| min | ?string |
null |
min="08:00" |
| max | ?string |
null |
max="17:30" |
| interval | int |
1 |
:interval="15" |
| format | string |
'H:i' |
format="h:i A" |
| seconds | bool |
false |
:seconds="true" |
| disabled | bool |
false |
:disabled="true" |
| readonly | bool |
false |
:readonly="true" |
| placeholder | ?string |
null |
placeholder="Pick..." |
| clearable | bool |
true |
:clearable="false" |
| customError | mixed |
null |
:custom-error="$error" |
| help | ?string |
null |
help="Help text" |
| hint | ?string |
null |
hint="Hint text" |
beartropy via config)primary, beartropy, red, blue, green, yellow, purple, pink, gray, orange, amber, lime, emerald, teal, cyan, sky, indigo, violet, rose, fuchsia, slate, stone, zinc, neutral
md)xs, sm, md, lg, xl
fill — applies tinted background to trigger. outline — default border-only mode.
12-hour mode is auto-detected from the format prop via regex /[hgGA]/:
H:i → 24h (default)h:i A → 12h with AM/PM buttonsh, g, G, or A → 12hRegardless of display format, the stored value is always 24-hour: HH:mm or HH:mm:ss.
beartropyTimepicker(cfg){
value, // initial value or [@entangle](https://github.com/entangle) for Livewire
is12h, // bool — derived from format
showSeconds, // bool — $seconds prop
min, // "HH:mm" or null
max, // "HH:mm" or null
interval, // int — minute step
disabled, // bool
i18n: { now }, // translated strings
}
value — the stored time string (HH:mm or HH:mm:ss, 24h always)open — dropdown visibilityhour, minute, second — padded strings ("00"-"23", "00"-"59")period — 'AM' or 'PM' (only meaningful in 12h mode)displayLabel — formatted text shown in the triggerselectHour(h), selectMinute(m), selectSecond(s) — set value + updatetogglePeriod(p) — switch AM/PMmoveHour(dir), moveMinute(dir), moveSecond(dir) — step ±1, skip disabled, wrapgetAdjacentHour(offset), getAdjacentMinute(offset), getAdjacentSecond(offset) — get prev/next values for wheel displaywheelHour(event), wheelMinute(event), wheelSecond(event) — mouse wheel handlersisHourDisabled(h), isMinuteDisabled(m) — min/max range enforcementgetHours(), getMinutes(), getSeconds() — generate value arraysclear() — null everything, close dropdownsetNow() — current time rounded to interval_to24h(h, period) — 12h → 24h conversionThe dropdown uses a wheel-style selector showing 3 values per column (previous, selected, next):
HOUR : MIN ← column labels
11 28 ← adjacent (gray, clickable)
[12] : [29] ← selected (accent color, highlight bg)
13 30 ← adjacent (gray, clickable)
Now ← quick-set button
With seconds + 12h:
HOUR : MIN : SEC AM
11 28 44 PM
[12] : [29] : [45]
13 30 46
Now
[@wheel](https://github.com/wheel).prevent on each column'colors' => [
'beartropy' => [
// Shared (same across all colors)
'dropdown_bg' => 'bg-white dark:bg-gray-900',
'dropdown_shadow' => 'shadow-xl',
'option_text' => 'text-gray-800 dark:text-gray-100',
'column_label' => 'text-[11px] font-semibold uppercase ...',
'wheel_adjacent' => 'text-gray-300 dark:text-gray-600 hover:...',
'ampm_button' => 'px-3 py-1.5 rounded-lg text-xs font-bold ...',
// Color-specific
'dropdown_border' => 'border border-gray-200 dark:border-gray-700',
'wheel_selected' => 'text-beartropy-600 dark:text-beartropy-400',
'wheel_highlight' => 'bg-beartropy-50 dark:bg-beartropy-950/30',
'ampm_active' => 'bg-beartropy-500 text-white shadow-sm',
'now_button' => 'text-xs ... text-beartropy-500 ...',
],
]
dropdown_border — border classesdropdown_bg — backgrounddropdown_shadow — shadowcolumn_label — "HOUR", "MIN", "SEC" labelswheel_selected — text color for center (selected) valuewheel_highlight — background of highlight band behind selected valuewheel_adjacent — text color for prev/next valuesampm_button — base AM/PM button stylesampm_active — active AM/PM button colornow_button — "Now" button stylesoption_text — trigger display text color$errors bag using wire:model name:custom-error="$message" propinput presetWhen no wire:model is present, a hidden <input> is rendered for form submission:
<input type="hidden" name="..." :value="value">
<x-bt-time-picker label="Time" wire:model="time" />
<x-bt-time-picker label="Time" format="h:i A" wire:model="time" />
<x-bt-time-picker label="Slot" :interval="15" min="09:00" max="17:00" wire:model="slot" />
<x-bt-time-picker label="Precise" :seconds="true" format="h:i A" wire:model="time" />
<x-bt-time-picker label="Start" value="14:30" name="start_time" />
<x-bt-time-picker label="Check-in" emerald custom-error="Invalid time" wire:model="checkin" />
// config/beartropyui.php
'component_defaults' => [
'time-picker' => [
'color' => env('BEARTROPY_UI_TIME_PICKER_COLOR', 'beartropy'),
],
],
id auto-generates via 'beartropy-timepicker-' . uniqid() when not providedname falls back to id when not providedformat propprimary is an alias for beartropy in the presetinput-trigger-base for the trigger and dropdown-base for the dropdown, inheriting their sizing/styling__('beartropy-ui::ui.hour'), __('beartropy-ui::ui.minute_short'), __('beartropy-ui::ui.second_short')How can I help you explore Laravel packages today?