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-datetime />
Datetime → extends BeartropyComponentdatetime.blade.php → uses base/input-trigger-base.blade.php (trigger) + base/dropdown-base.blade.php (dropdown)resources/views/presets/datetime.php (calendar + wheel colors per color key)input preset for label/trigger stylingresources/js/modules/datetime-picker.js → registered as Alpine.data('beartropyDatetimepicker', ...)lang/en/ui.php keys: select_date, select_range, clear, change_date, hour, minute_short, now, today, day_mon–day_sun| Prop | PHP Type | Default | Blade Attribute |
|---|---|---|---|
| id | ?string |
auto-generated | id="my-picker" |
| name | ?string |
falls back to id | name="start_date" |
| label | ?string |
null |
label="Date" |
| color | ?string |
null |
color="blue" or magic: blue |
| value | mixed |
null |
value="2024-06-15" |
| min | ?string |
null |
min="2024-01-01" |
| max | ?string |
null |
max="2024-12-31" |
| disabled | bool |
false |
:disabled="true" |
| readonly | bool |
false |
:readonly="true" |
| placeholder | ?string |
null |
placeholder="Pick..." |
| hint | ?string |
null |
hint="Hint text" |
| help | ?string |
null |
help="Help text" |
| customError | mixed |
null |
:custom-error="$error" |
| range | bool |
false |
:range="true" |
| format | string |
'Y-m-d' |
format="Y-m-d" |
| formatDisplay | ?string |
auto | format-display="{d}/{m}/{Y}" |
| showTime | bool |
false |
:show-time="true" |
| clearable | bool |
true |
:clearable="false" |
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.
beartropyDatetimepicker(cfg){
value, // initial value or [@entangle](https://github.com/entangle) for Livewire
range, // bool
min, // "YYYY-MM-DD" or ""
max, // "YYYY-MM-DD" or ""
formatDisplay, // "{d}/{m}/{Y}" JS format string
showTime, // bool
disabled, // bool
i18n: { now, today, changeDate },
}
value — the stored date/datetime string or range object { start, end }open — dropdown visibilitystart, end — normalized date strings (YYYY-MM-DD)startHour, startMinute, endHour, endMinute — padded strings ("00"-"23", "00"-"59")startTimeSet, endTimeSet — whether time has been explicitly setpanel — current UI panel: 'date-start', 'date-end', 'time-start', 'time-end'month, year — current calendar viewdays — array of day objects { label, date, inMonth }hovered — date string hovered during range selectiondisplayLabel — formatted text shown in the triggerupdateCalendar() — rebuild days array for current month/yearselectDay(day) — handle day click (single/range/time flow)prevMonth(), nextMonth() — navigate monthsisDisabled(day) — check min/max/inMonthisSelected(day) — check if day is start or endisInRange(day) — check if day is between start and end (range mode)isToday(day) — check if day is today's dategoToToday() — scroll calendar to current monthshowCalendarPane() — returns true when calendar grid should be visiblecurrentTimeType() — returns 'start' or 'end' based on panelisPickingStartTime() — returns true when panel is 'time-start'isPickingEndTime() — returns true when panel is 'time-end'getHourForType(type), getMinuteForType(type) — get current valuegetAdjacentHour(type, offset), getAdjacentMinute(type, offset) — get prev/next values for wheelmoveHour(type, direction), moveMinute(type, direction) — step ±1, wrap aroundwheelHour(type, event), wheelMinute(type, event) — mouse wheel handlerssetTimeNow(type) — set current time + auto-advancesetTime(type, h, m, autoAdvance) — set time + optionally advance panel/closesetFromValue() — parse value into internal state (start/end/hours/minutes)updateDisplay() — rebuild displayLabel from current statenormalizeDate(str) — parse various date formats to YYYY-MM-DDformatForDisplay(dateStr, format, hour, minute) — format date for trigger displayclearSelection() — reset all stateonDropdownClose() — commit value on closesetInitialPanel() — determine starting panel based on state ← 2024-06 → ← month navigation
Mon Tue Wed Thu Fri Sat Sun ← weekday headers
1 2 ← day grid (out-of-month = disabled)
3 4 5 6 7 8 9
10 11 [12] 13 14 15 16 ← selected day highlighted
17 18 19 20 21 22 23
24 25 26 27 28 29 30
Today ← scroll-to-today button
2024-06-12 Change date ← header with current date
HOUR : MIN ← column labels
09 28 ← adjacent (gray, clickable)
[10] : [29] ← selected (accent color, highlight bg)
11 30 ← adjacent (gray, clickable)
Now ← quick-set button
'colors' => [
'beartropy' => [
// Shared (same across all colors)
'dropdown_bg' => 'bg-white dark:bg-gray-900',
'dropdown_shadow' => 'shadow-xl',
'header_text' => 'text-lg font-semibold ...',
'weekday_text' => 'text-neutral-500 ...',
'grid_bg' => 'bg-transparent',
'option_text' => 'text-neutral-800 ...',
'trigger_text' => 'text-neutral-800 ...',
'placeholder_text' => 'text-neutral-400 ...',
'column_label' => 'text-[11px] font-semibold uppercase ...',
'wheel_adjacent' => 'text-gray-300 dark:text-gray-600 hover:...',
// Color-specific
'dropdown_border' => 'border border-gray-300 dark:border-gray-600',
'option_hover' => 'hover:bg-beartropy-50 ...',
'option_active' => 'font-bold bg-beartropy-100 ...',
'option_selected' => 'bg-beartropy-200 ...',
'option_range' => 'bg-beartropy-100 dark:bg-beartropy-800/50',
'today_ring' => 'ring-2 ring-beartropy-400 dark:ring-beartropy-500',
'select' => 'bg-white ... focus:ring-2 focus:ring-beartropy-500 ...',
'wheel_selected' => 'text-beartropy-600 dark:text-beartropy-400',
'wheel_highlight' => 'bg-beartropy-50 dark:bg-beartropy-950/30',
'now_button' => 'text-xs ... text-beartropy-500 ...',
],
]
dropdown_border — border classesdropdown_bg — backgrounddropdown_shadow — shadowheader_text — month/year headerweekday_text — day-of-week rowgrid_bg — calendar grid backgroundoption_text — day text coloroption_hover — day hover stateoption_active — selected day highlightoption_range — range highlighttoday_ring — today's date ringcolumn_label — "HOUR", "MIN" labelswheel_selected — text color for selected time valuewheel_highlight — background of highlight bandwheel_adjacent — text color for prev/next time valuesnow_button — "Now" / "Today" button styles$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-datetime label="Date" wire:model="date" />
<x-bt-datetime label="Appointment" :show-time="true" wire:model="appointment" />
<x-bt-datetime label="Trip" :range="true" wire:model="tripDates" />
<x-bt-datetime label="Booking" :range="true" :show-time="true" wire:model="booking" />
<x-bt-datetime label="This Year" min="2024-01-01" max="2024-12-31" wire:model="date" />
<x-bt-datetime label="Date" value="2024-06-15" name="event_date" />
<x-bt-datetime label="Date" emerald custom-error="Invalid date" wire:model="date" />
// config/beartropyui.php
'component_defaults' => [
'datetime' => [
'color' => env('BEARTROPY_UI_DATETIME_COLOR', 'beartropy'),
],
],
id auto-generates via 'beartropy-datetime-' . uniqid() when not providedname falls back to id when not providedprimary is an alias for beartropy in the presetx-bt-time-picker for visual consistencyinput-trigger-base for the trigger and dropdown-base for the dropdown__('beartropy-ui::ui.day_mon') through __('beartropy-ui::ui.day_sun')dropdown-base (NOT the root div — the dropdown teleports to <body>, so a root-level [@click](https://github.com/click).outside would close the dropdown on every internal click)<button type="button"> (not bare <span>)if (!disabled) guards on click handlerswire:model is present ([@unless](https://github.com/unless)($hasWireModel))How can I help you explore Laravel packages today?