From e474478bd3aaf5e5d58e7850ce86040be4589a02 Mon Sep 17 00:00:00 2001 From: Sebastian Balanta Date: Thu, 28 May 2026 20:13:42 -0500 Subject: [PATCH 1/2] docs: add DivIcon text label example to icons guide --- docs/user_guide/ui_elements/icons.md | 30 ++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/docs/user_guide/ui_elements/icons.md b/docs/user_guide/ui_elements/icons.md index f5024772c1..9ab66b7ed5 100644 --- a/docs/user_guide/ui_elements/icons.md +++ b/docs/user_guide/ui_elements/icons.md @@ -54,3 +54,33 @@ folium.Marker( m ``` + +## Text labels with DivIcon + +`DivIcon` allows you to add text directly on the map using an HTML `div` element. +This is useful when you want a visible label at a specific location, without +relying on tooltips or popups that only appear on interaction. + +```{code-cell} ipython3 +m = folium.Map(location=[41, -71], zoom_start=6) + +folium.Marker( + location=[41, -71], + icon=folium.DivIcon( + html='
New York
', + icon_size=(100, 36), + icon_anchor=(50, 18), + ), +).add_to(m) + +folium.Marker( + location=[42.36, -71.06], + icon=folium.DivIcon( + html='
Boston
', + icon_size=(80, 30), + icon_anchor=(40, 15), + ), +).add_to(m) + +m +``` \ No newline at end of file From ac15174a15900e06b806e3f7cde1b78effe085ea Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 1 Jun 2026 18:45:46 +0000 Subject: [PATCH 2/2] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- docs/user_guide/ui_elements/icons.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/user_guide/ui_elements/icons.md b/docs/user_guide/ui_elements/icons.md index 9ab66b7ed5..edd8461da0 100644 --- a/docs/user_guide/ui_elements/icons.md +++ b/docs/user_guide/ui_elements/icons.md @@ -83,4 +83,4 @@ folium.Marker( ).add_to(m) m -``` \ No newline at end of file +```