Layout · component · 6K
An integer zoom container: renders children at a fixed logical size and scales them by the largest whole number that fits, snapped so scale × devicePixelRatio stays a whole number of device pixels, with image-rendering: pixelated. Falls back to a smooth fit when even 1× does not fit.
fit="width" (default) only looks at the available width; fit="contain" also fits the height, so give the element a height. Also exports computePixelScale() and usePixelScale() for your own layouts.
pnpm dlx shadcn@latest add @s7ui/pixel-scaleThis example also uses @s7ui/icons.
Drag the bottom-right corner of the frame to resize it. The 160×100 scene below only ever grows by whole steps.
Scale: 1×