# fragment

Group a sequence of views without adding a host element.

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

## Construction

Use `fragment<V: View>(children: impl IntoIterator<Item = V>) -> impl View`. Import constructors and common modifiers from `refract::prelude::*`.

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

let labels = fragment(["Recent", "Saved", "Archived"].into_iter().map(text));
let column = v_stack().gap(8.0).child(labels);
```

<a id="grouping"></a>

## Grouping and identity

A fragment returns a group description. Its children participate in the surrounding composition without an extra box. Iterator items share a concrete type; use `AnyView` when heterogeneous items need type erasure.

Use keys on reorderable children to preserve their mounted identities. A fragment has no independent layout or paint box unless a modifier introduces one.

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

## View-specific reference

`fragment` has no builder-specific methods. Its children are supplied at construction. Common `ViewExt` modifiers remain available, but styling the group can add a box and change its layout relationship with the parent.

<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/mod.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`.
