---
title: 'Fragments'
---

The `html!` macro accepts multiple root nodes directly. You do **not** need a
fragment wrapper (`<>...</>`) at the root:

```rust
use yew::prelude::*;

html! {
    <div></div>
    <p></p>
};
```

## Keyed fragments

The only legitimate use of fragment syntax is a **keyed** fragment.

```rust
use yew::prelude::*;

html! {
    // .. siblings ..
    <key="group-a">
        <span>{"a1"}</span>
        <span>{"a2"}</span>
    </>
    // .. siblings ..
};
```

Keyed fragments helps with reconciliation performance and node persistence in some cases.
