🚀 Big News:Socket Has Acquired Secure Annex.Learn More →
Socket
Book a DemoSign in
Socket

@m0ksem/vue-custom-scrollbar

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@m0ksem/vue-custom-scrollbar

Custom scrollbar for vue3.

latest
npmnpm
Version
0.0.7
Version published
Weekly downloads
2
-60%
Maintainers
1
Weekly downloads
 
Created
Source

Vue custom scrollbar

Custom scrollbar for vue3.

Instalation

yarn add @m0ksem/vue-custom-scrollbar
// main.js
import '@m0ksem/vue-custom-scrollbar/css'
import { VueCustomScrollbar } from '@m0ksem/vue-custom-scrollbar'
...
app.component('scrollbar', VueCustomScrollbar)

For nuxt3, lib needs to be transpiled.

Component api

Props

NameTypeDescriptionDefault
topBooleanRenders top scrollbarfalse
leftBooleanRenders left scrollbarfalse
bottomBooleanRenders bottom scrollbarfalse
rightBooleanRenders right scrollbarfalse
innerBooleanRenders scrollbar inside of containerfalse
thickness[String, Number]Thichness of scrollbar-
colorStringTumb color'#9d4edd'
trackColorStringScrollbar background color'#3c096c'

Slots

NameDescriptionBind
defaultContent inside scrollbale container-
thumbThing that user need to move using mouseScrollbarSlotBind
trackScrollbar backgroundScrollbarSlotBind
type ScrollbarSlotBind = {
  horizontal: boolean,
  vertical: boolean,
  placement: 'horizontal' | 'vertical',
  focused: boolean
}

Usage example

<script setup lang="ts">
import { VueCustomScrollbar } from '@m0ksem/vue-custom-scrollbar'
</script>

<template>
  <VueCustomScrollbar style="height: 500px; width: 300px" thickness="16px" right bottom left top trackColor="transparent" inner>
    <div class="test-long-thing" />

    <template #thumb="{ placement, focused }">
      <div 
        class="custom-thumb" 
        :class="{
         [`custom-thumb--${placement}`]: true,
          'custom-thumb--focused': focused 
        }"
      />
    </template>
  </VueCustomScrollbar>
</template>

<style lang="scss">
  .test-long-thing {
    background: linear-gradient(45deg, #10002b, #e0aaff);
    overflow: auto;
    resize: both;
    height: 1000px;
    width: 1000px;
  }

  .custom-thumb {
    transition: all 0.5s ease;
    &--horizontal {
      background: linear-gradient(90deg, #480ca8, #4895ef);
    }

    &--vertical {
      background: linear-gradient(0, #480ca8, #4895ef);
    }

    &--focused {
      &.custom-thumb {
        &--horizontal {
          background: linear-gradient(90deg, #c307e4, #5c5af3);
        }

        &--vertical {
          background: linear-gradient(0, #c307e4, #5c5af3);
        }
      }
    }
  }
</style>

FAQs

Package last updated on 09 Jul 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts