Menu

1 / 5

Building a 19-page admin dashboard with Tailwind CSS v4 and no JavaScript framework

DEV Community: css·Brightkit Templates·6 days ago
#13RKPclj
#devtocss#devto#dev#dark#enter
Long article (711 words) — no AI summary yet.
Reading 0:00
15s threshold

When people build an admin dashboard today, the first step is usually "pick a framework". I wanted to try the opposite: Tailwind CSS v4, plain HTML and one small vanilla JavaScript file . The result is Velora, a 19-page dashboard template. Here are the patterns that made it work.

👉 Live demo

1. Dark mode without a flash

Tailwind v4 lets you redefine the dark variant directly in CSS:

@import "tailwindcss" ; @custom-variant dark ( & : where ( .dark , .dark * ) ) ;

Enter fullscreen mode

Exit fullscreen mode

Now dark:bg-gray-900 applies whenever an ancestor has the dark class. To avoid the classic "white flash" on page load, a tiny script in the <head> applies the saved theme before anything is painted:

<script> try { var t = localStorage . getItem ( "velora-theme" ) ; if ( t === "dark" || ( ! t && matchMedia ( "(prefers-color-scheme: dark)" ) . matches ) ) document . documentElement . classList .…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.