npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

leaflet-tag-filter-button

v0.0.5

Published

Adds tag filter control for marker to LeafLet

Readme

Leaflet Tag Filter Button

Adds tag filter control for layers (marker, geojson features etc.) to LeafLet. Check out the demo

Usage

Required Leaflet.EasyButton

Simple usage :

If your markers contains tags option the plugin filters them by selected tags when popup is closed For example:


var map = L.map('map');

var fastMarker = L.marker([50.5, 30.5], { tags: ['fast'] }).addTo(map); 
var slowMarker = L.marker([50.5, 30.5], { tags: ['slow'] }).addTo(map);
var bothMarker = L.marker([50.5, 30.5], { tags: ['fast', 'slow'] }).addTo(map);

L.control.tagFilterButton({
	data: ['fast', 'slow']
}).addTo( map );

Set data from external url or ajax

note: this option not implemented yet!


var map = L.map('map');
L.tagFilterButton({
	ajaxData: function(callback) {
		$.get('https://leaflet-tag-filter-button.herokuapp.com/data', function(data)) {
			callback(data);
		}
	}
}).addTo( map );

Selection complete callback


var map = L.map('map');
L.tagFilterButton({
	data: function(callback) {
		$.get('https://leaflet-tag-filter-button.herokuapp.com/data', function(data)) {
			callback(data);
		}
	},
	onSelectionComplete: function(tags) {
		console.log('selected tags are', tags);
	}
}).addTo( map );

API Docs

Options

Option | Type | Default | Description -----------------------|---------------|----------------------|---------------------------- icon | String or HTML | fa-filter | The button icon. Default is fa-filter. You can use html syntax for the icon for example <img src="/filter.png"> onSelectionComplete | Function | null | The callback function for selected tags. It fires when popup is closed and sends selected tags to the callback function as a parameter. data | Array or Function | null | The data to be used for tags popup, it can be array or function. If it's a function, the function must return tags array. clearText | String | clear | The text of the clear button filterOnEveryClick | Boolean | false | if set as true the plugin do filtering operation on every click event on the checkboxes. openPopupOnHover | Boolean | false | if set as true, the popup that contains tags will be open at mouse over time.

Methods

Method | Returns | Description --------------------------------|---------------|---------------------------- update() | void | Updates markers with last selected tags. hasFiltered() | Boolean | returns true if any tag(s) selected otherwise false. registerCustomSource(<Object> source) | throws an exception if sourcehas no name orsource.hide function is not implemented | Registers source object for filtering markers by tags. If you want to to use this function you must implement hide function
enablePruneCluster(<PruneCluster> pruneClusterInstance) | void | Searches markers for filtering on given pruneClusterInstance object resetCaches(<Boolean> update?) | void | Resets internal caches. if the update parameter sent as true, the update() function will be call after cleaning the cache. addToReleated(<TagFilterButton> tagFilterButton) | Boolean | If it required to use multiple TagFilterButtons in the same map you must link two instance of TagFilterButtons by using this method. If linking is successful returns true otherwise returns false.

Change Log

Please check the Releases page

Authors

Thanks to Contributors