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 🙏

© 2024 – Pkg Stats / Ryan Hefner

@fylgja/scrollbar

v1.1.1

Published

Customize or hide the scrollbar with ease

Downloads

307

Readme

Fylgja - Scrollbar

NPM version license

Customize or hide the scrollbar with ease.

Installation

npm install @fylgja/scrollbar

Then include the component in to your code via;

@use "@fylgja/scrollbar";
// Or via PostCSS import
@import "@fylgja/scrollbar";

@layer support

If you need support for @layer, use the following import;

@use "@fylgja/scrollbar" with ($scrollbar-layer: "utilities");
// Or via native CSS import, also supported by PostCSS import
@import "@fylgja/scrollbar" layer("utilities");

How to use

By default @fylgja/scrollbar offers 2 scrollbar styles.

  • .hide-scrollbar
  • .thin-scrollbar

Both are based on the browser default styles thats is supported by Firefox.

Giving a close cross browser support to the scrollbar style.

Apply the scrollbar style to any element that has overflow and so has a scrollbar.

<div class="thin-scrollbar">
    ...overflowing content here
</div>

Cross browser support

Currently the scrollbar styles are split in the newer specification that is only supported by Firefox.

And the webkit version that is supported by all moderne browsers except Firefox.

This CSS component mimics the newer spec with the webkit version.

And so limits the possibilities found in the webkit version.

Making this CSS component as safe solution for a near cross browser style, with minor OS differences.

Mixin (SCSS only)

This CSS component also ships with a handy SCSS mixin that you can use via;

@use "@fylgja/scrollbar/helper" as *;

@include scrollbar(
    $thumb, // thumb color
    $track, // track color
    $width: null, // width of the scrollbar
    $radius: 0.5rem // border radius of the scrollbar, webkit only
    $width-size: if($width, ..) // $width setters for the older spec
    $width-name: if($width, ..) // $width setters for the newer spec
);

This mixin will create a near cross browser scrollbar.

0.5rem is the radius found in most OS scrollbars

Config

Want more control on the base styles, than the CSS variables, Here are the following SCSS variables you can modify.

$enable-scrollbar-layer: false !default;

$scrollbar-layer-name: utilities !default;

$scrollbar-thumb-color: rgba($root-fg, 25%) !default;
$scrollbar-track-color: rgba($root-fg, 0%) !default;