Skip to content

Commit 5967a29

Browse files
committed
example update;
1 parent f849892 commit 5967a29

File tree

1 file changed

+52
-9
lines changed

1 file changed

+52
-9
lines changed

docs/CUSTOMISATION.md

Lines changed: 52 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,61 @@ By default component generates next structure:
1111

1212
Each of them (excepting holder) can be replaced by passing renderer function.
1313
4ex: if you want to change the default className or tagName of elements or add extra markup.
14+
>**IMPORTANT:**
15+
Renderer will receive **elementRef** function that expect the element ref as first parameter.
16+
Furthermore you have to pass the styles, cause they needed to proper component work.
17+
1418
```javascript
1519
<Scrollbar
16-
wrapperRenderer={props=> <span {...props} className="MyAwesomeWrapper"/>}
17-
contentRenderer={props=> <span {...props} className="MyAwesomeContent"/>}
18-
trackXRenderer={props=> <span {...props} className="MyAwesomeTrackVertical"/>}
19-
trackYRenderer={props=> <span {...props} className="MyAwesomeTrackHorizontal"/>}
20-
thumbXRenderer={props=> <span {...props} className="MyAwesomeThumbVertical"/>}
21-
thumbYRenderer={props=> <span {...props} className="MyAwesomeThumbHorizontal"/>}/>
20+
wrapperRenderer={
21+
props =>{
22+
const {elementRef, ...restProps} = props;
23+
return <span {...restProps}
24+
className="MyAwesomeWrapper"
25+
ref={elementRef}/>
26+
}
27+
}
28+
contentRenderer={
29+
props =>{
30+
const {elementRef, ...restProps} = props;
31+
return <span {...restProps}
32+
className="MyAwesomeContent"
33+
ref={elementRef}/>
34+
}
35+
}
36+
trackXRenderer={
37+
props => {
38+
const {elementRef, ...restProps} = props;
39+
return <span {...restProps}
40+
className="MyAwesomeTrackVertical"
41+
ref={elementRef}/>
42+
}
43+
}
44+
trackYRenderer={
45+
props => {
46+
const {elementRef, ...restProps} = props;
47+
return <span {...restProps}
48+
className="MyAwesomeTrackHorizontal"
49+
ref={elementRef}/>
50+
}
51+
}
52+
thumbXRenderer={
53+
props => {
54+
const {elementRef, ...restProps} = props;
55+
return <span {...restProps}
56+
className="MyAwesomeThumbVertical"
57+
ref={elementRef}/>
58+
}
59+
}
60+
thumbYRenderer={
61+
props => {
62+
const {elementRef, ...restProps} = props;
63+
return <span {...restProps}
64+
className="MyAwesomeThumbHorizontal"
65+
ref={elementRef}/>
66+
}
67+
}/>
2268
```
23-
>**IMPORTANT:**
24-
Renderer will receive elementRef function that expect the element ref as first parameter.
25-
Furthermore you have to pass the styles, cause they needed to proper component work.
2669

2770
### Component controls
2871
Component provides scrolling control methods, a list of which you can find in the [API Documentation](./../API.md)

0 commit comments

Comments
 (0)