Installation:
composer require orbtui/laravel
Publish the config file (if available):
php artisan vendor:publish --provider="Orbtui\Laravel\OrbtuiServiceProvider"
Basic Usage:
Orbtui\Laravel\Components\OrbtuiComponent.use Orbtui\Laravel\Components\OrbtuiComponent;
class MyComponent extends OrbtuiComponent
{
public function render()
{
return view('livewire.my-component');
}
}
@orbtui directive in Blade views to render UI elements:
@orbtui('button', ['label' => 'Click Me'])
First Use Case:
// In Livewire component
public function mount()
{
$this->ui = [
'primaryButton' => ['type' => 'button', 'label' => 'Submit', 'icon' => 'check'],
];
}
@orbtui('button', $this->ui['primaryButton'])
Dynamic UI Rendering:
@orbtui directive to render reusable UI elements (buttons, cards, modals) with dynamic props:
@orbtui('card', [
'title' => 'User Profile',
'content' => 'Welcome, ' . $user->name,
'actions' => [
['type' => 'button', 'label' => 'Edit', 'onClick' => 'editProfile()'],
],
])
Livewire Integration:
OrbtuiComponent to bind UI states to Livewire properties:
class Dashboard extends OrbtuiComponent
{
public $showModal = false;
public $modalType = 'success';
public function toggleModal()
{
$this->showModal = !$this->showModal;
}
}
@orbtui('modal', [
'visible' => $this->showModal,
'type' => $this->modalType,
'title' => 'Confirmation',
'content' => 'Are you sure?',
])
Theming and Styling:
config/orbtui.php (if published):
'theme' => [
'primaryColor' => '#3b82f6',
'borderRadius' => '0.5rem',
],
Event Handling:
@orbtui('button', [
'label' => 'Delete',
'onClick' => '$emit("deleteItem", { id: 123 })',
])
protected $listeners = ['deleteItem' => 'handleDelete'];
Conditional Rendering:
@if ($user->isAdmin)
@orbtui('button', [
'label' => 'Admin Actions',
'type' => 'danger',
'onClick' => 'showAdminPanel()',
])
@endif
Reusable UI Components:
Create a base component for common UI patterns (e.g., AlertComponent):
class AlertComponent extends OrbtuiComponent
{
public $message;
public $type;
public function render()
{
return view('livewire.alert-component');
}
}
Directive Caching:
@orbtui directives are not cached in Blade views if props change dynamically. Use @verbatim or disable Blade caching during development:
php artisan view:clear
Livewire Reactivity:
@orbtui may not react to Livewire property changes if the directive is static. Use wire:model or $wire events for dynamic updates:
@orbtui('input', [
'type' => 'text',
'value' => $this->inputValue,
'wire:model' => 'inputValue',
])
Configuration Overrides:
config/orbtui.php is missing, default values may not apply. Publish the config first:
php artisan vendor:publish --tag=orbtui-config
JavaScript Conflicts:
// config/app.php
'providers' => [
// ...
Orbtui\Laravel\OrbtuiServiceProvider::class,
],
'aliases' => [
// ...
'Orbtui' => Orbtui\Laravel\Facades\Orbtui::class,
],
Disable auto-registration in OrbtuiServiceProvider if needed.Inspect Props:
Use dd() to debug props passed to @orbtui:
@php dd(['label' => 'Test', 'onClick' => 'alert("Clicked")']) @endphp
@orbtui('button', ['label' => 'Test', 'onClick' => 'alert("Clicked")'])
Check Console: Enable JavaScript console logs for UI events:
window.addEventListener('orbtui:event', (e) => {
console.log('Orbtui Event:', e.detail);
});
Custom Components:
app/Orbtui/Components.OrbtuiServiceProvider:
public function boot()
{
$this->app->make('orbtui')->registerComponent('custom-card', CustomCardComponent::class);
}
Override Views:
php artisan vendor:publish --tag=orbtui-views
resources/views/vendor/orbtui/.Add Icons/Assets:
php artisan vendor:publish --tag=orbtui-assets
public/vendor/orbtui/.How can I help you explore Laravel packages today?