You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Volt components do not support namespacing, causing conflicts across modules with same component names #137
In my Laravel project, I follow a modular structure where each module can have its own set of Livewire components. It’s common for different modules to have components with the same name (e.g., Button), and Livewire allows for namespacing to prevent conflicts:
class Button extends Component
{
publicfunctionrender()
{
returnview('somemodule::livewire.button');
}
}
Then in the Blade view, I can use:
<livewire:somemodule::button />
This works perfectly and avoids naming collisions.
However, when using Volt components, the render() method is not defined, and as a result, I cannot specify a view path or namespace. Volt components are always referenced like:
<livewire:button />
If multiple Volt components with the same name exist across different modules, one of them overwrites the others. This makes it impossible to use the same component name in different modules when using Volt.
Steps To Reproduce
Create a Laravel modular project structure.
In ModuleA, create a Volt component named Button.
In ModuleB, create another Volt component also named Button.
Attempt to reference both components in a Blade file (components will not be found):
@ganyicz are you willing to propose your package as a PR? It is a useful feature for those working with a modular approach.
Probably not, Livewire 4 adds native namespace support and Volt is going get sunsetted, I think the package is an okay solution for those who need backwards compatibility
Activity
ganyicz commentedon May 31, 2025
I've made a package that adds support for namespaces, use at your own risk though: https://github.com/ganyicz/volt-namespaces
eliofery commentedon Jun 2, 2025
Thanks for your work. I will test it.
mauritskorse commentedon Jul 8, 2025
Native support for namespacing would be great.
@ganyicz thanks for the work!
robsontenorio commentedon Sep 28, 2025
@ganyicz are you willing to propose your package as a PR? It is a useful feature for those working with a modular approach.
ganyicz commentedon Sep 29, 2025
Probably not, Livewire 4 adds native namespace support and Volt is going get sunsetted, I think the package is an okay solution for those who need backwards compatibility
robsontenorio commentedon Sep 29, 2025
@ganyicz you said “ Volt is going get sunsetted” ??
Where can I see more about this ?
ganyicz commentedon Sep 29, 2025
Single file components are going to be supported by default in Livewire 4.
Check out Caleb's talk from this year's Laracon: https://youtu.be/M60-nxlrePc?si=D-flzeoEqGSiT933