Repository navigation
AdvancedMarker: custom content, anchoring, and attribute forwarding - #50
Merged
Merged
Conversation
…rding AdvancedMarker can take its DOM content from a <:content> block, forward ...attributes to that content wrapper, and shift the content with @anchorLeft/@anchorTop. A pre-built @content element still works, and a <:content> block takes precedence over it. Existing <AdvancedMarker /> usage is unchanged. Info windows attach with @target (no nested yield). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
acorncom
force-pushed
the
advanced-marker-content-anchor
branch
from
September 8, 2026 14:06
dece831 to
519ca44
Compare
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this adds
AdvancedMarkercan now render your own content and place it where you want. Three additions, all optional:<:content>block. Put your own markup inside the marker and it becomes the marker's content....attributes.class, modifiers, and other attributes on<AdvancedMarker>land on the content wrapper.@anchorLeftand@anchorTopshift the content with a CSStranslate— for example, to center a dot on the point.A pre-built
@contentelement still works. If you pass both a@contentelement and a<:content>block, the block wins.Why
Until now an advanced marker showed either the default pin or a DOM element you built yourself. If you wanted to write marker content as a template, you had to build the element by hand or keep a local wrapper component. These additions let you write the content as a normal block, style it the usual way, and anchor it where you need.
How to use it
Content from a block:
Attributes and anchoring (here, centering the content on the point):
A pre-built element (unchanged):
Does this break anything?
No. Every change is additive. Existing
<AdvancedMarker />calls behave exactly as before: the content wrapper renders only when you pass a<:content>block, and the new arguments do nothing unless you set them.Info windows
There is no nested marker yield. Attach an info window by pointing its
@targetat the marker:The upgrade guide now spells this out for anyone moving off the old
<marker.infoWindow>yield, which the deprecated bridge does not cover.Tests
test-app-basic/tests/integration/components/advanced-marker-test.gjscovers block content, forwarded attributes, the anchor transform, a pre-built@contentelement, and an info window attached to an advanced marker via@target. The existing classic-Marker@targettest covers the other marker type.Docs
docs-app/advanced-markers.md— sections on content, anchoring, and info windowsdocs-app/upgrading.md— a note that the per-marker<marker.infoWindow>yield is gone; use@target🤖 Generated with Claude Code