Installation
composer require themegazord/capyui
Publish the package assets and config:
php artisan vendor:publish --provider="Themegazord\CapyUI\CapyUIServiceProvider" --tag="public"
php artisan vendor:publish --provider="Themegazord\CapyUI\CapyUIServiceProvider" --tag="config"
Basic Blade Integration
Add the CapyUI CSS/JS to your resources/views/layouts/app.blade.php:
@vite(['resources/css/app.css', 'node_modules/@themegazord/capyui/dist/capyui.css'])
@vite(['resources/js/app.js', 'node_modules/@themegazord/capyui/dist/capyui.js'])
First Component Use a pre-built component in a Blade view:
<x-capyui.button type="primary">Click Me</x-capyui.button>
Replace a standard Laravel form with CapyUI components:
<form method="POST" action="/submit">
@csrf
<x-capyui.input type="text" name="username" label="Username" />
<x-capyui.button type="submit">Submit</x-capyui.button>
</form>
Component Hierarchy
<x-capyui.button>, <x-capyui.input>, <x-capyui.card><x-capyui.container>, <x-capyui.grid><x-capyui.spinner>, <x-capyui.tooltip>Slot-Based Customization
<x-capyui.card>
<x-slot name="header">
<h3>Custom Header</h3>
</x-slot>
<p>Default content</p>
</x-capyui.card>
Dynamic Props Pass dynamic props via Blade:
<x-capyui.button
type="{{ $isPrimary ? 'primary' : 'secondary' }}"
disabled="{{ $isLoading }}"
>
{{ $label }}
</x-capyui.button>
Theming
Override default colors via config (config/capyui.php):
'theme' => [
'primary' => '#3b82f6',
'secondary' => '#10b981',
],
Or use CSS variables in your global stylesheet.
Form Integration Combine with Laravel Collective or Livewire:
<x-capyui.input
type="email"
name="email"
:value="old('email', $user->email ?? '')"
error="{{ $errors->first('email') }}"
/>
Dark Mode Support Toggle via JavaScript:
document.querySelector('[data-capyui-theme]').dataset.theme = 'dark';
@themegazord/capyui is included in your build.<x-capyui.button wire:click="save">Save</x-capyui.button>
@testingEnvy to render components in PHPUnit:
$component = Blade::render('<x-capyui.button>Test</x-capyui.button>');
Asset Loading
@themegazord/capyui is in vite.config.js:
resolve: {
alias: {
'@themegazord/capyui': path.resolve(__dirname, 'node_modules/@themegazord/capyui'),
},
},
Prop Conflicts
type).capyui- or use data-* attributes.Blade Caching
php artisan view:clear
'debug' => env('CAPYUI_DEBUG', false),
php artisan capyui:validate to check for misconfigurations.Custom Components
Extend the library by creating new components in resources/views/vendor/capyui:
<!-- resources/views/vendor/capyui/custom-button.blade.php -->
<x-capyui.button :class="{ 'custom-style': $custom }">
{{ $slot }}
</x-capyui.button>
Register in AppServiceProvider:
Blade::component('capyui.custom-button', \Themegazord\CapyUI\Views\CustomButton::class);
Plugin System
Use the CapyUI::extend() method to add functionality:
CapyUI::extend('button', function ($component) {
$component->addProp('icon', 'string');
});
Local Overrides Override default components by publishing and modifying:
php artisan vendor:publish --tag="capyui-views"
config/capyui.php can be overridden via environment variables (e.g., CAPYUI_THEME_PRIMARY).'lazy_load' => true,
Then use data-capyui-lazy on components.// tailwind.config.js
module.exports = {
purge: {
content: [
'./resources/views/**/*.blade.php',
'./node_modules/@themegazord/capyui/dist/**/*.js',
],
},
};
How can I help you explore Laravel packages today?