Skip to content

Component Spacer

MeowLynxSea edited this page Jan 24, 2026 · 4 revisions

Spacer

A flexible spacer that grows to fill remaining space.

This is equivalent to a div().flex_grow() convenience.

Example

use gpui::div;
use yororen_ui::component::{button, spacer};

let view = div()
    .flex()
    .items_center()
    .child(button().child("Left"))
    .child(spacer())
    .child(button().child("Right"));

When to use

  • Toolbars: push items to the right
  • “Left / center / right” layouts

API

  • spacer(): constructor

Defaults

  • Sets flex_grow()

Notes

  • Use inside flex() containers; it sets flex_grow().

Clone this wiki locally