Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@svelte-bin/clickoutside

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@svelte-bin/clickoutside

With the `clickoutside` action, a callback function will be fired whenever the user clicks outside of the DOM node the action is applied to.

  • 0.0.2
  • latest
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

@svelte-bin/clickoutside

With the clickoutside action, a callback function will be fired whenever the user clicks outside of the DOM node the action is applied to.

Installation

npm  i @svelte-bin/clickoutside

Usage

<script>
	import { clickoutside } from '@svelte-bin/clickoutside';
	let enabled = false;
</script>

<div
	use:clickoutside={{
		enabled,
		callback: () => {
			alert('outside clicked');
		}
	}}
>
	<button type="button" on:click={() => (enabled = !enabled)}>
		Click Outside: {enabled ? 'on' : 'off'}
	</button>
	<div>Click outside</div>
</div>

Params

ParamDescription
enabledSets the action to an enabled state if true, if false, action will not trigger
callbackThe callback to be fired once the user clicks outside of the DOM node

Definition

import type { Action } from 'svelte/action';

export interface ClickOutSideConfig {
	enabled: boolean;
	callback: (any) => unknown;
}

export interface ClickOutSideAttribute {}
export type clickoutsideAction = Action<HTMLElement, ClickOutSideConfig, ClickOutSideAttribute>;

Keywords

FAQs

Package last updated on 13 Nov 2023

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

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc