-1

I am using @react-google-maps/api library. I've integrated google map but I am facing marker label color, I tried very hard but didn't find any solution. Could someone please help me with how to resolve this issue.

import {
  Marker,
} from "@react-google-maps/api";

{markers.map(({ id, name, position }) => (
        <Marker
          key={id}
          position={position}
          onClick={() => handleActiveMarker(id)}
          label={`${id}`}
        >
          {activeMarker === id ? (
            <InfoWindow onCloseClick={() => setActiveMarker(null)}>
              <div>{name}</div>
            </InfoWindow>
          ) : null}
        </Marker>
      ))}
React Guy
  • 11
  • 5

3 Answers3

0

Try this piece of code :

label={{text:`${id}`,color:'#fff'}}

Add this label attribute in Marker tag

dlyaswanth
  • 31
  • 3
0

We can add to the MarkerLabel object key & value className

label={{text:`${id}`, className:'marker-label'}}

And then add all the necessary styles for this class

-2

Try this: label: {text: `${id}`, color: "blue"}

Maria Lind
  • 42
  • 5