Drop content anywhere on the page.
npm install react-tether-seb
React wrapper around Tether from Hub Spot.
npm install react-tether --save
bower install react-tether --save
``javascript
import TetherComponent from 'react-tether'
class SimpleDemo extends React.Component {
constructor(props) {
super(props)
this.state = {
isOpen: false
}
}
render() {
const { isOpen } = this.state
return(
constraints={[{
to: 'scrollParent',
attachment: 'together'
}]}
>
{ / First child: This is what the item will be tethered to / }
{ / Second child: If present, this item will be tethered to the the first child / }
{
isOpen &&
A paragraph to accompany the title.
Props
####
children: PropTypes.node.isRequired (2 Max)The first child is used as the Tether's
target and the second child (which is optional) is used as Tether's element that will be moved.####
renderElementTag: PropTypes.stringThe tag that is used to render the Tether element, defaults to
div.####
renderElementTo: PropTypes.stringWhere in the DOM the Tether element is appended. Passes in any valid selector to
document.querySelector. Defaults to document.body.####
Tether Options:Any valid Tether options.
Run Example
clone repo
git clone git@github.com:souporserious/react-tether.gitmove into folder
cd ~/react-tetherinstall dependencies
npm installrun dev mode
npm run devopen your browser and visit:
http://localhost:8080/`