How to access the current anchor in CSUI

Would it be possible to get current anchor inside the content component? Like if I'm mounting to multiple anchors and the logic needs to get input from a child element of that specific element @Jenya : https://discord.com/channels/946290204443025438/946290204904390690/1057702630404653057
5 Replies
lab
labOP•3y ago
The anchor is passed down as a child props of the CSUI. You may access it like this:
const OverlayStuff = ({ anchor }) => ...

export default OverlayStuff
const OverlayStuff = ({ anchor }) => ...

export default OverlayStuff
jenya
jenya•3y ago
Ty
YAGPDB.xyz
YAGPDB.xyz•3y ago
Gave +1 Rep to @louis
jenya
jenya•3y ago
And it's just a regular element right?
lab
labOP•3y ago
there's a type to it you can use FC<PlasmoCSUIProps> (FC from react, PlasmoCSUIProps from plasmo) for the typing anchor has this type:
export type PlasmoCSUIAnchor = {
element: Element
type: "overlay" | "inline"
}
export type PlasmoCSUIAnchor = {
element: Element
type: "overlay" | "inline"
}

Did you find this page helpful?