Documentation
On this page
Install Cirth for Livewire
Livewire renders components on the server and morphs their new HTML into
the existing page. The shared Laravel layout loads the app's global
stylesheet once through @vite, so Cirth comes from the
Laravel guide and Livewire needs nothing more.
Four steps: set up Laravel, load it in the layout Livewire uses, write components and check it.
1 Set up Laravel #
Follow the Laravel guide: Cirth imported in
resources/css/app.css and Vite's CSS target set.
2 Load it in the layout Livewire uses #
The layout a full-page component renders into, and any page that embeds a component, loads the build:
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
@vite(['resources/css/app.css', 'resources/js/app.js'])
</head>
Livewire injects its own small stylesheet and script; they style nothing Cirth does.
3 Write components #
A component renders ordinary elements, and markup it adds on an update is styled on arrival:
<div>
<button type="button" wire:click="increment">Add one</button>
<output>{{ $count }}</output>
@if ($count > 0)
<article><p>Added {{ $count }} times.</p></article>
@endif
</div>
4 Check it #
Put this forced-dark region in a page or component that uses the global stylesheet:
<section data-theme="dark">
<article>
<p>Dark, whatever the system scheme is.</p>
</article>
</section>
Build for production, then open
the page while the system uses a light theme. A dark article proves that
Cirth loaded and that data-theme="dark" is working. It remains dark when
the system switches to a dark theme. If the article follows
the surrounding page instead, the build rewrote Cirth's colours: check the CSS target in the Laravel guide.
Customization covers the --cirth-* properties; set
yours after the @import in resources/css/app.css. Package and builds lists the classless,
scoped and print entry points. Return to Framework guides
for another stack.