These modifiers control how a component sizes itself in response to its content and the space its parent offers.Documentation Index
Fetch the complete documentation index at: https://docs.metabind.ai/llms.txt
Use this file to discover all available pages before exploring further.
aspectRatio constrains the width-to-height ratio. scaledToFit and scaledToFill are shorthands for the two common content modes — fit inside the frame (letterbox) or fill the frame (crop).
fixedSize opts a component out of the parent’s size proposal entirely, using the component’s ideal size instead. Useful for preventing text wrapping or letting a component report its intrinsic dimensions to its container.
aspectRatio
Sets the aspect ratio for a component’s content, controlling how it fits or fills the available space.The width-to-height ratio (e.g.,
1.0 for square, 16/9 for widescreen). Omit to use the content’s intrinsic aspect ratio.How the content fills the frame:
"fit"— scales to fit within the frame, preserving aspect ratio (may letterbox)"fill"— scales to fill the frame, preserving aspect ratio (may crop)
scaledToFit
Scales content to fit within the frame, preserving aspect ratio. May letterbox.scaledToFill
Scales content to fill the frame, preserving aspect ratio. May crop..clipped().
scaledToFill ensures no empty space within the frame but may crop content. Use scaledToFit when you need to see the entire content.
fixedSize
Prevents a component from resizing along specified axes, using its ideal size instead.fixedSize tells the layout system to use the component’s ideal (intrinsic) size along the specified axes, rather than the size proposed by the parent. This is useful when a parent container would otherwise compress or expand the component. For Text, this prevents line wrapping on the horizontal axis.
Prevent text from wrapping
See also
- frame — sets fixed or flexible size constraints
- layoutPriority — controls space distribution among siblings
- clipped — clips content that extends past the frame
- Image —
.resizable()is required for image scaling modifiers