- Accordion
- Alert
- Alert Dialog
- Aspect Ratio
- Attachment
- Avatar
- Badge
- Banner
- Breadcrumb
- Bubble
- Button
- Button Group
- Calendar
- Card
- Carousel
- Chart
- Checkbox
- Command
- Collapsible
- Combobox
- Context Menu
- Data Table
- Date Picker
- Dialog
- Dropdown Menu
- Editor
- Input
- Input Group
- Label
- Loading Spinner
- Native Select
- Popover
- Select
- Separator
- Sheet
- Sidebar
- Skeleton
- Slider
- Steps
- Switch
- Tabs
- Textarea
- Tooltip
Theming
Using CSS Variables for theming.
How Theming works
For now, theming works only using CSS variables, as shown below
</p><div class="bg-background text-foreground"></div>
</p><div class="bg-background text-foreground"></div>
Convention
We use a simple
background and
foreground convention for colors. The
background variable is used for the background color of the component and the
foreground variable is used for the text color.
The
background suffix is omitted when the variable is used for the background color of the component.
April UI ships with a moss and warm clay palette by default. The default light theme uses soft green surfaces, while the dark theme uses layered forest tones. You can replace any semantic token in your application's CSS after importing April UI.
Given the following CSS variables:
--primary: 222.2 47.4% 11.2%;--primary-foreground: 210 40% 98%;
--primary: 222.2 47.4% 11.2%;--primary-foreground: 210 40% 98%;
The
background color of the following component will be
hsl(var(--primary)) and the
foreground color will be
hsl(var(--primary-foreground)).
<div class="bg-primary text-primary-foreground">Hello</div>
<div class="bg-primary text-primary-foreground">Hello</div>
CSS variables must be defined without color space function. See the Tailwind CSS documentation for more information.
List of variables
Here's the list of variables available for customization:
--background: 105 20% 93%;--foreground: 145 18% 13%;
--background: 105 20% 93%;--foreground: 145 18% 13%;
--muted: 100 15% 87%;--muted-foreground: 145 8% 36%;
--muted: 100 15% 87%;--muted-foreground: 145 8% 36%;
--card: 95 14% 97%;--card-foreground: 145 18% 13%;
--card: 95 14% 97%;--card-foreground: 145 18% 13%;
--popover: 95 14% 98%;--popover-foreground: 145 18% 13%;
--popover: 95 14% 98%;--popover-foreground: 145 18% 13%;
--border: 100 10% 79%;
--border: 100 10% 79%;
--input: 100 10% 79%;
--input: 100 10% 79%;
--primary: 28 38% 74%;--primary-foreground: 28 38% 16%;
--primary: 28 38% 74%;--primary-foreground: 28 38% 16%;
--secondary: 100 15% 87%;--secondary-foreground: 145 18% 13%;
--secondary: 100 15% 87%;--secondary-foreground: 145 18% 13%;
--accent: 30 20% 86%;--accent-foreground: 145 18% 13%;
--accent: 30 20% 86%;--accent-foreground: 145 18% 13%;
--destructive: 0 100% 50%;--destructive-foreground: 210 40% 98%;
--destructive: 0 100% 50%;--destructive-foreground: 210 40% 98%;
--ring: 28 38% 74%;
--ring: 28 38% 74%;
--radius: 0.5rem;
--radius: 0.5rem;
--sidebar-background: 100 16% 89%;--sidebar-foreground: 145 18% 13%;--sidebar-primary: 28 38% 74%;--sidebar-primary-foreground: 35 25% 12%;--sidebar-accent: 100 15% 84%;--sidebar-accent-foreground: 145 18% 13%;--sidebar-border: 100 10% 79%;--sidebar-ring: 28 38% 74%;
--sidebar-background: 100 16% 89%;--sidebar-foreground: 145 18% 13%;--sidebar-primary: 28 38% 74%;--sidebar-primary-foreground: 35 25% 12%;--sidebar-accent: 100 15% 84%;--sidebar-accent-foreground: 145 18% 13%;--sidebar-border: 100 10% 79%;--sidebar-ring: 28 38% 74%;
--sidebar-width: 16rem;--sidebar-width-icon: 3rem;--sidebar-width-mobile: 18rem;
--sidebar-width: 16rem;--sidebar-width-icon: 3rem;--sidebar-width-mobile: 18rem;
Adding new colors
To add new colors, define the channels and then map them in your
@theme block. Both live in your CSS file.
:root { --warning: 38 92% 50%; --warning-foreground: 48 96% 89%;}<p>.dark {--warning: 48 96% 89%;--warning-foreground: 38 92% 50%;}</p><p>@theme {--color-warning: hsl(var(--warning));--color-warning-foreground: hsl(var(--warning-foreground));}
:root { --warning: 38 92% 50%; --warning-foreground: 48 96% 89%;}<p>.dark {--warning: 48 96% 89%;--warning-foreground: 38 92% 50%;}</p><p>@theme {--color-warning: hsl(var(--warning));--color-warning-foreground: hsl(var(--warning-foreground));}
Tailwind v4 has no
tailwind.config.js. If you are following an older guide that tells you to add colors there, use
the
@theme block instead.
You can now use the
warning utility class in your components.
theme:github-light</p><div class="bg-warning text-warning-foreground"></div>
theme:github-dark</p><div class="bg-warning text-warning-foreground"></div>
Other color formats
ShadCN recommends using HSL colors for theming but you can also use other color formats if you prefer.
See the Tailwind CSS documentation for more information on using
rgb,
rgba or
hsl colors.
Component overrides
Use semantic tokens first. If a component needs a product-specific change, publish only that component and edit the
copy in
resources/views/vendor/april/components:
php artisan april:publish button
php artisan april:publish button
April components also expose
data-slot attributes on their internal elements. Use these selectors for small visual
adjustments without replacing a component:
[data-slot="button"] { letter-spacing: 0.01em;}
[data-slot="button"] { letter-spacing: 0.01em;}
The package merges component classes with passed classes. The
tailwind_merge configuration controls this behavior
when your application uses a custom Tailwind prefix or class groups.