1.0.0 • Published 4 years ago

@woden/svelte-simplebar v1.0.0

Weekly downloads
2
License
MIT
Repository
github
Last release
4 years ago

svelte-simplebar

A Svelte wrapper for SimpleBar

Installation

Npm

npm install --save @woden/svelte-simplebar

Yarn

yarn add @woden/svelte-simplebar

Basic Usage

<script>
import SimpleBar from '@woden/svelte-simplebar'
</script>

<SimpleBar style="height: 200px; width: 200px">
    <p>
        Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
    </p>
</SimpleBar>

Props

NameTypeDescriptionDefault value
autoHideBooleanLorem ipsum dolor sit amettrue
scrollbarMinSizeNumberDefine the minimum scrollbar size in pixels.10
scrollbarMaxSizeNumberDefine the maximum scrollbar size in pixels.0
classNamesObjectIt is possible to change the default class names that SimpleBar uses. To get your own styles to work refer to simplebar.css to get an idea how to setup your css. For more informations{ content: 'simplebar-content', scrollContent: 'simplebar-scroll-content', scrollbar: 'simplebar-scrollbar', track: 'simplebar-track' }
forceVisibleBooleanYou can force the track to be visible (same behaviour as overflow: scroll) using the forceVisible option.false
directionStringYou can activate RTL support by passing the direction option'ltr'
timeoutNumberDefine the delay until the scrollbar hides. Has no effect if autoHide is false.1000
clickOnTrackBooleanControls the click on track behaviour.true
classStringApply one or more css class(es) on the componentnone
styleStringApply css inline styles on the componentnone

Events

NameDescription
scrollXReachStartThis event fires when scrolling reaches the start of the x-axis.
scrollXReachEndThis event fires when scrolling reaches the end of the x-axis.
scrollYReachStartThis event fires when scrolling reaches the start of the y-axis.
scrollYReachEndThis event fires when scrolling reaches the end of the y-axis.