Change layout for component-based Volt?
iambateman opened this issue · comments
Is it possible to change the layout when using a full-page class-based Volt component?
What I need
new class extends Component {
protected string $layout = 'components.layouts.guest';
}
What I tried
I tried just including the function and following it with the class declaration, but it didn't work:
layout('components.layouts.guest');
new class extends Component { ... }
P.S. Volt is really cool, thanks for all your collective work on it!
You need to use Livewire attributes:
new #[Layout('components.layouts.guest')]
class extends Component
{
//
}; ?>
That worked, thank you!
If someone else stumbles across this, the import for Layout
is use Livewire\Attributes\Layout;