Publishing Components
Use theflux:publish command to publish component templates:
Interactive Selection
The default mode allows you to search and select a single component:Multiple Components
Publish multiple components at once:Publish All Components
Publish every component:Publish Specific Components
Skip the prompt by specifying component names:Force Overwrite
By default, the command won’t overwrite existing published components. Use--force to overwrite:
How Publishing Works
The publish command copies component files from the Flux package to your application:Source Locations
The command checks for components in multiple locations:- Single files (e.g.,
separator.blade.php) - Directories with multiple files (e.g.,
button/index.blade.php,button/group.blade.php)
Published Location
All components are published to:Available Components
The components available for publishing depend on your license:Free Components
Pro Components
livewire/flux-pro is installed:
Customization Examples
Example 1: Custom Button Styling
Publish the button component:resources/views/flux/button/index.blade.php:
Example 2: Custom Input Behavior
Publish the input component:resources/views/flux/input/index.blade.php:
Example 3: Custom Modal Sizes
Publish the modal component:resources/views/flux/modal.blade.php:
Component Resolution Priority
Flux checks for components in this order:- Published components in
resources/views/flux/ - Package components in
vendor/livewire/flux/stubs/resources/views/flux/ - Pro package components in
vendor/livewire/flux-pro/stubs/resources/views/flux/
Updating Published Components
When you update Flux, your published components won’t be automatically updated. You have two options:Option 1: Republish with —force
Overwrite your customizations:Option 2: Manual Merge
- Check the Flux changelog for component changes
- Compare your published version with the new package version
- Manually merge the changes
Best Practices
Only Publish What You Need
Publishing all components makes updates harder. Only publish components you actually want to customize:Version Control
Commit published components to version control:Document Changes
Add comments to published components:Test Thoroughly
After customizing:- Test all component variants
- Test in both light and dark modes
- Test Livewire interactions
- Test responsive behavior
Keep Backup
Before using--force, backup your customizations:
Troubleshooting
Component Not Found
If you get “Component not found” errors after publishing:- Clear Blade cache:
php artisan view:clear - Verify file location:
resources/views/flux/[component-name] - Check file naming (must end in
.blade.php)
Changes Not Appearing
If your customizations aren’t showing:- Clear view cache:
php artisan view:clear - Hard refresh browser (Cmd+Shift+R or Ctrl+Shift+R)
- Verify you’re editing the right file
Publish Command Fails
If the command shows warnings:--force to overwrite: