ui/stack.rs
1//! The two stacks, at the system gap.
2//!
3//! SwiftUI's `HStack` and `VStack`: spacing is what you get by *not* asking for
4//! it, and a caller who needs another value chains `.gap(..)` the way
5//! `VStack(spacing: 12)` says it. The number leaves the call site rather than
6//! taking a name.
7
8use gpui::{Div, div, prelude::*, px};
9use theme::Theme;
10
11/// A row at [`Theme::SPACE`], centred across — SwiftUI's `HStack`, whose
12/// default alignment is `.center`.
13pub fn row() -> Div {
14 div().flex().flex_row().items_center().gap(px(Theme::SPACE))
15}
16
17/// A column at [`Theme::SPACE`]. SwiftUI centres a `VStack`'s children across;
18/// this does not, because flexbox stretches them and every column in the crate
19/// is built on that.
20pub fn column() -> Div {
21 div().flex().flex_col().gap(px(Theme::SPACE))
22}