Skip to Content
APIMapInterface: PaddingOptions

Interface: PaddingOptions

Interface defining padding options for fitBounds operations. All fields are optional - only specify the edges you need padding for. Unspecified edges default to 0.

Example

// Only pad left and top (for a modal in the top-left corner) map.fitCoordinates(coords, { padding: { left: "30%", // 30% of container width top: "40%", // 40% of container height }, }) // Mixed units map.fitCoordinates(coords, { padding: { top: 100, // 100 pixels left: "25%", // 25% of container width bottom: "5vh", // 5% of viewport height }, })

Properties

bottom?

optional bottom: PaddingValue;

Padding for the bottom edge of the viewport. Can be a number (pixels) or string with unit (%, vh, vw, px).


left?

optional left: PaddingValue;

Padding for the left edge of the viewport. Can be a number (pixels) or string with unit (%, vh, vw, px).


optional right: PaddingValue;

Padding for the right edge of the viewport. Can be a number (pixels) or string with unit (%, vh, vw, px).


top?

optional top: PaddingValue;

Padding for the top edge of the viewport. Can be a number (pixels) or string with unit (%, vh, vw, px).

Last updated on