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-menu :items="$items" />
<x-bt-menu blue :items="$items" :mobile="true" />
<x-bt-menu color="emerald" :items="$items" ul-class="space-y-1" />
Menu extends BeartropyComponent (uses HasPresets trait)menu.blade.php — recursive template (calls itself for nested items)presets/menu.php — default orangerenderIcon() method using the shared Icon componentwire:navigate for Livewire SPA navigationrequest()->is()| Prop | PHP Type | Default | Blade Attribute |
|---|---|---|---|
| items | array |
(required) | :items="$items" |
| color | ?string |
null |
color="blue" or magic blue |
| ulClass | string |
'mt-4 space-y-2 ...' |
ul-class="..." |
| liClass | string |
'relative' |
li-class="..." |
| Prop | Type | Default | Description |
|---|---|---|---|
| iconClass | string |
'w-4 h-4 shrink-0' |
CSS for icon wrapper |
| level | int |
0 |
Recursion depth (internal) |
| mobile | bool |
false |
Mobile padding mode |
// Each color in presets/menu.php has 3 keys:
'blue' => [
'title' => 'font-medium text-blue-500 font-display dark:text-blue-400',
'item' => 'transition inline-flex items-center gap-x-2 text-gray-500 dark:text-gray-400 hover:text-blue-500 dark:hover:text-blue-400',
'active' => 'text-blue-500 dark:text-blue-400 font-semibold',
],
Available colors: beartropy, red, blue, green, yellow, purple, pink, gray, orange, amber, lime, emerald, teal, cyan, sky, indigo, violet, rose, fuchsia, slate, stone, zinc, neutral.
// Link (minimal)
['url' => '/path', 'label' => 'Text']
// Link (full)
['url' => '/path', 'label' => 'Text', 'icon' => 'heroicon-o-home', 'route' => 'path/*',
'badge' => ['text' => '5', 'class' => 'bg-red-100 text-red-600 px-1.5 py-0.5 rounded-full']]
// Section with nested items
['title' => 'Section', 'items' => [ ... ]]
ul[role="list"]
├── li
│ ├── h2 (if node.title)
│ ├── <x-bt-menu> (if node.items — recursive, level+1)
│ └── a[wire:navigate] (if node.url + node.label)
│ ├── {!! icon !!} (if node.icon)
│ ├── {{ label }}
│ ├── span.badge (if node.badge)
│ └── span.sr-only "(current)" (if active)
renderIcon() method on the Menu PHP class<svg>, <img>, <i> tags) — passed through as-isheroicon-o-home, home, etc.) — rendered via Icon componentBlade::renderComponent() for Blade icon components$pattern = $node['route'] ?? ltrim(parse_url($node['url'], PHP_URL_PATH), '/');
$isActive = request()->is($pattern ?: '/');
route key for wildcard patterns (e.g., 'admin*')active class, aria-current="page", <span class="sr-only">(current)</span><ul> with $ulClass<ul> with ml-4 border-l border-slate-200 dark:border-slate-700 pl-2mt-2 mb-1mt-1 mb-1 text-xs uppercase tracking-widest opacity-80:color="$color"{{-- Basic with color --}}
<x-bt-menu blue :items="[
['url' => '/home', 'label' => 'Home', 'icon' => 'heroicon-o-home'],
['url' => '/about', 'label' => 'About'],
]" />
{{-- Grouped sections --}}
<x-bt-menu emerald :items="[
['title' => 'General', 'items' => [
['url' => '/overview', 'label' => 'Overview'],
]],
['title' => 'Admin', 'items' => [
['url' => '/users', 'label' => 'Users'],
]],
]" />
{{-- Mobile sidebar --}}
<x-bt-menu beartropy :items="$items" :mobile="true" />
items is required (no default)HasPresets — pass color as magic attribute or color proporange (set in presets file)items arrays create sub-<ul> at level+1, color propagatesIcon component (Heroicons, Lucide, FontAwesome, raw SVG)wire:navigate on all links for Livewire SPA behaviorp-2 to root <ul> only(current) sr-only text is localized via beartropy-ui::ui.currentHow can I help you explore Laravel packages today?