How to show a fallback when data is missing
In TeleportHQ, a fallback value is what an element shows when its data is empty, for example "No description yet" when a product has no description. After you bind a field to a data source or to a list item, a small box with the placeholder fallback value appears under the binding in the right panel. Type your fallback text there and press Enter.
Before you start
- The field must already be bound to a data source, or to an item of a list (Array Mapper, CMS list or CMS item). See How to show data from a data source on your pages.
- Bindings to a state, a component setting (prop), a URL Param or a global value have no fallback box.
Steps
- On the canvas, select the bound element, for example the description text in a product card.
- In the right panel, find the bound field: it shows the name of the data it's bound to. Under it, a short line leads to a box with the placeholder fallback value.
- Click the box and type the fallback, for example
No description yet. - Press Enter, or click outside the box, to save.
When the TeleportHQ fallback shows
On your published site, the fallback replaces a value that is missing, empty, 0 or false. So a product with a price of 0 shows the fallback too: pick a fallback that also fits that case, or don't use one on number fields where 0 is a real value.
Check that it worked
Preview an item whose field is empty. For a list, find a card for an item with no description; for a details page, pick that item with the item button at the top left of the canvas. The element shows your fallback text instead of an empty space. Publish to check the live site.
Fallback ideas
- A product without a short description:
Description coming soon - A team member without a photo: bind the image, then type the address of a default avatar picture as the fallback
- An event without a location:
Online
Troubleshooting
I don't see the fallback value box The field is bound to a state, a prop, a URL Param or a global value, or it isn't bound at all. Fallbacks only appear for bindings to a data source or a list item.
The editor shows an empty space, but my live site shows the fallback For a field bound straight to a data source (not through a list item), the editor canvas only uses the fallback when the value is missing, not when it's an empty text. Your published site uses it in both cases.
Good to know
- For whole lists with no items, design the list's empty state instead. See How to design loading, empty and error states.
- To hide an element completely when its data is missing, use a condition instead. See How to show or hide elements based on a condition.