A Tailwind CSS v4 plugin that adds overflow overlay utilities.
npm install tailwindcss-plugin-overflow-tw4
# or
pnpm add tailwindcss-plugin-overflow-tw4
# or
yarn add tailwindcss-plugin-overflow-tw4This plugin provides the following utilities:
.overflow-overlay- Setsoverflow: overlaywith fallback support.overflow-x-overlay- Setsoverflow-x: overlaywith fallback support.overflow-y-overlay- Setsoverflow-y: overlaywith fallback support
.smallscroll- Adds thin, styled scrollbars for both Firefox and Chrome/WebKit browsers- Customizable via CSS variables:
--sb-width: Scrollbar width (default: 8px)--sb-radius: Scrollbar thumb border radius (default: 4px)--sb-color: Scrollbar color (default: #666b7a)
- Customizable via CSS variables:
.resizer- Adds a custom resize handle with a visual grip pattern
<!-- Overflow overlay -->
<div class="overflow-overlay h-64 w-64">
<!-- Content with overlay scrollbars -->
</div>
<!-- Vertical overlay scrollbar -->
<div class="overflow-y-overlay h-64">
<!-- Content with vertical overlay scrollbar -->
</div>
<!-- Custom thin scrollbars -->
<div class="smallscroll overflow-auto h-64">
<!-- Content with thin, styled scrollbars -->
</div>
<!-- Custom scrollbar colors -->
<div class="smallscroll overflow-auto h-64" style="--sb-color: #3b82f6">
<!-- Blue scrollbars -->
</div>
<!-- Textarea with custom resize handle -->
<textarea class="resizer resize w-full h-32">
<!-- Textarea with custom resize grip -->
</textarea>/* In your main CSS file (e.g., `app.css` or `index.css`) */
@import "tailwindcss";
@plugin "tailwindcss-plugin-overflow-tw4";
/* or connect it to Tailwind CSS js configuration */
@config '../tailwind.config.js';/* or with a relative path if installed locally */
@import "tailwindcss";
@plugin "../node_modules/tailwindcss-plugin-overflow-tw4";// Add the plugin to your Tailwind CSS v4 configuration:
// tailwind.config.js or tailwind.config.ts
import overflowPlugin from 'tailwindcss-plugin-overflow-tw4';
export default {
plugins: [
overflowPlugin,
],
};// Or if using ESM in a JavaScript file:
// tailwind.config.js
import overflowPlugin from 'tailwindcss-plugin-overflow-tw4';
/** @type {import('tailwindcss').Config} */
export default {
content: ['./src/**/*.{html,js,jsx,ts,tsx}'],
plugins: [overflowPlugin],
};For Tailwind CSS v3, use CommonJS format:
// tailwind.config.js
const overflowPlugin = require('tailwindcss-plugin-overflow-tw4');
/** @type {import('tailwindcss').Config} */
module.exports = {
content: ['./src/**/*.{html,js,jsx,ts,tsx}'],
plugins: [overflowPlugin],
};Or with ES modules:
// tailwind.config.mjs
import overflowPlugin from 'tailwindcss-plugin-overflow-tw4';
/** @type {import('tailwindcss').Config} */
export default {
content: ['./src/**/*.{html,js,jsx,ts,tsx}'],
plugins: [overflowPlugin],
};# Install dependencies
pnpm install# Build the plugin
pnpm run build# Debug the plugin
# Or use VS Code's debugger with the provided launch configuration.
pnpm run debug# Publish the plugin to npm
pnpm run publish:npm- Overflow overlay: Supported in Chromium-based browsers (Chrome, Edge, Opera). Falls back gracefully in other browsers.
- Smallscroll: Works in all modern browsers with optimized styling for both Firefox and WebKit/Blink browsers.
- Resizer: Works in WebKit/Blink browsers (Chrome, Edge, Safari, Opera).
- Node.js >= 18.0.0
- pnpm >= 10.0.0 (for development)
- Tailwind CSS v3.x or v4.x