Styling and cascade layers
vael-ui ships in @layer ui-components. Unlayered CSS always beats layered CSS, whatever its specificity, so an unlayered base reset overrides vael-ui’s styles without any warning. To prevent that, put your base styles in a layer too, and order that layer first.
Layer order
/* your app's main stylesheet, such as style.css */
@layer app-base, ui-components;
@layer app-base {
* { margin: 0; box-sizing: border-box; }
button, input, textarea, select { font: inherit; }
}// main.ts
import './style.css' // your base layer, loads firstHere, import order only sets the layer position. An unlayered override always wins, wherever it loads.
When you override one component on purpose, with the ui prop or a Tailwind utility, you want your rule to win. Keep that CSS unlayered, as it is by default. See Using with Tailwind.
CSS variables
vael-ui’s colors, radii, shadows and default motion timings come from CSS custom properties. Override any of them in your own unlayered stylesheet:
/* your own global stylesheet, unlayered so it always wins */
html { font-size: 14px; }
:root {
--ui-primary: #6366f1;
--ui-radius: 6px;
}ConfigProvider’s theme sets primary, danger, radius and fontSize. Without fontSize, components follow your html font size, form fields included. If that’s under 16 px, call preventFocusZoom() once so iPhones don’t zoom into fields. Set the other tokens with CSS.
Colors
| Variable | Default | Description |
|---|---|---|
--ui-primary | #18181b | Primary action color: buttons, links and focus accents. |
--ui-primary-hover | #27272a | Hover color for primary. |
--ui-primary-contrast | #fafafa | Text and icon color on top of primary. |
--ui-muted | #f4f4f5 | Subtle background for secondary surfaces. |
--ui-muted-hover | #e4e4e7 | Hover color for muted backgrounds. |
--ui-danger | oklch(0.586 0.253 26) | Destructive and error color. |
--ui-danger-hover | — | Hover color for this color. |
--ui-danger-contrast | #ffffff | Text and icon color on top of this color. |
--ui-success | oklch(71.335% 0.15901 160.899) | Success color. |
--ui-success-hover | — | Hover color for this color. |
--ui-success-contrast | #ffffff | Text and icon color on top of this color. |
--ui-warning | oklch(0.666 0.179 58.315) | Warning color. |
--ui-warning-hover | — | Hover color for this color. |
--ui-warning-contrast | #ffffff | Text and icon color on top of this color. |
--ui-info | #2563eb | Informational color. |
--ui-info-hover | #1d4ed8 | Hover color for this color. |
--ui-info-contrast | #ffffff | Text and icon color on top of this color. |
--ui-surface | #ffffff | Base background for panels, cards and dialogs. |
--ui-text | #18181b | Primary text color. |
--ui-text-muted | #71717a | Secondary text color. |
--ui-border | #e4e4e7 | Default border color. |
--ui-border-strong | #d4d4d8 | Stronger border color for emphasized edges. |
--ui-overlay | rgb(0 0 0 / 0.4) | Backdrop color behind dialogs and other modals. |
Shape
| Variable | Default | Description |
|---|---|---|
--ui-radius | 10px | Base corner radius for controls such as buttons, inputs and badges. |
--ui-radius-surface | min(var(--ui-radius), 1rem) | Corner radius for large surfaces such as panels, cards and tables. It’s capped, so a large radius doesn’t turn them into pills. |
Elevation and layering
| Variable | Default | Description |
|---|---|---|
--ui-z-dialog | 50 | Stacking order for dialogs. |
--ui-z-popover | 55 | Stacking order for popovers, menus and selects. |
--ui-z-toast | 60 | Stacking order for toasts. |
--ui-z-tooltip | 70 | Stacking order for tooltips, the topmost layer. |
--ui-panel-shadow | 0 0 0 1px …, 0 8px 24px …, 0 24px 48px … | Drop shadow for floating panels. |
Motion
| Variable | Default | Description |
|---|---|---|
--ui-ease-out | cubic-bezier(0.23, 1, 0.32, 1) | Default easing for elements entering and settling. |
--ui-ease-in-out | cubic-bezier(0.77, 0, 0.175, 1) | Easing for movement on screen, such as resizing and repositioning. |
--ui-ease-drawer | cubic-bezier(0.32, 0.72, 0, 1) | Easing for slides from an edge, such as drawers and sheets. |
--ui-duration-drawer | 500ms | How long a drawer or sheet takes to slide open. |
--ui-duration-press | 160ms | Duration of press feedback. |
--ui-duration-enter | 200ms | Duration of opening and entering. |
--ui-duration-exit | 150ms | Duration of closing and leaving. |
--ui-duration-indicator | 120ms | How long the hover highlight in lists and menus takes to glide to the next row. |
--ui-duration-indicator-wide | 200ms | The same glide for the wide rows of MenuList, Tree and DataTable. |
--ui-ease-indicator | var(--ui-ease-out) | Easing of the hover highlight. |
--ui-indicator-bg | var(--ui-muted) | Color of the hover highlight. Set it instead of a row’s :hover background, which would paint over the highlight. |
--ui-duration-tooltip | 125ms | Duration of a tooltip opening. |
--ui-duration-tooltip-exit | 100ms | Duration of a tooltip closing. |
--ui-duration-toast | 400ms | Duration of a toast entering. |
--ui-duration-toast-exit | 200ms | Duration of a toast leaving. |
--ui-ease-toast | ease | Easing for toasts. |
--ui-toast-offset | 1rem | Distance from the screen edge to the toast stack. |
Advanced
Most apps don’t need this. It’s for building your own controls that plug into vael-ui.