---
title: "web replace · RUAL Documentation"
description: "Replaces one element of the page (a row, a card, a button) with new HTML, rendered on the server. A RUAL web block in the web actions group."
canonical: https://docs.rual.nl/block-types/web/web_replace
language: en
---

# web replace

This block is part of the [`web`](https://docs.rual.nl/block-types/web) group and was last modified in core [`v15.0.1`](https://docs.rual.nl/core-versions/150001).

Replaces one element of the page (a row, a card, a button) with new HTML, rendered on the server.

- flow

- key `value` The element's data-key: a row of web for each, or the key a web action received.

- target `value` A CSS selector instead of a key, e.g. `#cart-count`.

- html `value` required The new HTML, e.g. from web template.

- flow

Adds a browser update to the web action's answer: the element is replaced by `html` (outerHTML, so the new markup is the element itself; when it has no data-key the browser keeps the old key on it). Addressed by `key` (matches [data-key="<key>"]) or, when key is empty, `target` (a CSS selector); neither is an error that stops the flow. Only in a flow started by web_action (an error elsewhere). Updates apply in the order the blocks ran.

| `rerender row` |
| --- |
| `swap html` |
| `update row` |

[web replace](https://docs.rual.nl/block-types/web/web_replace) swaps one element for new HTML, outer tag included. Here a subscribe form stores the address with [create document](https://docs.rual.nl/block-types/storage/function_create_document_from_mutations), and the form itself is found by a CSS selector on the target pin and replaced by a thank you. To replace one row of a table, wire the key of [on web action](https://docs.rual.nl/block-types/web/web_action) into the key pin instead: target is only used when key is empty, and neither of them is an error that stops the flow.

[![Studio canvas example for the web replace block: swapping a form for a thank you.](https://docs.rual.nl/canvas-examples/web_replace.png)](https://docs.rual.nl/canvas-examples/web_replace.png?v=3)

## Used in these guides

These documentation pages use or explain this block:

- [Common Blueprint Patterns](https://docs.rual.nl/blueprints/common-patterns)

- [Escaping and Security](https://docs.rual.nl/web/security)

- [Migrating from State Pages](https://docs.rual.nl/web/migrate-from-state-pages)

- [Web Actions](https://docs.rual.nl/web/actions)

- [Example: Booking System](https://docs.rual.nl/examples/booking-system)

- [Example: E-Commerce Catalog](https://docs.rual.nl/examples/ecommerce-catalog)

- [Example: Inventory Tracker](https://docs.rual.nl/examples/inventory-tracker)

- [Example: Simple Blog](https://docs.rual.nl/examples/simple-blog)

## Version history

Introduced in [`v15.0.1`](https://docs.rual.nl/core-versions/150001).

- [`v15.0.1`](https://docs.rual.nl/core-versions/150001): block added in this release.

- [Back to `web`](https://docs.rual.nl/block-types/web): Return to the main group to view all sub-groups

- [Back to `web actions`](https://docs.rual.nl/block-types/web?group=web%20actions): Return to the group to view all blocks within this group
