Laravel 8.15.0/Jetstream - How to register new blades x-jet-newblade?
Stefan Bogdanescu
Founder & Senior Architect · 2026-06-29
Laravel Jetstream Components: How to Register New Blade Views like x-jet-newblade
As developers diving into powerful frameworks like Laravel and Jetstream, you often encounter situations where the framework provides excellent scaffolding, but integrating custom logic requires understanding the underlying view registration process. I recently encountered a similar hurdle while working with Laravel 8 and Jetstream components—specifically trying to use or create custom Blade components that don't automatically register themselves upon publishing views.
This post will walk you through the exact mechanism required to properly "register" new Blade views, ensuring your application can correctly resolve components like x-jet-subform without throwing an InvalidArgumentException. We’ll move beyond simply publishing files and look at how Laravel manages view discovery.
The Mystery of the Missing View: Why Registration Matters
When you use a Blade component syntax, such as <x-jet-welcome />, Laravel needs to know where to find the corresponding view file. In modern Laravel applications, especially those utilizing packages like Jetstream, views are often placed within vendor directories (e.g., vendor/jetstream/components/).
The issue you described—receiving an InvalidArgumentException: Unable to locate a class or view for component [jet-subform]—arises because while the physical file exists on the disk (resources/views/vendor/jetstream/components/subform.blade.php), the Blade compiler, by default, doesn't automatically map that file path to the component name used in the view unless explicitly registered within the framework or your application's service container.
Simply running php artisan vendor:publish --tag=jetstream-views is a great first step; it moves the files, but it doesn't necessarily trigger the necessary internal registration hooks for every custom component you define. We need to manually inform Laravel about these new components.
The Solution: Registering Blade Views via Service Providers
The most robust and idiomatic way to register custom view paths or components in a Laravel application is through Service Providers. This allows you to hook into the framework's bootstrapping process and tell it exactly which views are available for use throughout your application.
For Jetstream components, while there might be specific package-level registration methods, understanding the underlying principle—registering assets via a Service Provider—is key to extending functionality cleanly.
Here is a conceptual example of how you might approach registering custom view paths if you were building a standalone component library:
// app/Providers/JetstreamViewServiceProvider.php
namespace App\Providers;
use Illuminate\Support\ServiceProvider;
use Illuminate\Support\Facades\View;
class JetstreamViewServiceProvider extends ServiceProvider
{
/**
* Register any services.
*/
public function register(): void
{
// In a real-world scenario, you might use this to extend view paths.
// For component registration specific to Jetstream, the framework handles much of this internally,
// but understanding Service Providers is fundamental for customization.
$this->app->resolving(View::class, function ($view) {
// Example: Manually adding a path if needed, though often unnecessary with standard package setup.
// $view->addPath('vendor/jetstream/components');
});
}
/**
* Bootstrap any application services.
*/
public function boot(): void
{
// Boot logic here...
}
}
In many complex setups, especially those involving package extensions like Jetstream, the registration happens within the package's own Service Provider. The key takeaway is that view discovery is a deliberate process, not just passive file reading. This principle of explicit registration aligns perfectly with Laravel’s philosophy regarding dependency injection and service location, which you can find discussed extensively on the Laravel Company website.
Best Practices for Component Development
When developing components that need to be utilized across an application:
- Use Service Providers: Always leverage Service Providers to hook into Laravel's lifecycle events (booting) rather than modifying files directly, which prevents conflicts during framework updates.
- Check Package Documentation: Before attempting custom registration, always check the Jetstream or relevant package documentation. They often provide specific methods for extending component functionality that are safer and more integrated than raw view manipulation.
- Keep Views Organized: Ensure your Blade files follow a logical structure. If you are creating entirely new components, consider placing them in dedicated directories within your application (e.g.,
app/View/Components) rather than relying solely on vendor paths for core application views.
Conclusion
The error you faced is a classic example of the difference between static file publishing and dynamic system registration. Simply having the files present isn't enough; the runtime needs explicit instructions to recognize them as usable components. By understanding Service Providers and how Laravel manages view discovery, you gain the power to customize Jetstream and other packages effectively. Mastering this level of framework interaction is what separates basic usage from deep, powerful development, making your applications more flexible and maintainable.