From efc6b0ce70f1a95297be20c2e66804c88feca32e Mon Sep 17 00:00:00 2001 From: Sebastian Kootz <63540046+Skxxtz@users.noreply.github.com> Date: Thu, 12 Mar 2026 12:36:45 +0100 Subject: [PATCH] gpui: Add `aspect-ratio` builder method to `Styled` (#48751) # Summary This PR simply adds the missing `aspect_ratio` and `aspect_square` helper functions to the `Styled` trait. Release Notes: - N/A Co-authored-by: MrSubidubi --- crates/gpui/src/styled.rs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/crates/gpui/src/styled.rs b/crates/gpui/src/styled.rs index 3d0b86a9523f5ac05e51941c826e32379368c464..f83e9103572b9b708ef4b9a8f99bf73244be71a4 100644 --- a/crates/gpui/src/styled.rs +++ b/crates/gpui/src/styled.rs @@ -384,6 +384,20 @@ pub trait Styled: Sized { self } + /// Sets the aspect ratio of the element. + /// [Docs](https://tailwindcss.com/docs/aspect-ratio) + fn aspect_ratio(mut self, ratio: f32) -> Self { + self.style().aspect_ratio = Some(ratio); + self + } + + /// Sets the aspect ratio of the element to 1/1 – equal width and height. + /// [Docs](https://tailwindcss.com/docs/aspect-ratio) + fn aspect_square(mut self) -> Self { + self.style().aspect_ratio = Some(1.0); + self + } + /// Sets the background color of the element. fn bg(mut self, fill: F) -> Self where