Socket
Book a DemoInstallSign in
Socket

alpinejs-cookie-banner

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install
Package was removed
Sorry, it seems this package was removed from the registry

alpinejs-cookie-banner

Alpine JS plugin that adds simple cookie banner functionality

1.0.0
unpublished
latest
npmnpm
Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

Alpine JS directive that adds simple cookie banner functionality.

Example 👀

<div x-data x-cookie-banner>
  We use cookies <a href="#">click here</a> to find out more.

  <button> Got it </button>
</div>

It works by listening for a click even on a <button> element which when clicked will hide the cookie banner.

This is a basic example that uses the default localStorage option. If you want to use sessionStorage then you'd write x-cookie-banner.session

You can pass any HTML you want, but make sure you do pass a <button> or there's no way for the user to close the cookie banner.

Install 🌟

It's very easy to install Alpine JS plugins! 🙌

CDN

<script
  defer
  src="https://unpkg.com/alpinejs-cookie-banner@latest/dist/cookie.min.js"
></script>

<script
  defer
  src="https://unpkg.com/@alpinejs/persist@3.x.x/dist/cdn.min.js"
></script>

<script defer src="https://unpkg.com/alpinejs@3.x.x/dist/cdn.min.js"></script>

NPM/Yarn

npm i -D alpinejs-cookie-banner

yarn add -D alpinejs-cookie-banner

Then you can register the plugin.

import Alpine from 'alpinejs';
import cookie from 'alpinejs-cookie-banner';

Alpine.plugin(cookie);

window.Alpine = Alpine;

Alpine.start();

Stats 📊

Here's some stats about the Alpine JS Persist Extended package! As you can see, it's tiny 🤏

Keywords

Alpine

FAQs

Package last updated on 13 Jul 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.