Awesome
tailwind-scrollbar-hide
Tailwind plugin for hide scrollbars, although the element can still be scrolled if the element's content overflows.
<img src="https://user-images.githubusercontent.com/12596485/142972957-272010d3-29f6-4be7-99e1-dd03e7a8b92b.gif" alt="tailwind-scrollbar-hide animation demo" height="500" />Features
🎨 Tailwind v2.x, v3.x, v4.x
🛠️ Port for unocss-preset-scrollbar-hide
Installation
Install the plugin from npm:
# Using npm
npm install tailwind-scrollbar-hide
# Using Yarn
yarn add tailwind-scrollbar-hide
# Using pnpm
pnpm add tailwind-scrollbar-hide
Then add the plugin to your config file:
// tailwind.config.js
module.exports = {
theme: {
// ...
},
plugins: [
require('tailwind-scrollbar-hide')
// ...
]
}
or using TypeScript:
// tailwind.config.ts
import type { Config } from 'tailwindcss'
import scrollbarHide from 'tailwind-scrollbar-hide'
export default {
theme: {
// ...
},
plugins: [scrollbarHide]
} satisfies Config
Tailwind v4 support
Use legacy configuration files like:
/* index.css */
@import 'tailwindcss';
@config "../../tailwind.config.js";
Usage
Use in you template scrollbar-hide
for visual hiding scrollbar
<div class="w-4 scrollbar-hide">...</div>
or restore default value use scrollbar-default
⚠️ webkit overriding not working https://github.com/reslear/tailwind-scrollbar-hide/issues/19#issuecomment-1086949110 need switch breakpoint system
<div class="w-4 scrollbar-hide md:scrollbar-default">...</div>
Plugin Inspiration
- https://github.com/tailwindlabs/tailwindcss-forms/tree/main
- https://github.com/tailwindlabs/tailwindcss/discussions/2310#discussioncomment-8592440