Customization
WireKit offers 4 levels of customization. Use the lightest level that solves your need.
Customization vs. Theming vs. Design Tokens.
Themingis the setup guide + theme-preset gallery — how to wire tokens into yourapp.css, the theme presets (Default, Minimal, Soft, Material, Brutalist, Retro Terminal, Cupertino, Aurora), and the accessibility guarantees.Design Tokensis the complete variable reference — every--color-wk-*/--radius-wk-*/--shadow-wk-*plus the reading-* component family and chart palette. Customization (this page) is the decision tree — when to override tokens vs. tweak PHP defaults vs. apply scope-based personalization vs. publish the view.
Level 1: CSS Variables
Change colors and radii without touching PHP. See Theming for the full setup walkthrough and Design Tokens for the complete variable reference.
/* In your app.css, after @import 'tailwindcss'; */
:root {
--color-wk-accent: var(--color-blue-600);
--radius-wk-md: 0.75rem;
}
.dark {
--color-wk-accent: var(--color-blue-400);
}
Use this level when: every component should pick up the same change (e.g. brand accent color, global border radius). The override cascades on top of the separately-loaded wirekit.css. No @layer base wrapper is needed — the --color-wk-* tokens are plain CSS custom properties, not Tailwind theme tokens.
Using WireKit tokens in your own Tailwind classes
You can reference any --*-wk-* token inside a Tailwind v4 arbitrary-value utility — but Tailwind needs a type hint so it compiles the value:
- Color:
text-[color:var(--color-wk-text-muted)],bg-[color:var(--color-wk-bg-subtle)] - Length (font size, ring width):
text-[length:var(--text-wk-sm)] - Spacing / radius (untyped):
p-[var(--padding-wk-x-lg)],rounded-[var(--radius-wk-md)]
Omit the color: / length: hint and Tailwind v4 mis-types the arbitrary value and silently drops the class. And because Tailwind only generates classes it has scanned, a newly-authored arbitrary-value class appears only after the dev server re-scans — restart npm run dev (or run a one-shot npm run build) after adding one. When a WireKit component already carries the token, prefer the component over a hand-written token class.
Hiding or placing a component with your own classes
A class written on a component's tag lands on the element that takes your attributes, usually its root. When it sets a display without a breakpoint in front, hidden, block, flex, inline-flex or another display keyword, that display takes the place of the component's own, so the usual responsive pattern works on any component:
{{-- 1. Hidden on a phone, shown as a button from the md breakpoint up. --}}
<x-wirekit::button class="hidden md:inline-flex">Export</x-wirekit::button>
{{-- 2. Shown on a phone, hidden from md up. A display under a breakpoint
alone leaves the component's own display in place. --}}
<x-wirekit::badge class="md:hidden">New</x-wirekit::badge>
Name the display you want back at the breakpoint. Once your class sets one, the component adds none of its own, so a button given hidden md:block shows from md up without the flex layout that lines up its icon and its label. The display a component ships with is the one on its root element in the browser's inspector.
A position works the same way. absolute, fixed, relative, sticky or static in your class takes the place of the component's own, so a component can be placed against a positioned box of yours:
{{-- 1. The box the tooltip is placed against. --}}
<div class="relative">
<pre>composer require pushery/wirekit</pre>
{{-- 2. The tooltip's own position gives way to absolute,
so it sits in the box's top right corner. --}}
<x-wirekit::tooltip text="Copy the command" class="absolute top-2 end-2">
<x-wirekit::clipboard-button value="composer require pushery/wirekit" icon-only />
</x-wirekit::tooltip>
</div>
Spacing, size and type from your own classes
Spacing, size, type and alignment work the same way. A padding, a margin or a gap, a width or a height with their minimum and maximum, a font size or a font weight, a text alignment, justify-*, items-* or self-*, a flex direction or a whitespace-* in your class takes the place of the component's own of the same kind:
A side or an axis replaces only what it covers: px-0 takes the component's inline padding and leaves its block padding, and p-0 takes both. A value under a breakpoint, such as md:p-0, applies from that breakpoint up and leaves the component's own in place below it. Overflow, the layer (z-*) and the border width stay with the component, since each is something it needs to work; its props and its tokens set them.
Level 2: PHP Defaults
Set project-wide defaults for every component — no view publishing needed.
In your App:
use Pushery\WireKit\WireKit;
WireKit::defaults([
'button' => ['intent' => 'neutral', 'surface' => 'outline', 'size' => 'lg'],
'input' => ['size' => 'lg'],
'dropdown' => ['placement' => 'bottom-end', 'offset' => 4],
'modal' => ['size' => 'lg', 'dismissible' => true],
'drawer' => ['position' => 'left', 'size' => 'md'],
'tooltip' => ['placement' => 'bottom', 'delay-show' => 500],
]);
WireKit:: writes each key into the configuration under components.<component>.<prop>, and a component takes a default from there only for the props it reads from the configuration. Any other key changes nothing: a prop whose default is written into the component, and a name the component does not have. button is the trap worth naming: it reads intent, surface and size, never variant.
In development and on the console, WireKit logs a warning for each such key, naming the key and what the component does read, so a key that cannot work does not pass in silence. It is written to your log channel, not to the page, and it is skipped in production. A key written straight into config/ is not checked.
Reading back what you set. WireKit:: returns the array registered for
one component, and an empty array when nothing was registered for it:
use Pushery\WireKit\WireKit;
// 1. What THIS call registered — a record of the write, not the value in effect.
$registered = WireKit::defaultsFor('button');
A default can also come from the published config file, and WireKit:: writes into that
same config so both routes end up in one place. defaultsFor() reads only the runtime record, so a
component styled entirely from config/ returns an empty array here while rendering with
defaults. Do not read an empty array as “this component has no default” — read
config('wirekit. for the value that is actually in effect.
The same thing, straight in the config file
WireKit:: writes into config/, so you can also write it there and skip
the boot code entirely. This is the form every component page's Customization section shows:
// config/wirekit.php
'components' => [
'button' => ['intent' => 'neutral', 'surface' => 'outline', 'size' => 'lg'],
'tooltip' => ['placement' => 'bottom', 'delay-show' => 500],
],
Reach for the service-provider call when the value has to be computed at boot (a tenant's brand
intent, an environment switch); reach for the file when it is a constant, because a published
config file survives config:cache and a closure does not.
A published file does not freeze the package's keys. WireKit merges its own config into yours
section by section: a value you set wins, and a key you never wrote comes from the package, in a
section that is still empty in your file as well: a file published with 'sidebar' => [] still
receives sidebar.. A list you wrote, such as the icon presets, stays exactly as
you wrote it.
Which keys a component accepts is not a separate list to look up. A prop is settable this way
when its declared default reads through config() — which is exactly what the Default column of
that component's props table shows. Multi-word keys are kebab-case (delay-show, max-tags,
native-on-mobile), matching the config file rather than the camelCase prop name.
A sub-component's prop sits under its parent. A key with a dot in the config file
('dropdown.) carries only classes. The prop default of a sub-component is read through
its parent, so in the file it nests there:
// config/wirekit.php
'components' => [
'dropdown' => ['panel' => ['width' => 'trigger']],
],
WireKit:: accepts 'dropdown. as well and writes the
value to the same place.
Use this level when: a specific component prop should have a different default project-wide (e.g. every button is size="lg"). Tokens (Level 1) change the look; defaults (Level 2) change the behavior. Both are global; both can coexist.
Level 3: Deep Personalization
Replace entire CSS class blocks per component:
WireKit::personalize('card', [
'base' => '[overflow-wrap:break-word] bg-[var(--color-wk-bg)] text-[color:var(--color-wk-text)] rounded-none overflow-hidden',
]);
Use this level when: the change is structural (the layout / spacing / typography of a specific component slot) and a token override can't express it. Personalization replaces the WireKit-supplied class string for that slot wholesale, so you take ownership of the slot's structural CSS.
A few classes stay whatever you replace. The markers a component needs to work or to be usable, such as the overlay layer of a modal, the scrollbar styling of a scroll container, the touch target of a small button or the width of a carousel slide, are set in front of the block rather than inside it, so owning a block's look never takes them away.
The string is the whole block, so it has to carry everything the block did. A card's block is its surface and its corners. The block of something you can operate holds more: a button's also carries its focus ring, its disabled state and the wk-button marker, and a string that leaves them out ships a button a keyboard user cannot see focus on. For a change to part of a block, use the closure form below.
Adjusting a block instead of replacing it
Taking ownership of a slot has a cost that shows up much later: from that point the block is yours, and every subsequent improvement WireKit makes to it stops reaching your app. Nothing is broken, so the override simply looks like a decision you made, for as long as it stands.
php artisan wirekit:doctor names them for you. It reports every block whose value is a finished class string — the shape that replaces — and stays silent when every block extends. That puts the trade in front of you on the day you go looking, rather than on the day an upstream change quietly failed to arrive. If you want the same list in your own tooling, WireKit:: returns it.
When your change is a delta rather than a rewrite, give the block a closure instead of a string. It receives the class string WireKit ships and returns the one you want:
WireKit::personalize('sidebar.item', [
// 1. $vendor is the block exactly as WireKit ships it, this version.
// 2. Return what you want rendered — here, everything plus one change.
'base' => fn (string $vendor): string => $vendor.' rounded-none',
]);
You are not limited to appending. The point is that you can see what you are overriding, so you can also remove or swap one part and keep the rest:
WireKit::personalize('button', [
'base' => fn (string $vendor): string => str_replace('font-[number:var(--font-wk-body-weight)]', 'font-bold', $vendor),
]);
A swap only does something when the class it names is in the block, so name it as the block ships it. To see the block, log $vendor from a closure that returns it unchanged.
Both forms work on personalize() and on scope(). A plain string replaces the block outright, which is the right choice when you genuinely want to own the slot.
Prefer the closure form whenever your change is small. It keeps you on the upgrade path: a new utility WireKit adds to that block arrives in $vendor and flows through, while your delta stays applied.
This applies to personalize() and scope(), not to the config-file overrides below. A closure in a config file cannot survive php artisan config:cache, so a personalization written there would work in development and vanish on the first cached deploy.
Class overrides via config
The same class blocks can also be set straight in config/ under components.{name}.classes.{block} — the lowest-friction override, with no service-provider boot code:
// config/wirekit.php
'components' => [
// A string replaces the whole block, so it carries everything the block did:
// a card's base is its wrapping, surface, text color and corners.
'card' => [
'classes' => ['base' => '[overflow-wrap:break-word] bg-[var(--color-wk-bg-elevated)] text-[color:var(--color-wk-text)] rounded-none overflow-hidden'],
],
// Sub-components use their literal dotted name as the key — 'sidebar.item',
// 'card.header', 'table.th', 'dropdown.panel'. Keep the dot in the key;
// do not nest it as 'sidebar' => ['item' => [...]].
'sidebar.item' => [
'classes' => ['active' => 'bg-[var(--color-wk-accent)] text-[color:var(--color-wk-accent-fg)]'],
],
],
Config overrides sit below personalize() and scope() in the priority chain (deep > scoped > config > default), so a personalize() call always wins over a config entry for the same block.
Heads-up — class strings authored in PHP or config are outside Tailwind's content scan. A utility that appears only inside a
config/value or awirekit. php personalize()call (never in a Blade template) is not generated unless you point Tailwind at that file with an@sourceline in your CSS — see the Source Scanning step in the Integration guide. Without it the override resolves to a class name that has no matching CSS, and the change silently does nothing.
Scoped Personalization
Apply personalization only to specific instances:
WireKit::scope('square', [
// 1. A closure keeps the rest of the block and swaps the one class it names.
'card' => ['classes' => [
'base' => fn (string $vendor): string => str_replace('rounded-[var(--radius-wk-lg)]', 'rounded-none', $vendor),
]],
]);
<x-wirekit::card scope="square">Square corners</x-wirekit::card>
<x-wirekit::card>Rounded corners</x-wirekit::card>
In Tests
WireKit counts a few things across one render: the generated ids of controls (textarea-1), the prop values it has already reported, the steps of a tour and the questions of an FAQ. The service provider resets them after every request and before every queued job. A test that renders without the HTTP kernel, through Blade::render(), a console command or a request that throws while exception handling is off, leaves them to the next test, which then counts on from textarea-3. Reset them before each test:
// tests/Pest.php
// 1. Reset what one render counts before every test. The defaults, scopes and
// personalizations your provider's boot() set stay as they are.
beforeEach(fn () => \Pushery\WireKit\WireKit::resetPerRender());
The method also has WireKit read again whether compact classes are on. It reads that switch once, and again after each request, and every test starts with it read afresh. A test that turns compact classes on or off between two renders calls the method again after it sets the value, so the next render reads it:
// 1. Turn compact classes on for the renders that follow in this test.
config(['wirekit.styles.compact' => true]);
// 2. Have WireKit read the switch again before the next render.
\Pushery\WireKit\WireKit::resetPerRender();
WireKit:: resets those as well, the configuration included. It belongs after a test, in afterEach, rather than before one: your provider's boot() has already run when beforeEach starts, and a flush there would render every test without its scopes and personalizations.
Rendered HTML From a Cache
The generated ids count from 1 in every request. A page that writes part of itself from a cache, such as the rendered body of an article with a layout rendered around it, already holds ids the layout would count again: the layout's first tooltip would be wk-tooltip-1, as the cached body's is, and aria-describedby and get find the first of the two. Tell WireKit about the cached HTML before anything else renders:
use Illuminate\Support\Facades\Cache;
use Illuminate\Support\HtmlString;
use Pushery\WireKit\WireKit;
// 1. The body as it was rendered, from the cache or rendered now
$body = Cache::remember("articles.{$article->id}.body", now()->addDay(), fn (): string => view('articles.body', ['article' => $article])->render());
// 2. Nothing rendered after this hands out one of its ids again
WireKit::reserveIdsIn($body);
return view('articles.show', ['article' => $article, 'body' => new HtmlString($body)]);
A counted id then continues after the highest number of its prefix in the body: after wk-tooltip-6 the layout's first tooltip is wk-tooltip-7. An id derived from a name moves on to its next suffix, so a reserved email makes the layout's email field email-2. WireKit:: registers ids one by one. Both are forgotten with the other counts after the request.
The tooltip of a field's help takes its id from the field, email-help-tooltip for a field email, so it does not depend on how many tooltips rendered before it.
State-Dependent Slots
Most slots describe a component's resting appearance. A few describe how it looks in a particular state — and those are worth calling out, because they are what you need when a brand styles the selected thing differently rather than just recoloring the whole control.
segmented-control exposes both branches of its selection state:
// 1. Restyle the selected segment — e.g. a brand fill instead of the
// default elevated pill.
WireKit::scope('brand-tabs', [
'segmented-control' => ['classes' => [
'segment-selected' => 'bg-[color:var(--brand-gold)] text-[color:var(--brand-navy)] font-semibold',
'segment-unselected' => 'text-[color:var(--brand-navy)]/60 hover:text-[color:var(--brand-navy)]',
]],
]);
A state slot is replaced wholesale, never merged — so your override must describe the state's full appearance: background, text color, elevation and weight. Setting only a background silently drops the rest, leaving the selected segment with no text-color or shadow treatment at all.
The weight is the one part you can change without taking over the slot. A
selected segment reads --font-wk-selected-weight, a Level 1 token, so this
keeps it in regular type while its surface, text color and shadow stay the
component's own:
:root {
--font-wk-selected-weight: var(--font-wk-body-weight);
}
Design Tokens lists the components that read it.
Not every component with reactive state offers these slots yet. Where the appearance is still resolved inside the runtime binding, a per-instance override cannot reach it and a global token override is the way to change it.
Level 4: Publish Views
Full ownership — edit the Blade templates directly:
php artisan vendor:publish --tag=wirekit-views
Views land in resources/ and take priority over the package views.
Use this level when: Levels 1–3 can't express the change (entirely new DOM structure, custom slots, custom Alpine wiring). Publishing is the heaviest tool. Avoid using it as a shortcut for what Levels 1–3 can already do — see the warning below.
Published views are detached from updates: when WireKit releases a new version, published views never receive changes automatically. Avoid publishing more than you actually need to modify, or you must hand-merge upstream improvements on every release.
Compact Classes
Every component writes its look as Tailwind utilities, and on a page of many components those class names are most of what the page weighs: a list of products with a checkbox, a badge and a menu in every row carries hundreds of kilobytes of them, and a Livewire component sends them again with every update. Compact classes write the kit's utilities under short names instead:
// config/wirekit.php
'styles' => [
'compact' => true, // or WIREKIT_COMPACT_CLASSES=true in .env
],
With wirekit. on, @wirekitStyles also links wirekit-compact., which declares every short class with exactly the rules of its utility, in the same order. The page looks the same and carries less than half of the class bytes. The components, their props and the levels above stay as they are.
- A class you put on a component keeps its name.
<x-wirekit::writesbutton class="mt-4"> mt-4, and a class one component hands to another stays as written too. - A personalization is written like a default. A closure still receives the kit's classes as utilities and returns utilities, and the result is written under short names wherever the kit has one.
- A utility of your own on a component element meets the kit's as it does without compact classes. The compact sheet loads before your application's stylesheet, in the order the integration guide gives, so a short name loses to your utility. Where that would change the outcome, a utility of the kit's keeps its long name on that element, and both come from your stylesheet in Tailwind's order: beside a utility the kit writes too, each of the kit's that sets a property of the same kind and comes after yours in Tailwind's order, and beside one the kit never writes, such as
py-2, each of the kit's of the same kind. Atable.stand-inyou giveclass="block"stays hidden where its column shows, and a hero you givepy-2takes its own padding again fromsmup. - A selector of your own that looks for one of the kit's utility classes on its elements, in CSS or in a script, finds nothing once the class has a short name. Select by a
data-wk-*hook or by a class of your own. - A test that compares the classes of a component asks for the names the kit writes with
WireKit::. It returns a class list under its short names while compact classes are on, and as it came while they are off; a class without a short name keeps its own. Passcompact Classes() trueas the second argument for an input, a select or a textarea, whose field classes keep their names. - A test that reads the classes of a rendered page and compares them with utilities writes them out first with
WireKit::. It returns each short class as the utility it stands for while compact classes are on, and the list as it came while they are off; every other class and the whitespace stay as they are, sospelled Out Classes() WireKit::returnsspelled Out Classes(Wire Kit:: compact Classes($classes)) $classes. A case that expects a utility to be absent then fails where the page carries it under its short name. - A test that turns compact classes on or off between two renders sets
wirekit.and then callsstyles. compact WireKit::. WireKit reads the switch once, and again after each request, and a test that renders throughreset Per Render() Livewire::ortest() Blade::render()finishes no request in between (in tests). - A button writes a few classes, not one for each utility. Its base block and the classes of its intent on its surface each go under one short class, which the compact sheet declares with exactly the rules of the utilities it stands for, so a button in every row of a long table carries a few short names. A class you put on the button that takes over one of those utilities,
cursor-waitover the pointer, keeps the button's others under short names of their own.WireKit::writes such a class out as all the utilities it stands for, so a test that reads a button's classes from a rendered page finds each of them; a test that builds the expected names withspelled Out Classes() WireKit::compares the written-out classes instead.compact Classes() - Without
@wirekitStyles, where your own build importswirekit.css, put@wirekitin theCompact Styles <head>of your layout, before your own stylesheet. It linkswirekit-compact.while compact classes are on and writes nothing while they are off, so the sheet follows the switch the components follow, which an import in a build cannot.css wirekit:verifywarns when compact classes are on and no stylesheet that declares them is loaded.
Keep the kit's Tailwind sources in your build either way: a class a component sets while the page runs, and every utility the compact sheet does not declare, still comes from your stylesheet. A class a component's script sets on an element keeps its long name on that element, since the script adds and removes it by that name, and takes its short name everywhere else. Where such a class stands on an element beside a utility that has to win over it, hidden set by a script beside md:block, that utility keeps its name on the element as well, so both come from your stylesheet in Tailwind's order. Compact classes are off by default while they settle in; turning them off again restores the long names.
Icon Sprite
A few glyphs are drawn in every instance of a component: the question mark of a field's help, the check and the dash of a checkbox, the arrows of a select and a folding card, and the spinner of a busy button. A form of a hundred fields carries the same drawings a hundred times. The icon sprite draws each of them once per page:
// config/wirekit.php
'icons' => [
'sprite' => true, // or WIREKIT_ICON_SPRITE=true in .env
],
With wirekit. on, @wirekitScripts writes every glyph once as an SVG <symbol> at the end of the page, and each instance carries a <use> that points there. The page looks the same, in forced colors as well, and each glyph weighs a reference instead of its drawing.
- Every page needs
@wirekitScriptswhile it is on. It writes the symbols, outside every component, so no Livewire update takes them away. A page without it has glyphs that point at nothing, and a checkbox or a select works without scripts otherwise. That is why the sprite is off by default. - A layout that loads the components through a module of its own carries no
@wirekitScripts, as Importing only the components you use shows. It puts@wirekitbefore itsIcon Sprite </body>instead, which writes the symbols and nothing else. One of the two directives per page, never both: two sheets repeat every symbol id, andphp artisan wirekit:doctorwarns about a page shell that carries both. - The sprite holds every glyph, not only the ones the page shows, so a component that an update brings in later finds its symbol too.
- An instance keeps its classes and attributes. The classes that show the check of a checkbox, the turn of a card's arrow and the
wire:loadingof a spinner stay on the instance's<svg>, and so do the glyph's stroke and fill, so a rule of your stylesheet on that<svg>reaches the glyph as it does without the sprite.
Navigation Icons
A sidebar or an app rail names a few icons in many rows, and each row carries the whole drawing of its icon. A second switch draws those once per page as well:
// config/wirekit.php
'icons' => [
'navigation_sprite' => true, // or WIREKIT_ICON_NAVIGATION_SPRITE=true in .env
],
With wirekit. on, @wirekitScripts writes each icon the rows above it named once as a symbol, and every such row points there. The two switches are independent, and the directives above write the symbols of both.
- A row before the directive points into the sprite. At the end of
<body>, that is every row of the page. A row rendered after it, or in a Livewire update, draws its icon whole, so no icon goes missing. - A row keeps the attributes of its whole drawing. Its color, its stroke and a class that changes them reach the icon the same way they reach a whole drawing. A stylesheet rule that reaches into the drawing itself, such as
svg path, does not reach the copy a<use>draws. - A response with rows needs the directive too. Rows that a script fetches into the page outside Livewire can name an icon the page has no symbol for, so keep the switch off where navigation arrives that way.
Additional Configuration
Beyond the 4-level component customization, WireKit offers config-level settings for icons and charts:
- Icon Presets: Switch icon sets globally via
config/— see Icon docswirekit. php - Chart Adapters: Configure chart libraries via config — see Chart docs
- Font Presets: Configure locally bundled fonts — see Fonts docs