From 40468ed651bacec6492726c94fe8125a1ca02927 Mon Sep 17 00:00:00 2001 From: Danilo Leal <67129314+danilo-leal@users.noreply.github.com> Date: Tue, 27 Jan 2026 15:37:22 -0300 Subject: [PATCH] gpui: Add `min_size` and `max_size` style methods (#47775) The same way you can use `size` when width and height have the same value, it should also be possible to write `min_size` and `max_size`. This PR adds these two methods, which are also supported in Tailwind (but not documented in v4, surprisingly!). Release Notes: - N/A --- crates/gpui_macros/src/styles.rs | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/crates/gpui_macros/src/styles.rs b/crates/gpui_macros/src/styles.rs index 36d46cfb515d4e2782296edd132f06449c6281f5..133c9fdebec06bc995f5361ccf2c57f33cb11fd3 100644 --- a/crates/gpui_macros/src/styles.rs +++ b/crates/gpui_macros/src/styles.rs @@ -915,8 +915,12 @@ fn box_prefixes() -> Vec { fields: vec![quote! {size.width}, quote! {size.height}], doc_string_prefix: "Sets the width and height of the element.", }, - // TODO: These don't use the same size ramp as the others - // see https://tailwindcss.com/docs/max-width + BoxStylePrefix { + prefix: "min_size", + auto_allowed: true, + fields: vec![quote! {min_size.width}, quote! {min_size.height}], + doc_string_prefix: "Sets the minimum width and height of the element.", + }, BoxStylePrefix { prefix: "min_w", auto_allowed: true, @@ -931,6 +935,12 @@ fn box_prefixes() -> Vec { fields: vec![quote! { min_size.height }], doc_string_prefix: "Sets the minimum height of the element. [Docs](https://tailwindcss.com/docs/min-height)", }, + BoxStylePrefix { + prefix: "max_size", + auto_allowed: true, + fields: vec![quote! {max_size.width}, quote! {max_size.height}], + doc_string_prefix: "Sets the maximum width and height of the element.", + }, // TODO: These don't use the same size ramp as the others // see https://tailwindcss.com/docs/max-width BoxStylePrefix {