React-leaflet: Controls Position

Created on 16 Oct 2015  路  8Comments  路  Source: PaulLeCam/react-leaflet

Hey

How can I change the position of the controls on the map element?
Currently the zoom buttons are at the top left, is there a way to change it?

Thanks

required feature

All 8 comments

Hi,

This is purely Leaflet behavior, as per their documentation, it is possible to hide it but not set its position directly in the map properties.

I think you best option is to hide it from the map, <Map zoomControl={false} ...> should work but please let me know if it doesn't, and add the zoom control to the map yourself, as this library does not provide components for controls.

Hey

I'll try this asap, thing is I used a hack :p
I saw that it had the .left class, so I did something like

.left {
    right: 0!important; 
}

But this is probably better, thanks!

There is controls position option: http://leafletjs.com/reference.html#control-positions

Did it appear recently or I misunderstand smth?

As I wrote in my previous message, it's possible to set this in the control options, not the map ones.

Hi,

The ZoomControl as been added to v0.9.

Hey @PaulLeCam thank you very much!

hi @PaulLeCam i've disabled the zoom control with zoomControl={false} as above added a <ZoomControl> component with position. it works as i expect, but I don't see the zoomControl prop in the https://react-leaflet.js.org/docs/en/components.html#map docs.

How can i set position other than topright, topleft, bottomleft, bottomright??

Was this page helpful?
0 / 5 - 0 ratings

Related issues

gane5h picture gane5h  路  3Comments

rolfdalhaug picture rolfdalhaug  路  3Comments

ekatzenstein picture ekatzenstein  路  4Comments

kojoa picture kojoa  路  3Comments

fborghi picture fborghi  路  3Comments