
Grab your gear: The official Sanity swag store
Read Grab your gear: The official Sanity swag storeNot a dumb question at all! The hotspot feature is super useful but the CSS implementation isn't always obvious.
When Sanity stores hotspot data, it gives you x and y values between 0 and 1 (representing 0-100% from the left/top edges). The key CSS attributes to use are:
<img> tags or Next.js Image components:Use object-position along with object-fit: cover:
function getPositionFromHotspot(hotspot) {
if (!hotspot?.x || !hotspot?.y) return "center";
return `${hotspot.x * 100}% ${hotspot.y * 100}%`;
}
// Usage
<img
src={imageUrl}
style={{
objectFit: 'cover',
objectPosition: getPositionFromHotspot(image.hotspot)
}}
/>
// Or with Next.js Image
<Image
src={imageUrl}
fill
style={{
objectFit: 'cover',
objectPosition: getPositionFromHotspot(image.hotspot)
}}
/>Use background-position along with background-size: cover:
<div style={{
backgroundImage: `url(${imageUrl})`,
backgroundSize: 'cover',
backgroundPosition: `${hotspot.x * 100}% ${hotspot.y * 100}%`
}} />hotspot.x: 0.5 → CSS: 50% (horizontal center)hotspot.y: 0.3 → CSS: 30% (30% from top)The Sanity image hotspot documentation covers enabling hotspot in your schema, and there's a helpful community answer about using hotspot with Next.js that shows this CSS approach is often necessary because the Image URL Builder doesn't always automatically apply hotspot positioning in all frameworks.
Sanity is the developer-first content operating system that gives you complete control. Schema-as-code, GROQ queries, and real-time APIs mean no more workarounds or waiting for deployments. Free to start, scale as you grow.
Content operations
Content backend


The only platform powering content operations
By Industry


Tecovas strengthens their customer connections
Build and Share

Grab your gear: The official Sanity swag store
Read Grab your gear: The official Sanity swag store