# spacer

Consume remaining space inside a row or column.

<a id="construction"></a>

## Construction

Use `spacer() -> Spacer`. Import constructors and common modifiers from `refract::prelude::*`.

```rust
use refract::prelude::*;

let toolbar = h_stack()
    .alignment(Alignment::Center)
    .child(text("Library"))
    .child(spacer())
    .child(text("12 items"))
    .fill_width();
```

<a id="available-space"></a>

## Available space

`spacer` creates an empty box with a grow factor of 1. Place it directly in a row or column with available space. Multiple growing children share that space according to their grow factors.

A spacer does not establish the size of its parent. Use a bounded container or `fill_width`/`fill_height` when the parent offers space.

<a id="view-specific-reference"></a>

## View-specific reference

`spacer` returns `Spacer`, an empty element with shared style modifiers and no child or stack layout methods. Shared `grow` can change its relative growth factor. `padding` and `frame` introduce wrappers, so apply growth to the element that participates directly in the parent layout.

<a id="common-modifiers"></a>

## Common view modifiers

Dimensions, paint, labels, and disabled state preserve each concrete builder type, so their builder methods can be interleaved. `padding` and `frame` return wrappers; configure the inner element before adding those. `ViewExt` supplies the shared API for composed views.

See [View Modifiers](/docs/view-modifiers) for shared methods and modifier ordering. Focus bindings and callbacks preserve concrete builders; see [focus modifiers](/docs/view-modifiers#focus) and [Input & Focus](/docs/input-focus) for requests, observation, and indicators.

<a id="source"></a>

## Source reference

The implementation is in `crates/core/src/view/primitives.rs`. Primitive and layout builders are in `crates/core/src/view/primitives.rs`. Shared modifiers are in `crates/core/src/view/modifiers.rs`. Style values and validation are in `crates/core/src/style.rs`.
