A React component of Tinyscrollbar.
React Tinyscrollbar depends on React and jQuery.
Make sure Node.js is installed properly.
npm install react-tinyscrollbar --save-dev
For example, if you are building a React component as follows.
var React = require("react");
var Example = React.createClass({
render: function() {
return (
<div>{ "Some content" }</div>
);
}
});
React.render(<Example />, document.getElementById("example"));
Adding a scrollbar to the component is easy by using React Tinyscrollbar.
require("jquery");
var React = require("react");
var ReactTinyscrollbar = require("react-tinyscrollbar");
var Example = React.createClass({
render: function() {
return (
<ReactTinyscrollbar height={ 300 }>
<div>{ "Some content that needs scrollbar" }</div>
</ReactTinyscrollbar>
);
}
});
React.render(<Example />, document.getElementById("example"));
- Wrap the component with React Tinyscrollbar.
- Scrollbar appears when the content exceed the given height prop. Otherwise, the content remains its own height.
- Since Tinyscrollbar depends on jQuery, make sure it is included before using React Tinyscrollbar.
- Use
npm start
for watching files and developing. Openhttp://localhost:8080
to see an example page. - Use
npm run build
for production.
Pull requests are welcome :)
MIT