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-modal id="my-modal">Content</x-bt-modal>
Modal → extends BeartropyComponentmodal.blade.php → includes partials/modal-root.blade.phpwire:model bidirectional syncresources/js/modules/modal.js (openModal/closeModal helpers that lowercase IDs)| Prop | PHP Type | Default | Blade Attribute |
|---|---|---|---|
| id | ?string |
null |
id="my-modal" |
| maxWidth | string |
'3xl' |
maxWidth="lg" |
| zIndex | string |
'30' |
zIndex="50" |
| blur | string |
'none' |
blur="lg" |
| bgColor | string |
'bg-white dark:bg-gray-900' |
bgColor="bg-gray-800" |
| closeOnClickOutside | bool |
true |
:closeOnClickOutside="false" |
| styled | bool |
false |
:styled="true" |
| showCloseButton | bool |
true |
:showCloseButton="false" |
| centered | bool |
false |
:centered="true" |
| teleport | bool |
true |
:teleport="false" |
| teleportTarget | string |
'body' |
teleportTarget="#app" |
| Slot | Description |
|---|---|
| default | Modal body content |
| title | Title (styled mode: text-xl font-semibold border-b) |
| footer | Footer (styled mode: flex justify-end items-center border-t) |
sm → max-w-sm, md → max-w-md, lg → max-w-lg, xl → max-w-xl, 2xl → max-w-2xl, 3xl → max-w-3xl, 4xl → max-w-4xl, 5xl → max-w-5xl, 6xl → max-w-6xl, 7xl → max-w-7xl, full → max-w-full
none → backdrop-blur-none, sm → backdrop-blur-sm, md → backdrop-blur-md, lg → backdrop-blur-lg, xl → backdrop-blur-xl, 2xl → backdrop-blur-2xl, 3xl → backdrop-blur-3xl
open-modal-{id} — dispatched on window to openclose-modal-{id} — dispatched on window to closex-on:keydown.escape.window)wire:model value (if present)id prop (if provided)modal-{uniqid()}$watch from Livewire → Alpine on initclose() and openModal() call $wire.set() to sync backwire:model attribute is excluded from root element via whereDoesntStartWithShows when $styled || $showCloseButton. Hidden only when both are false.
[@click](https://github.com/click)="close()" on overlay div only when $closeOnClickOutside is true.
items-start + mt-24 sm:mt-32 (top-aligned with margin)items-center (no margin)p-6text-xl font-semibold border-b border-gray-200 dark:border-gray-700 pb-3 text-gray-800 dark:text-gray-200my-4 text-gray-800 dark:text-gray-200flex justify-end items-center border-t border-gray-200 dark:border-gray-700 pt-3openModal(id) // lowercases id, dispatches open-modal-{id}
closeModal(id) // lowercases id, dispatches close-modal-{id}
Important: JS helpers lowercase the ID before dispatching. Use lowercase IDs to avoid mismatches with Blade-rendered event listeners.
{{-- Basic with Alpine event trigger --}}
<x-bt-button [@click](https://github.com/click)="$dispatch('open-modal-confirm')">Open</x-bt-button>
<x-bt-modal id="confirm">Are you sure?</x-bt-modal>
{{-- Livewire sync --}}
<x-bt-modal wire:model="showModal">Livewire-controlled modal</x-bt-modal>
{{-- Styled with title and footer --}}
<x-bt-modal :styled="true" id="settings">
<x-slot:title>Settings</x-slot:title>
Form content here.
<x-slot:footer>
<x-bt-button [@click](https://github.com/click)="$dispatch('close-modal-settings')">Cancel</x-bt-button>
<x-bt-button solid blue>Save</x-bt-button>
</x-slot:footer>
</x-bt-modal>
{{-- Persistent (no outside click, no close button, no escape) --}}
<x-bt-modal :closeOnClickOutside="false" :showCloseButton="false" id="processing">
<x-bt-icon name="arrow-path" class="w-6 h-6 animate-spin" /> Processing...
</x-bt-modal>
{{-- Centered, blurred, custom size --}}
<x-bt-modal :centered="true" blur="lg" maxWidth="xl" id="alert">
Important message
</x-bt-modal>
{{-- No teleport --}}
<x-bt-modal :teleport="false" id="inline">Inline modal</x-bt-modal>
{{-- Custom background --}}
<x-bt-modal bgColor="bg-gray-800 text-white" id="dark">Dark modal</x-bt-modal>
${'close-on-click-outside'} in Blade supports kebab-case attribute alternativebody to avoid z-index stacking issuesx-cloak hides modal until Alpine initializesx-effect toggles overflow-hidden on <html> when modal is openmax-h-[80vh] overflow-y-auto for long contentHow can I help you explore Laravel packages today?