Open this example in the interactive library
Live preview
Source code
// components/HemisphereCoordinateLabel.tsx
export default function HemisphereCoordinateLabel({
lat = 43.65,
lon = -79.38,
}: { lat?: number; lon?: number } = {}) {
return (
<output>
{Math.abs(lat)}° {lat >= 0 ? "N" : "S"}, {Math.abs(lon)}° {lon >= 0 ? "E" : "W"}
</output>
);
}
