npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

tailwindcss-plugin-markers-tw4

v1.0.1

Published

Tailwind CSS v4 plugin for checkbox markers

Downloads

5

Readme

Tailwind CSS Plugin: Custom Checkbox & Radio Markers

A Tailwind CSS v4 plugin that adds customizable checkmarks and radio button indicators for form elements with light/dark mode support.

Features

  • ✅ Custom checkbox checkmarks with SVG
  • ✅ Custom checkbox indeterminate state
  • ✅ Custom radio button indicators
  • 🌓 Built-in light/dark mode support
  • 🎨 Fully customizable colors
  • 📦 Lightweight and performant
  • 🔧 TypeScript support

Installation

npm install tailwindcss-plugin-markers-tw4
# or
pnpm add tailwindcss-plugin-markers-tw4
# or
yarn add tailwindcss-plugin-markers-tw4

Usage

Basic Setup (Default Colors)

Add the plugin to your Tailwind CSS configuration:

// tailwind.config.js
import markersPlugin from 'tailwindcss-plugin-markers-tw4';

export default {
  plugins: [
    markersPlugin()
  ]
}

This will use the default colors:

  • Light mode: Black markers (#000000)
  • Dark mode: White markers (#ffffff)

Custom Colors

You can customize the marker colors for both light and dark modes:

// tailwind.config.js
import markersPlugin from 'tailwindcss-plugin-markers-tw4';

export default {
  plugins: [
    markersPlugin({
      light: '#3b82f6',  // Blue markers in light mode
      dark: '#60a5fa'     // Lighter blue in dark mode
    })
  ]
}

HTML Usage

Simply use Tailwind's form classes on your checkbox and radio inputs:

<!-- Checkbox -->
<input 
  type="checkbox" 
  class="form-checkbox h-5 w-5 text-blue-600 rounded border-gray-300"
/>

<!-- Radio Button -->
<input 
  type="radio" 
  class="form-radio h-5 w-5 text-blue-600 border-gray-300"
/>

<!-- Indeterminate Checkbox (set via JavaScript) -->
<input 
  type="checkbox" 
  id="indeterminate-checkbox"
  class="form-checkbox h-5 w-5 text-blue-600 rounded border-gray-300"
/>

<script>
  document.getElementById('indeterminate-checkbox').indeterminate = true;
</script>

Examples

Complete Form Example

<div class="space-y-4 p-6">
  <!-- Checkbox Example -->
  <label class="flex items-center space-x-3">
    <input 
      type="checkbox" 
      class="form-checkbox h-5 w-5 text-blue-600 rounded border-gray-300 focus:ring-2 focus:ring-blue-500"
      checked
    />
    <span class="text-gray-900 dark:text-gray-100">Accept terms and conditions</span>
  </label>

  <!-- Radio Button Example -->
  <fieldset class="space-y-2">
    <legend class="text-sm font-medium text-gray-900 dark:text-gray-100">Choose an option:</legend>
    <label class="flex items-center space-x-3">
      <input 
        type="radio" 
        name="option" 
        class="form-radio h-4 w-4 text-blue-600 border-gray-300 focus:ring-2 focus:ring-blue-500"
        checked
      />
      <span class="text-gray-700 dark:text-gray-300">Option 1</span>
    </label>
    <label class="flex items-center space-x-3">
      <input 
        type="radio" 
        name="option" 
        class="form-radio h-4 w-4 text-blue-600 border-gray-300 focus:ring-2 focus:ring-blue-500"
      />
      <span class="text-gray-700 dark:text-gray-300">Option 2</span>
    </label>
  </fieldset>

  <!-- Indeterminate Checkbox Example -->
  <label class="flex items-center space-x-3">
    <input 
      type="checkbox" 
      id="select-all"
      class="form-checkbox h-5 w-5 text-blue-600 rounded border-gray-300 focus:ring-2 focus:ring-blue-500"
    />
    <span class="text-gray-900 dark:text-gray-100">Select all items</span>
  </label>
</div>

Dark Mode Support

The plugin automatically applies different marker colors in dark mode:

<div class="bg-white dark:bg-gray-800 p-6 rounded-lg">
  <input 
    type="checkbox" 
    class="form-checkbox h-5 w-5 text-blue-600 rounded"
    checked
  />
  <!-- In light mode: uses 'light' color option -->
  <!-- In dark mode: uses 'dark' color option -->
</div>

Visual Examples

Checkboxes

┌─────────────────────────────────────┐
│  ☐  Unchecked                       │
│  ☑  Checked (with custom marker)    │
│  ☒  Indeterminate (with dash)       │
└─────────────────────────────────────┘

Radio Buttons

┌─────────────────────────────────────┐
│  ○  Unselected                      │
│  ◉  Selected (with custom dot)      │
└─────────────────────────────────────┘

Color Options

The plugin accepts any valid CSS color format:

markersPlugin({
  light: '#000000',           // Hex
  dark: 'rgb(255, 255, 255)'  // RGB
})

markersPlugin({
  light: 'hsl(220, 90%, 50%)', // HSL
  dark: '#60a5fa'              // Hex
})

markersPlugin({
  light: 'currentColor',       // Named/keyword
  dark: 'white'                // Named color
})

Browser Support

This plugin works in all modern browsers that support:

  • CSS custom properties
  • SVG data URIs
  • Dark mode (prefers-color-scheme)

API Reference

Plugin Options

| Option | Type | Default | Description | |--------|------|---------|-------------| | light | string | 'black' | Color for markers in light mode | | dark | string | 'white' | Color for markers in dark mode |

Generated Classes

The plugin generates the following CSS for Tailwind's form classes:

  • .form-checkbox:checked - Checkbox checkmark
  • .form-checkbox:indeterminate - Checkbox indeterminate state
  • .form-radio:checked - Radio button dot
  • .dark .form-checkbox:checked - Checkbox checkmark (dark mode)
  • .dark .form-checkbox:indeterminate - Checkbox indeterminate (dark mode)
  • .dark .form-radio:checked - Radio button dot (dark mode)

TypeScript

This plugin includes TypeScript type definitions out of the box.

import markersPlugin from 'tailwindcss-plugin-markers-tw4';

// Type-safe options
markersPlugin({
  light: '#3b82f6',
  dark: '#60a5fa'
})

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

MIT © Max Zakharzhevskiy

Links

Related