From a80addff9648f188bfa89450473206016fca41e5 Mon Sep 17 00:00:00 2001 From: Simon Hamp Date: Fri, 23 Oct 2026 13:25:47 +0100 Subject: [PATCH 1/2] Document image fit names and how each fit draws The image page said fit modes 0/1 and 2/3 each draw the same way, which was only ever true on iOS and stopped being true with mobile-ui#153. Describe the four fits as they draw now on both platforms, the names and ImageFit cases fit takes from 4.7 (mobile-air#572), and that an image with a width and no height sizes from its aspect ratio. The examples use the names. Co-Authored-By: Claude Opus 5.5 --- .../docs/mobile/4/edge-components/image.md | 34 ++++++++++++------- 1 file changed, 22 insertions(+), 12 deletions(-) diff --git a/resources/views/docs/mobile/4/edge-components/image.md b/resources/views/docs/mobile/4/edge-components/image.md index 86271d97c..bd9a354b4 100644 --- a/resources/views/docs/mobile/4/edge-components/image.md +++ b/resources/views/docs/mobile/4/edge-components/image.md @@ -13,7 +13,7 @@ Displays an image from a URL. Loaded asynchronously by the native platform — ` src="https://picsum.photos/seed/nativephp/400/300" :width="200" :height="150" - :fit="2" + fit="cover" class="rounded-xl" /> ``` @@ -24,17 +24,25 @@ Displays an image from a URL. Loaded asynchronously by the native platform — ` All [shared layout and style attributes](layout) are supported, plus: - `src` - Image URL (required, string) -- `fit` - Content fit mode (optional, int, default: `1`): - - `0` / `1` — fit (scale to fit within bounds, preserving aspect ratio) - - `2` / `3` — fill (scale to fill bounds, cropping excess) +- `fit` - How the image fills its frame, following CSS `object-fit`. + Takes `none`, `contain`, `cover` or `fill`, an `ImageFit` case, or the integer `0`/`1`/`2`/`3` (optional, + default: `contain`): + - `none` (`0`) - Draws the image at its own size, one image pixel per point on iOS or per dp on Android, + centered and cropped to the frame + - `contain` (`1`) - Scales the image to fit inside the frame, keeping its aspect ratio, and centers it + - `cover` (`2`) - Scales the image to fill the frame, keeping its aspect ratio, centered and cropped + - `fill` (`3`) - Stretches the image to the frame's exact width and height, ignoring its aspect ratio - `tint-color` - Apply a color tint as hex string (optional) - `alt` - Accessibility alt text (optional). When set, screen readers announce the image with this label; when omitted, the image is treated as decorative and hidden from VoiceOver/TalkBack. See [Accessibility](../digging-deeper/accessibility)