Skip to content

Latest commit

 

History

History
107 lines (70 loc) · 2.26 KB

scroll-view.md

File metadata and controls

107 lines (70 loc) · 2.26 KB

ScrollView

Source

A scrollable container with a custom scrollbar that looks great on every device.

Usage

You should have the chayns-components package installed. If that is not the case already, run

yarn add chayns-components

or

npm i chayns-components

After the chayns-components package is installed, you can import the component and use it with React:

import React from 'react'
import { ScrollView } from 'chayns-components';

// ...

<ScrollView {...} />

Props

The ScrollView-component takes the following props:

Name Type Default Required
children ReactNode | Array<ReactNode>
style { [key: string]: number | string }
className string
scrollElementId string
scrollElementRef function
onScroll function

children

children?: ReactNode | Array<ReactNode>

The contents of the ScrollView.


style

style?: { [key: string]: number | string }

A React style object that will be applied to the outer-most container. Specify a height or maxHeight here.


className

className?: string

A classname string that will be applied to the outer-most container.


scrollElementId

scrollElementId?: string

A HTML id that will be applied to the scroll container.


scrollElementRef

scrollElementRef?: function

A function that receives the reference to the scroll container element as its first argument.


onScroll

onScroll?: function

The onScroll-listener for the scroll container.