Aspect Ratio Picker

Pick an output shape as the API spells it. Each option draws its frame, so the choice reads at a glance.

Auto21:92:116:93:27:54:35:41:14:53:45:72:39:161:29:21

In use

In the Playground's settings, its options following the picked model. The trigger draws its frame. The Image Edit Studio's Expand uses it to shape the canvas.

Lumen
CreateEditVideo
240 credits

Your image will appear here

Your image will appear here

Your image will appear here

Your image will appear here

16 credits

Installation

pnpm dlx shadcn@latest add https://mgp.paukraft.com/r/aspect-ratio-picker.json

AspectRatioPicker

A radio group: arrow keys move between options. Also takes Base UI's RadioGroup props, like disabled and name for forms.

PropTypeDefault
valueAspectRatio // "16:9" | "auto" | …

The selected ratio, as the API's aspect_ratio takes it.

—
onValueChange(value: AspectRatio) => void

Called with the new ratio.

—
ratiosreadonly AspectRatio[]

Options, in order. Presets: flux3Image, flux3Video and kontext.

ASPECT_RATIOS.flux3Image
childrenReactNode

Your own AspectRatioPickerItem layout, replacing the generated one.

—

Helpers

PropTypeDefault
toDimensions(ratio, { area?, multiple? }) => { width, height }

Pixel size at about area pixels, sides a multiple of multiple. For models sized by width and height, like FLUX.2.

1024², 16
parseAspectRatio(ratio) => number | undefined

Width over height; undefined for "auto".

—
AspectRatioShape{ ratio }

The frame alone, e.g. for a trigger showing the choice.

—