I found out the Title attribute class has to be imported before being able to use them.
use Livewire\Attributes\Title;
My mistake not seeing it in the docs examples. I believed they are autoloaded. Sorry.
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
Hi.
I'm following the Livewire docs and want to set up a page title
using the attribute syntax #[Title('Create Post')] , like the following example.
<?php
namespace App\Livewire;
use Livewire\Component;
use App\Models\User;
#[Title('Users Listing')]
class UsersListing extends Component
{
public function render()
{
$users = User::all();
return view('livewire.users-listing')->with(['users' => $users]);
}
}
But the title doesn't change, and I think the attribute is not applied at all. I'm using Laravel Sail which has installed PHP 8.3. The Livewire library 3.5 is also installed. Is there any config file to edit to enable attributes in Livewire component classes?
Please or to participate in this conversation.