CookieBanner

May 28, 2018 ยท View on GitHub

React Cookie banner dismissable with just a scroll!

Props

NameTypeDefaultDescription
childrenunion(ReactChildren | Function)optional. Custom component rendered if user has not accepted cookies
messageStringoptional. Message written inside default cookie banner
onAcceptFunction"onAccept"optional. Called when user accepts cookies
linkJSX.Elementoptional. JSX element to link to your cookie-policy page
buttonMessageString"Got it"optional. Message written inside the button of the default cookie banner
cookieString"accepts-cookies"optional. Cookie-key used to save user's decision about you cookie-policy
cookieExpirationunion(Integer | {years: ?Number, days: ?Number, hours: ?Number}){ "years": 1 }optional. Used to set the cookie expiration
cookiePathStringoptional. Used to set the cookie path
dismissOnScrollBooleantrueoptional. Whether the cookie banner should be dismissed on scroll or not
dismissOnScrollThresholdNumber0optional. amount of pixel the user need to scroll to dismiss the cookie banner
closeIconStringoptional. ClassName passed to close-icon
disableStyleBooleanoptional. Pass true if you want to disable default style
stylesObject{}optional. Object with custom styles used to overwrite default ones
classNameStringoptional. Additional className for wrapper element