Theming
Brand colors
Components that use your brand color, such as the default button, badge and focus rings, read two Tailwind theme colors: primary and secondary.
The published tallcraftui.css sets defaults (#6d28d9 and #a21caf). Your own values always take precedence:
@import 'tailwindcss';@import './tallcraftui.css'; @theme { --color-primary: #0e7c72; --color-secondary: #5b61e8;}
Color attributes
Components with color variants accept any Tailwind color name as a bare attribute, from slate to rose, plus primary, secondary, black and white.
The API reference on each component page lists the colors it supports.
<x-button label="Primary" /><x-button label="Secondary" secondary /><x-button label="Rose" rose /><x-badge label="Emerald" emerald /><x-badge label="Sky" sky outline /><x-toggle label="Amber" amber checked />
Dark mode
Every component ships with dark styles. TallCraftUI uses class-based dark mode: add dark to the <html> element and components switch.
The installer adds the variant to app.css:
@custom-variant dark (&:where(.dark, .dark *));
Drop in <x-theme-toggle /> to let people switch. It saves the choice in localStorage and falls back to the operating system setting.
To apply the saved theme before the page first paints, add this to your layout's <head>:
<script> if (localStorage.getItem('dark-mode') === 'true' || (!('dark-mode' in localStorage) && window.matchMedia('(prefers-color-scheme: dark)').matches)) { document.documentElement.classList.add('dark'); }</script>
If you'd rather follow the operating system only, leave out the @custom-variant line and Tailwind's default media-query dark mode applies.
Override styles with classes
Classes you pass to a component are merged with its own classes using tailwind-merge. When two classes conflict, yours wins, so you can change one detail without rewriting the rest:
<x-button label="Default" /><x-button label="Pill, no caps" class="rounded-full px-6 normal-case tracking-normal" /><x-button label="Full width" class="w-full sm:w-64" />
Style inner elements
Some components are made of several elements. Target one with a class: attribute, for example class:icon or class:label:
<x-input label="Search" icon="magnifying-glass" placeholder="Find a component" class:label="text-xs font-semibold text-gray-500" class:icon="text-teal-600" />
Available targets, read from the component source:
| Attribute | Components |
|---|---|
| class:label | Input, Password, Textarea, Select, Native select, Checkbox, Radio, Toggle, Range, Color picker, Rating, Markdown |
| class:icon | Button, Badge, Input, Password, Color picker, Dropdown, Dropdown item, Menu, Menu item, Breadcrumb item, Tab item, Accordion item, Separator, Not found |
| class:title | Dropdown, Menu, Separator, Toast |
| class:badge | Avatar, Dropdown item, Menu item |
| class:content | Tooltip, Tab, Accordion item |
| class:items | Tab |
| class:description | Toast |
| class:close-icon | Toast |
| class:icon-light / class:icon-dark | Theme toggle |
Change defaults globally
To change a default everywhere, such as making every button large or every modal centered, use the
component defaults in config/tallcraftui.php instead of repeating attributes.