Index of every page on this site: llms.txt
All skills
hairyf avatar

/tailwindcss

@ffa1f90
by Hairyhairyf/skills26 stars
5
Run it yourself

Tailwind CSS utility-first CSS framework. Use when styling web applications with utility classes, building responsive designs, or customizing design systems with theme variables.

Use this Skill: https://skilld.dev/gh/hairyf/skills/tailwindcss

Nothing lands on disk. Nothing to clean up.

Fork this Skill

Edit a local copy. It keeps the author and licence.

referencesfeatures-dark-mode.md

≈695 tokens on demand. Your agent reads this file only when SKILL.md points to it.

Dark Mode

Tailwind includes a dark variant that lets you style your site differently when dark mode is enabled.

Overview

Use the dark: variant to apply styles in dark mode:

<div class="bg-white dark:bg-gray-800 text-gray-900 dark:text-white">
  Content
</div>

Default Behavior

By default, the dark variant uses the prefers-color-scheme CSS media feature:

@media (prefers-color-scheme: dark) {
  .dark\:bg-gray-800 {
    background-color: rgb(31 41 55);
  }
}

Manual Toggle with Class

Override the dark variant to use a class selector:

@import "tailwindcss";

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

Now dark mode utilities apply when the dark class is present:

<html class="dark">
  <body>
    <div class="bg-white dark:bg-black">Content</div>
  </body>
</html>

Manual Toggle with Data Attribute

Use a data attribute instead:

@import "tailwindcss";

@custom-variant dark (&:where([data-theme=dark], [data-theme=dark] *));
<html data-theme="dark">
  <body>
    <div class="bg-white dark:bg-black">Content</div>
  </body>
</html>

Three-Way Theme Toggle

Support light mode, dark mode, and system preference:

// On page load
document.documentElement.classList.toggle(
  "dark",
  localStorage.theme === "dark" ||
    (!("theme" in localStorage) && 
     window.matchMedia("(prefers-color-scheme: dark)").matches)
);

// Set light mode
localStorage.theme = "light";
document.documentElement.classList.remove("dark");

// Set dark mode
localStorage.theme = "dark";
document.documentElement.classList.add("dark");

// Respect system preference
localStorage.removeItem("theme");
document.documentElement.classList.toggle(
  "dark",
  window.matchMedia("(prefers-color-scheme: dark)").matches
);

Common Patterns

Cards

<div class="bg-white dark:bg-gray-800 rounded-lg shadow-lg dark:shadow-none">
  <h2 class="text-gray-900 dark:text-white">Title</h2>
  <p class="text-gray-500 dark:text-gray-400">Description</p>
</div>

Borders

<div class="border border-gray-200 dark:border-gray-700">
  Content
</div>

Buttons

<button class="bg-blue-500 hover:bg-blue-600 dark:bg-blue-600 dark:hover:bg-blue-700 text-white">
  Button
</button>

Key Points

  • Use dark: variant for dark mode styles
  • Default uses prefers-color-scheme media query
  • Override with @custom-variant for manual toggles
  • Can use class or data attribute selectors
  • Combine with responsive variants: dark:md:bg-gray-800
<!-- Source references: - https://tailwindcss.com/docs/dark-mode -->

Source: SKILL.md on GitHub

No rule matched.

skilld matched fixed text patterns in SKILL.md and file names. Patterns miss obfuscated code.

skilld run checks every file with the same patterns. It asks for approval before it loads a Skill with a behavior marked Needs approval.

1 warning2mo5 checks · Risk SAFE
  • Gen Agent Trust Hub2mo

    A comprehensive reference skill for Tailwind CSS v4, containing only documentation and no executable scripts. It provides standard installation guides using official packages and well-known CDN services.

  • Socket2mo

    No alerts

  • Snyk2mo

    Risk: LOW · No issues

  • Runlayer9mo

    45/45 files flagged

  • ZeroLeaks7mo

    Score: 93/100 · 2 sections analyzed

Signed by skilld at ffa1f90. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub last month.

Steadyupdated 10 months ago
Other metadata
metadata
{
  "author": "Hairyf",
  "version": "2026.2.2",
  "source": "Generated from https://github.com/tailwindlabs/tailwindcss.com, scripts located at https://github.com/hairyf/skills"
}
  • tailwindcss
  • css
  • utility-first
  • responsive-design
  • styling
  • theme-variables
  • dark-mode
  • web-development

README badge

README badge for hairyf/skills

Tailwind CSS v4 is a utility-first framework for styling web applications by composing design directly in markup using utility classes. Use this skill when building responsive designs, customizing theme variables with CSS-first configuration, or styling components with flexbox, grid, transforms, and effects utilities.

Generated from the current SKILL.md.

Does this skill cover Tailwind CSS v4?
Yes. The skill is based on Tailwind CSS v4.1.18, including v4's CSS-first configuration with theme variables and the @theme directive.
What setup methods does this skill document?
The skill covers Vite, PostCSS, CLI, and CDN installation paths. See the core-installation reference.
Does this skill include dark mode guidance?
Yes. The skill documents dark mode implementation using the dark variant and custom strategies.
Does this skill help migrate from Tailwind v3 to v4?
Yes. The features-upgrade reference covers breaking changes and rename mappings for upgrading from v3 to v4.
What topics does this skill not cover?
The skill focuses on core Tailwind utilities and configuration. It does not cover third-party plugins or integration with specific JavaScript frameworks beyond general markup styling.

Generated from the current SKILL.md. These answers refresh after source changes.