This page demonstrates the unified <x-*> syntax that works with
both LiveComponents (interactive) and HTML Components (static).
LiveComponents are interactive and maintain state. They support actions, real-time updates, and server-sent events.
Simple counter with increment/decrement actions.
<x-counter id="demo-counter" initialValue="0" />
Interactive data table with pagination and sorting.
<x-datatable id="users-table" page="1" pageSize="10" />
Live search with debouncing and results.
<x-search id="main-search" placeholder="Search..." />
LiveComponents automatically convert attribute values to proper types:
page="1" → int: 1enabled="true" → bool: truefilters='["active"]' → array: ["active"]config='{"limit":10}' → object: {limit: 10}HTML Components are stateless and render to static HTML. Perfect for simple UI elements like buttons, badges, and cards.
Styled buttons with variants.
<x-button variant="primary">Primary Button</x-button>
Small status indicators.
<x-badge variant="success">Active</x-badge>
Content containers.
<x-card title="User Profile">...</x-card>
You can combine both types in the same template! The XComponentProcessor automatically detects which type to use.
A typical dashboard widget combining static and interactive components:
Current users online:
<x-card title="User Statistics">
<p>Current users online:</p>
<x-counter id="online-users" initialValue="42" />
<x-button variant="primary">Refresh Stats</x-button>
<x-button variant="secondary">Export Data</x-button>
</x-card>
Clean, Laravel/Tempest-inspired syntax that's familiar to modern developers.
Automatically determines if component is LiveComponent or HTML Component.
Automatic type coercion and prop validation for LiveComponents.
One syntax for both stateful and stateless components.
Helpful error messages in development, graceful failures in production.
Easy to autocomplete and syntax highlight in modern editors.
For complete documentation, see
docs/claude/x-component-syntax.md
| Component Type | Syntax | Use Case |
|---|---|---|
| LiveComponent | <x-name id="..." /> |
Interactive UI (datatables, forms, counters) |
| HTML Component | <x-name>content</x-name> |
Static HTML (buttons, badges, cards) |