You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: README.md
+8-5
Original file line number
Diff line number
Diff line change
@@ -6,14 +6,17 @@
6
6
</p>
7
7
<palign="center">
8
8
📍 Use a React component as <ahref="https://react-leaflet.js.org/">React Leaflet</a> markers.<br/>
9
-
🔄 Familiar swap-in API that feels like React Leaflet.<br/>
9
+
🔄 Swap-in API that feels like React Leaflet (yup, popups & tooltips too).<br/>
10
10
✨ Can use state, context etc. It's a full component. No BS.<br/>
11
-
💪 It's strongly typed.
11
+
🖼️ Powerful layout options with sensible automated defaults. Put your icon where you want.
12
+
💪 It's a strongly typed ESM package, automatically tested against a real browser.
12
13
</p>
13
14
14
15
# What is it
15
16
16
-
A tiny wrapper for [react-leaflet](https://react-leaflet.js.org/)'s `<Marker />` component that allows you to use a React component as a marker, with **working state, handlers, and access to parent contexts**.
17
+
A wrapper for [react-leaflet](https://react-leaflet.js.org/)'s `<Marker />` component that allows you to use a React component as a marker icon, with **working state, handlers, and access to parent contexts**. It also works with existing [react-leaflet](https://react-leaflet.js.org/) functionality that supplements markers, i.e. `<Popup>` and `<Tooltip>`.
18
+
19
+
It handles markers of any size (dynamically) and positioning is handled for you. If you like, you can also tune this with a sensible API that hides away Leaflet's cumbersome absolute-pixel-offsets approach. Want your icon anchored below the coordinates rather than above? No problem.
17
20
18
21
The approach this library uses differs from other approaches that use `renderToString` in that it instead uses React's [Portal](https://react.dev/reference/react-dom/createPortal) functionality to achieve the effect. That means the component is not static, but a full first-class component that can have its own state, event handlers & lifecycle.
19
22
@@ -96,7 +99,7 @@ Below is a list of properties this object can be provided.
96
99
The `layoutMode` controls how the bounding box of the React component marker behaves. It accepts two options:
97
100
98
101
-`fit-content`_(default)_. In this mode, the React component itself defines the dimensions of the marker. The component can shrink and expand at will. Logic internally to this library centers the component on its coordinates to match Leaflets default positioning; however, Leaflet itself is effectively no longer in control of this.
99
-
-`fit-parent`. In this mode, the dimensions of the React component marker are bound by the `iconSize` passed to `componentIconOpts.rootDivOpts`. Leaflet is therefore in control of the dimensions and positioning. Component markers should use elements with 100% width & height to fill the available size if needed.
102
+
-`fit-parent`. In this mode, the dimensions of the React component marker are bound by the `iconSize` passed to `componentIconOpts.manualLayoutOpts`. Leaflet is therefore in control of the dimensions and positioning. Component markers should use elements with 100% width & height to fill the available size if needed.
100
103
101
104
#### `rootDivOpts`
102
105
@@ -129,4 +132,4 @@ Can be set to `false` in order to not warn in console about cases where `compone
129
132
130
133
`true` by default.
131
134
132
-
Can be set to `false` in order to not warn in console about cases where the `layoutMode` was `fit-parent` but their was no `iconSize` defined in the `rootDivOpts`.
135
+
Can be set to `false` in order to not warn in console about cases where the `layoutMode` was `fit-parent` but their was no `iconSize` defined in the `manualLayoutOpts`.
0 commit comments