# @m0ksem/vue-custom-scrollbar

> Custom scrollbar for vue3.

Latest version **0.0.7** (published 2022-07-09) · 0 weekly downloads

## Install

```sh
npm install @m0ksem/vue-custom-scrollbar
pnpm add @m0ksem/vue-custom-scrollbar
yarn add @m0ksem/vue-custom-scrollbar
bun add @m0ksem/vue-custom-scrollbar
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities.

Warnings: low downloads; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.7 |
| Published | 2022-07-09 |
| First published | 2022-04-13 |
| Weekly downloads | 0 |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 47.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | m0ksem |

## Links

- npm: https://www.npmjs.com/package/@m0ksem/vue-custom-scrollbar
- npm.io page: https://npm.io/package/@m0ksem/vue-custom-scrollbar

## Recent versions

- 0.0.7 (latest) — 2022-07-09
- 0.0.2-alpha.0 (next) — 2022-04-20
- 0.0.5 — 2022-06-04
- 0.0.4 — 2022-06-04
- 0.0.3 — 2022-06-04
- 0.0.2 — 2022-06-02
- 0.0.1 — 2022-04-13
- 0.0.1-alpha3 — 2022-04-13
- 0.0.1-alpha2 — 2022-04-13
- 0.0.1-alpha1 — 2022-04-13

## README

# Vue custom scrollbar

Custom scrollbar for vue3.

## Instalation

```sh
yarn add @m0ksem/vue-custom-scrollbar
```

```ts
// 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
| Name | Type | Description | Default | 
| ---- | ---- | ----------- | ------- | 
| top |  Boolean | Renders top scrollbar |  false|
| left |  Boolean | Renders left scrollbar |  false |
| bottom |  Boolean | Renders bottom scrollbar |  false |
| right |  Boolean | Renders right scrollbar |  false |
| inner |  Boolean | Renders scrollbar inside of container |  false |
| thickness |  [String, Number] | Thichness of scrollbar | - |
| color |  String | Tumb color |  '#9d4edd' |
| trackColor |  String | Scrollbar background color |  '#3c096c'|

### Slots
| Name | Description | Bind |
| ---- | ----------- | ---- |
| default | Content inside scrollbale container | - | 
| thumb | Thing that user need to move using mouse | `ScrollbarSlotBind` |
| track | Scrollbar background | `ScrollbarSlotBind` |

```ts
type ScrollbarSlotBind = {
  horizontal: boolean,
  vertical: boolean,
  placement: 'horizontal' | 'vertical',
  focused: boolean
}
```

## Usage example

```vue
<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>
```

---
_Source: https://npm.io/package/@m0ksem/vue-custom-scrollbar · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
