Laravel Components
TailAdmin Laravel offers a curated set of customizable, accessible UI components designed to accelerate dashboard development. Built with Laravel 12, Blade components, Alpine.js and Tailwind CSS v4, each component combines clean design with robust accessibility.
UI Primitives & Accessibility
TailAdmin Laravel keeps its UI primitives in resources/views/components/ui/ as anonymous Blade components, used as <x-ui.button>, <x-ui.dropdown-menu>, <x-ui.field> and so on. Interactive primitives get their behaviour from small Alpine.js modules in resources/js/ui/ (for example dropdown.js, dialog.js, select.js, tabs.js), with Floating UI positioning popups.
This keeps accessibility handled in one place across your application:
- WAI-ARIA Compliance: Primitives render the right roles and attributes (
role="menu",role="menuitem",aria-expanded,aria-haspopup,role="alert"on field errors). - Keyboard Navigation & Focus Management: Alpine modules handle keyboard interactions, such as arrow keys in menus, Escape to dismiss, and focus handling in dialogs.
- Headless Flexibility: Behaviour is separate from styling, and all styling is Tailwind CSS v4 classes, merged with the
TwMergehelper so your own classes win. - State-driven Attributes: Primitives expose declarative data attributes (
data-slot,data-state,data-open,data-highlighted,data-disabled) for seamless animation and styling.
Usage Instructions
Blade resolves primitives automatically, so there is nothing to import. Use the <x-ui.*> tag in any view. Parts of a compound primitive use dotted names, such as <x-ui.dropdown-menu.item>.
Static Component
For static elements without internal state (such as Buttons, Badges, or Avatars), use the primitive and pass your desired variant, size, or Tailwind classes:
<div class="flex flex-wrap items-center gap-3">
<x-ui.button variant="default" size="sm">Primary Action</x-ui.button>
<x-ui.button variant="outline" size="sm">Secondary Outline</x-ui.button>
<x-ui.button variant="ghost" size="sm">Ghost</x-ui.button>
<x-ui.button variant="destructive" size="sm">Delete</x-ui.button>
</div>x-ui.button supports the variants default, outline-solid, ghost, destructive and link, the sizes default, xs, sm, lg, icon, icon-xs, icon-sm and icon-lg, an as prop to render another tag (such as a), and asChild to apply the button styles to the first element of the slot. Extra attributes and classes are merged.
Interactive Components
Interactive elements (such as Dropdowns, Dialogs, Popovers, Tabs, and Selects) are compound Blade components. The root holds the Alpine state, and the parts coordinate state and accessibility attributes automatically.
Dropdown Menu
The dropdown primitive is driven by resources/js/ui/dropdown.js, which manages trigger interactions, keyboard navigation, and popup positioning. Use asChild on the trigger to apply the trigger behaviour to your own button.
<x-ui.dropdown-menu>
<x-ui.dropdown-menu.trigger asChild>
<x-ui.button size="sm" variant="outline">Account Menu</x-ui.button>
</x-ui.dropdown-menu.trigger>
<x-ui.dropdown-menu.content align="start">
<x-ui.dropdown-menu.item>Edit Profile</x-ui.dropdown-menu.item>
<x-ui.dropdown-menu.item>Account Settings</x-ui.dropdown-menu.item>
<x-ui.dropdown-menu.item>Support</x-ui.dropdown-menu.item>
<x-ui.dropdown-menu.separator />
<x-ui.dropdown-menu.item variant="destructive">Sign Out</x-ui.dropdown-menu.item>
</x-ui.dropdown-menu.content>
</x-ui.dropdown-menu>Pass to="/some/url" to an item to render it as a link.
Creating & Extending UI Primitives
When creating or extending a UI primitive in resources/views/components/ui/:
- Create a Blade Component: Add a
.blade.phpfile (or a folder withindex.blade.phpfor compound primitives) and declare its props with@props. - Move Behaviour to Alpine: Put client-side behaviour in a module under
resources/js/ui/and register it inresources/js/ui/index.js, then attach it withx-dataon the root. - Define Variants in PHP: Keep variant and size classes in a helper class under
app/Support/Ui/(seeButtonVariants), using Tailwind CSS v4 tokens. - Attach
data-slot: Set a descriptivedata-slotattribute on each rendered element to support styling hooks and parent targeting. - Merge Classes: Pass the base classes and
$attributes->get('class')throughTwMerge::merge()so consumer classes override the defaults. - Check Accessibility: Render the correct
role,aria-*attributes and keyboard handlers for the pattern you are building.
Forms & Validation
TailAdmin Laravel validates forms in the browser with a small, dependency-free helper, createFormValidation (resources/js/components/forms/form-validation.js), exposed to Alpine. It follows the “validate on touch” pattern: a field’s error appears after the field is blurred or the form is submitted, and is re-validated on every change. Accessible form controls are constructed with the compound x-ui.field primitives (x-ui.field, x-ui.field.label, x-ui.field.error, x-ui.field.description). The server still validates as usual, and its errors can be passed back into the form.
Schema Definition
Write a validate function that receives the form values and returns an object of error messages keyed by field name:
import { createFormValidation, isEmail } from "./form-validation";
const validateLogin = (data) => {
const errors = {};
if (!data.email.trim()) errors.email = "Email address is required";
else if (!isEmail(data.email.trim()))
errors.email = "Please enter a valid email address";
if (data.password.length < 6)
errors.password = "Password must be at least 6 characters";
return errors;
};
// Register it with Alpine, for example in resources/js/components/forms/index.js
Alpine.data("loginForm", (defaults = {}) =>
createFormValidation({ email: "", password: "", ...defaults }, validateLogin),
);Form Component Implementation
Attach the factory with x-data, bind inputs with x-model, and wrap each one in x-ui.field:
<form method="POST" action="{{ route('login.store') }}" novalidate
x-data="loginForm()"
x-on:submit.prevent="handleSubmit(() => $el.submit())">
@csrf
<x-ui.field x-bind:data-invalid="Boolean(errorOf('email'))">
<x-ui.field.label for="email">Email</x-ui.field.label>
<x-ui.input
id="email"
name="email"
type="email"
placeholder="[email protected]"
x-model="values.email"
x-bind:aria-invalid="errorOf('email') ? 'true' : null"
x-on:blur="touch('email')"
/>
<x-ui.field.error x-show="errorOf('email')" style="display: none;" x-text="errorOf('email')" />
</x-ui.field>
<x-ui.field x-bind:data-invalid="Boolean(errorOf('password'))">
<x-ui.field.label for="password">Password</x-ui.field.label>
<x-ui.input
id="password"
name="password"
type="password"
placeholder="Enter password"
x-model="values.password"
x-bind:aria-invalid="errorOf('password') ? 'true' : null"
x-on:blur="touch('password')"
/>
<x-ui.field.error x-show="errorOf('password')" style="display: none;" x-text="errorOf('password')" />
</x-ui.field>
<x-ui.button type="submit" class="w-full" x-bind:disabled="isSubmitting">
<span x-text="isSubmitting ? 'Signing in...' : 'Sign In'">Sign In</span>
</x-ui.button>
</form>- Field Association:
x-ui.field.labellinks to its input through theforattribute, so give the input a matchingid. - Validation State: Setting
data-invalidonx-ui.fieldandaria-invalidon the input triggers Tailwind error styling and ensures accessible feedback. - Accessible Errors:
x-ui.field.errorrenders withrole="alert"for screen reader announcements. Hide it withx-showuntil there is a message. - Other helpers: the helper also provides
reset(), which clears the values and touched state. The sign-in, sign-up and reset-password forms inresources/js/components/forms/auth.jsare complete examples.
Tables
TailAdmin Laravel uses semantic HTML tables styled with Tailwind CSS classes. It also ships with Tanstack Table (@tanstack/table-core) for building complex and interactive tables.
Basic Table
Create a basic table by rendering rows from your data with Blade:
<table class="min-w-full">
<thead class="border-b border-gray-100 dark:border-white/5">
<tr>
<th class="px-5 py-3 text-start text-xs font-medium text-gray-500 dark:text-gray-400">User</th>
<th class="px-5 py-3 text-start text-xs font-medium text-gray-500 dark:text-gray-400">Role</th>
<th class="px-5 py-3 text-start text-xs font-medium text-gray-500 dark:text-gray-400">Status</th>
</tr>
</thead>
<tbody class="divide-y divide-gray-100 dark:divide-white/5">
@foreach ($users as $user)
<tr>
<td class="px-5 py-4 text-sm font-medium text-gray-800 dark:text-white/90">{{ $user['name'] }}</td>
<td class="px-5 py-4 text-sm text-gray-500 dark:text-gray-400">{{ $user['role'] }}</td>
<td class="px-5 py-4 text-sm text-gray-500 dark:text-gray-400">{{ $user['status'] }}</td>
</tr>
@endforeach
</tbody>
</table>Advance Data Table
For advanced features such as sorting, global search filtering, and pagination, combine the table markup with @tanstack/table-core. Check Tanstack Table documentation here for more details.
Laravel has no framework adapter, so TailAdmin wraps the framework-neutral core in one shared Alpine factory, resources/js/components/table/create-table.js. The factory keeps the table instance outside Alpine’s reactive proxy (the proxy breaks TanStack’s internals) and exposes plain values and methods to the template: rows, searchQuery, isSorted(), toggleSorting(), pageIndex, totalPages, goPage() and more.
Each table has a small definition file in resources/js/components/tables/. Register only the features and functions you use with tableFeatures, and define the columns with createColumnHelper:
// resources/js/components/tables/users-table.js
import {
columnFilteringFeature,
createColumnHelper,
createFilteredRowModel,
createPaginatedRowModel,
createSortedRowModel,
globalFilteringFeature,
rowPaginationFeature,
rowSortingFeature,
sortFn_alphanumeric,
tableFeatures,
} from "@tanstack/table-core";
import { storeReactivityBindings } from "@tanstack/table-core/store-reactivity-bindings";
const features = tableFeatures({
coreReactivityFeature: storeReactivityBindings(),
columnFilteringFeature,
globalFilteringFeature,
rowSortingFeature,
rowPaginationFeature,
filteredRowModel: createFilteredRowModel(),
sortedRowModel: createSortedRowModel(),
paginatedRowModel: createPaginatedRowModel(),
sortFns: { alphanumeric: sortFn_alphanumeric },
});
const columnHelper = createColumnHelper();
export default {
features,
columns: columnHelper.columns([
columnHelper.accessor("name", { id: "name", header: "Name", sortFn: "alphanumeric" }),
columnHelper.accessor("role", { id: "role", header: "Role", sortFn: "alphanumeric" }),
]),
};Register the definition in resources/js/components/table/index.js, then attach it in Blade with x-data="tanstackTable(...)", passing the server-rendered rows:
// resources/js/components/table/index.js
import usersTable from "../tables/users-table";
const definitions = {
// ...existing tables
"users-table": usersTable,
};@use('Illuminate\Support\Js')
<div x-data="tanstackTable('users-table', {{ Js::from(['rows' => $users]) }})">
<input type="search" x-model="searchQuery" placeholder="Search..." />
<table class="min-w-full">
<thead>
<tr>
<th>
<button type="button" @click="toggleSorting('name')">Name</button>
</th>
<th>Role</th>
</tr>
</thead>
<tbody>
<template x-for="row in rows" :key="row.id">
<tr>
<td x-text="row.name"></td>
<td x-text="row.role"></td>
</tr>
</template>
</tbody>
</table>
</div>Complete working examples (Data Tables One, Two and Three, the product list, invoice list and ticket list) are in resources/views/components/main/tables/ and the feature folders under resources/views/components/main/.