1.0.10 • Published 8 months ago

leaflet-cascade-buttons v1.0.10

Weekly downloads
-
License
MIT
Repository
github
Last release
8 months ago

L.cascadeButtons

A leaflet plugin to create cascade buttons.

image

DEMO


Requirements

Install

NPM

npm i leaflet-cascade-buttons

Usage Example

Easy way to implements buttons with cascade subgroup buttons where each one can have it functionality.

new L.cascadeButtons([
    {icon: 'fas fa-home', ignoreActiveState:true , command: () =>{console.log('test') }},
    {icon: 'fas fa-home', items:[
        {icon: 'fas fa-home', command: () =>{console.log('hola')}},
        {icon: 'fas fa-home', command: () =>{console.log('hola')}},
        {icon: 'fas fa-globe', command: () =>{console.log('hola')}},
    ]},
    {icon: 'fas fa-home', items: [
        {icon: 'fas fa-home', command: () =>{console.log('hola')}},
        {icon: 'fas fa-globe', command: () =>{console.log('hola')}},
    ]},
], {position:'topright', direction:'horizontal'}).addTo(map);

L.cascadeButtons receives two arguments:

Parent properties

PropertyTypeDefaultDescription
iconStringnullIcon class of Font Icon
ignoreActiveStateBooleanfalseFlag boolean to ignore clicked button style
commandFunctionnull or (expand or collapse if button has childs)Function to execute when button is clicked
itemsChild properties[]nullArray of child properties

Child properties

PropertyTypeDefaultDescription
iconStringnullIcon class of Font Icon
commandFunctionnull or (expand or collapse if button has childs)Function to execute when button is clicked

Options

OptionTypeDefaultDescription
positionString'bottomright'Position of the control. Options: leaflet control positions
directionString'horizontal'Stacked direction. Options: 'Vertical' and 'Horizontal'
classNameString''className to customize control

Font Icons

Can be used with any font icon / custom library like:

1.0.10

8 months ago

1.0.9

2 years ago

1.0.8

2 years ago

1.0.7

2 years ago

1.0.6

2 years ago

1.0.5

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago