Menu
class Menu extends BeartropyComponent
Data-driven navigation menu with recursive nesting, section titles, badges, and active state detection.
Items are plain arrays with url+label for links, title for section headings,
and items for nested submenus (recursive). Icons render through the shared
Icon component (Heroicons, Lucide, FontAwesome, or raw SVG/HTML).
Colors are resolved via presets — pass a color name (orange, blue, beartropy)
as a magic attribute or through the $color prop.
Active state is detected via request()->is() using the route key or the URL path.
Links use wire:navigate for Livewire SPA navigation.
Item Shape
// Link
['url' => '/dashboard', 'label' => 'Dashboard', 'icon' => 'home', 'badge' => ['text' => '3', 'class' => '...']]
// Section with nested items
['title' => 'Settings', 'items' => [ ... ]]
Blade Props
View-Only Properties
Traits
Trait HasPresets.
Trait HasErrorBag.
Properties
| string|null | $size | Component size (md, lg, etc.) used for preset resolution. |
from BeartropyComponent |
| string | $iconClass | CSS classes for the icon wrapper (default |
|
| int | $level | Recursion depth (internal, default 0). |
|
| bool | $mobile | Mobile styling flag (adds |
Methods
Compute component presets based on context.
No description
No description
No description
No description
No description
No description
No description
No description
No description
Determine the error state for a specific field.
Analyze wire:model attributes to determine binding state.
Resolve the size preset for the component.
No description
Render an icon name to HTML using the shared Icon component.
No description
Details
in
HasPresets at line 21
array
getComponentPresets(string|null $componentName = null, ComponentAttributeBag|null $attributes = null)
Compute component presets based on context.
in
HasPresets at line 59
protected array
loadPresets(string $componentName)
No description
in
HasPresets at line 73
protected array
loadComponentDefaults(string $componentName)
No description
in
HasPresets at line 88
protected bool
detectHasVariants(array $colors)
No description
in
HasPresets at line 116
protected array
computeSupports(array $sizes, array $colorsArray, array $defaults, array $magicProps)
No description
in
HasPresets at line 137
protected array
resolveSize(array $supports, array $sizes, array $defaults, array $magicProps)
No description
in
HasPresets at line 174
protected array
resolveVariant(array $supports, array $colorsArray, array $componentPresets, array $defaults, array $magicProps, bool $hasVariants)
No description
in
HasPresets at line 223
protected array
resolveColor(array $supports, array $colorsArray, array $componentPresets, array $defaults, array $magicProps, string|null $variant, bool $hasVariants)
No description
in
HasPresets at line 293
protected array
resolveFill(array $supports, array $attributes, array $defaults)
No description
in
HasPresets at line 338
protected string
buildCacheKey(string $component, array $supports, string|null $size, string|null $variant, string|null $color, bool $shouldFill)
No description
in
HasPresets at line 349
protected void
syncInstanceProps(array $supports, string|null $size, string|null $variant, string|null $color)
No description
in
HasPresets at line 365
protected array
buildPresetNames(array $supports, string|null $size, string|null $variant, string|null $color, bool $shouldFill, string $sizeOrigin, string $variantOrigin, string $colorOrigin, string $fillOrigin)
No description
in
HasPresets at line 384
protected void
debugWarnings(array $supports, array $sizePreset, array $colorPreset, string $componentName, string|null $variant, string|null $color)
No description
in
HasErrorBag at line 24
array
getErrorState(ComponentAttributeBag|null $attributes = null, ViewErrorBag|MessageBag|null $errors = null, string|null $error = null)
Determine the error state for a specific field.
Checks both the session error bag and specific error attributes.
Looks up errors by wire:model value or name attribute.
in
BeartropyComponent at line 33
array
getWireModelState(ComponentAttributeBag|null $attributes = null)
Analyze wire:model attributes to determine binding state.
Detects if wire:model is present and if it uses dot notation (e.g., user.name).
in
BeartropyComponent at line 64
array
getSizePreset(string|null $componentName = null, array|ComponentAttributeBag|null $attributes = null, string $defaultSize = 'md')
Resolve the size preset for the component.
Checks:
- Explicit
$this->size. - Magic attributes (e.g.,
<x-button sm />). - Default size.
at line 45
__construct(array $items, string|null $color = null, string $ulClass = 'mt-4 space-y-2 dark:border-slate-800 lg:space-y-4 lg:mt-4 lg:border-slate-200', string $liClass = 'relative')
No description
at line 58
string
renderIcon(string $icon, string $iconClass = 'w-4 h-4 shrink-0')
Render an icon name to HTML using the shared Icon component.
Supports raw HTML (<svg>, <img>, <i>), Heroicon names,
FontAwesome classes, or any set handled by Icon.
at line 73
View
render()
No description