You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
docs: documents block field image aspect ratio (#14679)
Fixes#13536 Includes: - adds detailed explanation of aspect ratio container for block field images - provides code example with proper imageURL and imageAltText usage
|**`slug`**\*| Identifier for this block type. Will be saved on each block as the `blockType` property. |
154
-
|**`fields`**\*| Array of fields to be stored in this block. |
155
-
|**`labels`**| Customize the block labels that appear in the Admin dashboard. Auto-generated from slug if not defined. Alternatively you can use `admin.components.Label` for greater control. |
156
-
|**`imageURL`**| Provide a custom image thumbnail to help editors identify this block in the Admin UI. |
157
-
|**`imageAltText`**| Customize this block's image thumbnail alt text. |
158
-
|**`interfaceName`**| Create a top level, reusable [Typescript interface](/docs/typescript/generating-types#custom-field-interfaces) & [GraphQL type](/docs/graphql/graphql-schema#custom-field-schemas). |
159
-
|**`graphQL.singularName`**| Text to use for the GraphQL schema name. Auto-generated from slug if not defined. NOTE: this is set for deprecation, prefer `interfaceName`. |
160
-
|**`dbName`**| Custom table name for this block type when using SQL Database Adapter ([Postgres](/docs/database/postgres)). Auto-generated from slug if not defined. |
161
-
|**`custom`**| Extension point for adding custom data (e.g. for plugins) |
|**`slug`**\*| Identifier for this block type. Will be saved on each block as the `blockType` property. |
154
+
|**`fields`**\*| Array of fields to be stored in this block. |
155
+
|**`labels`**| Customize the block labels that appear in the Admin dashboard. Auto-generated from slug if not defined. Alternatively you can use `admin.components.Label` for greater control. |
156
+
|**`imageURL`**| Provide a custom image thumbnail URL to help editors identify this block in the Admin UI. The image will be displayed in a 3:2 aspect ratio container and cropped using `object-fit: cover` if needed. [More details](#block-image-guidelines). |
157
+
|**`imageAltText`**| Customize this block's image thumbnail alt text. |
158
+
|**`interfaceName`**| Create a top level, reusable [Typescript interface](/docs/typescript/generating-types#custom-field-interfaces) & [GraphQL type](/docs/graphql/graphql-schema#custom-field-schemas). |
159
+
|**`graphQL.singularName`**| Text to use for the GraphQL schema name. Auto-generated from slug if not defined. NOTE: this is set for deprecation, prefer `interfaceName`. |
160
+
|**`dbName`**| Custom table name for this block type when using SQL Database Adapter ([Postgres](/docs/database/postgres)). Auto-generated from slug if not defined. |
161
+
|**`custom`**| Extension point for adding custom data (e.g. for plugins) |
162
+
163
+
_\* An asterisk denotes that a property is required._
164
+
165
+
### Block Image Guidelines
166
+
167
+
When providing a custom thumbnail via `imageURL`, it's important to understand how images are displayed in the Admin UI to ensure they look correct.
168
+
169
+
**Aspect Ratio and Cropping**:
170
+
171
+
- The image container uses a **3:2 aspect ratio** (e.g., 480x320 pixels)
172
+
- Images are scaled using `object-fit: cover`, which means:
173
+
- Images that don't match 3:2 will be **cropped** to fill the container
174
+
- The image maintains its aspect ratio while being scaled
175
+
- Cropping is centered, removing edges as needed
176
+
177
+
**Display Contexts**:
178
+
179
+
1.**Block Selection Drawer**: Images appear as thumbnails in a responsive grid when editors add blocks
180
+
2.**Lexical Editor**: Images are scaled down to 20x20px icons in menus and toolbars
181
+
182
+
**Recommendations**:
183
+
184
+
- Use images with a **3:2 aspect ratio** to avoid unwanted cropping (e.g., 480x320, 600x400, 900x600)
185
+
- Keep important visual content **centered** in your image, as edges may be cropped
186
+
- Provide web-optimized images (JPEG, PNG, WebP) for faster loading
0 commit comments