Scrollable
- Install
npm install @pluralsight/ps-design-system-scrollable
- Import
import Scrollable from '@pluralsight/ps-design-system-scrollable'
Examples
Default example
To style the scrollbar simply replace your block level element with the
Scrollable
component.
import { P } from '@pluralsight/ps-design-system-text'import Scrollable from '@pluralsight/ps-design-system-scrollable'import React from 'react'const Example: React.FC = props => {return (<Scrollable style={{ height: 164, outline: '1px dashed pink' }}><P>There's not a thing in the world wrong with washing your brush. Withpractice comes confidence. Don't be afraid to make these big decisions.Once you start, they sort of just make themselves.</P><P>You can't have light without dark. You can't know happiness unlessyou've known sorrow. See. We take the corner of the brush and let itplay back-and-forth. Every day I learn. If we're gonna walk though thewoods, we need a little path. We don't need any guidelines or formats.All we need to do is just let it flow right out of us.</P><P>Let's make a nice big leafy tree. Let's go up in here, and start havingsome fun God gave you this gift of imagination. Use it. Life is tooshort to be alone, too precious. Share it with a friend.</P><P>I get carried away with this brush cleaning. What the devil. It justhappens - whether or not you worried about it or tried to plan it.Imagination is the key to painting.</P><P>Use absolutely no pressure. Just like an angel's wing. We'll put somehappy little leaves here and there. You don't have to spend all yourtime thinking about what you're doing, you just let it happen. Just letyour mind wander and enjoy. This should make you happy.</P><P>Very easy to work these to death. Just a happy little shadow that livesin there. There are no mistakes. You can fix anything that happens. Butthey're very easily killed. Clouds are delicate.</P><P>We'll throw some happy little limbs on this tree. You better get yourcoat out, this is going to be a cold painting. The only thing worse thanyellow snow is green snow.</P></Scrollable>)}export default Example
Customize content html with render prop
Instead of rendering the default div
, you can render with your own semantic markup.
import { P } from '@pluralsight/ps-design-system-text'import Scrollable from '@pluralsight/ps-design-system-scrollable'import React from 'react'const Example: React.FC = props => {return (<ScrollablerenderContent={(contentProps, contentRef) => <aside {...contentProps} ref={contentRef} />}style={{ height: 164, outline: '1px dashed pink' }}><P>There's not a thing in the world wrong with washing your brush. Withpractice comes confidence. Don't be afraid to make these big decisions.Once you start, they sort of just make themselves.</P><P>You can't have light without dark. You can't know happiness unlessyou've known sorrow. See. We take the corner of the brush and let itplay back-and-forth. Every day I learn. If we're gonna walk though thewoods, we need a little path. We don't need any guidelines or formats.All we need to do is just let it flow right out of us.</P><P>Let's make a nice big leafy tree. Let's go up in here, and start havingsome fun God gave you this gift of imagination. Use it. Life is tooshort to be alone, too precious. Share it with a friend.</P><P>I get carried away with this brush cleaning. What the devil. It justhappens - whether or not you worried about it or tried to plan it.Imagination is the key to painting.</P><P>Use absolutely no pressure. Just like an angel's wing. We'll put somehappy little leaves here and there. You don't have to spend all yourtime thinking about what you're doing, you just let it happen. Just letyour mind wander and enjoy. This should make you happy.</P><P>Very easy to work these to death. Just a happy little shadow that livesin there. There are no mistakes. You can fix anything that happens. Butthey're very easily killed. Clouds are delicate.</P><P>We'll throw some happy little limbs on this tree. You better get yourcoat out, this is going to be a cold painting. The only thing worse thanyellow snow is green snow.</P></Scrollable>)}export default Example
Props
Name | Type | Description | Default |
---|---|---|---|
renderContent | (props: { children: React.ReactNode, onScroll: React.UIEventHandler, [cssSelector: string]: '' }, ref: React.Ref) => React.ReactNode | Scrollable content render prop | Renders as a div |
children Required | React.ReactNode | Content to make scrollable |
|