expression | pipeName, where the pipe receives the evaluated expression as input and produces a formatted output. Some pipes accept an argument after a colon — | pipeName:arg:
price * quantity | currency means “multiply, then format” — not “format quantity, then multiply.”
Number Formatting
Numbers rarely belong in a UI raw. Prices need currency symbols and decimal alignment, ratios need percent signs, and KPIs need thousands separators. The number pipes handle locale-aware formatting so your expressions produce display-ready values:| Pipe | Argument | Example | Result |
|---|---|---|---|
percent | decimal places (default 0) | {{ 0.756 | percent:1 }} | 75.6% |
number | decimal places | {{ 1234 | number:2 }} | 1,234.00 |
currency | currency code (default USD) | {{ 1234 | currency }} | $1,234.00 |
abs | {{ -42 | abs }} | 42 |
percent multiplies by 100 before formatting. number and currency use locale-formatted output (en-US).
Date and Time
Dates arrive from APIs as ISO strings — dense and machine-oriented. The date and time pipes transform them into human-friendly formats at varying levels of detail, from a terse1/15/2025 to a full January 15, 2025, 2:30 PM:
| Pipe | Argument | Example Output |
|---|---|---|
date | short | 1/15/2025 |
date | (default: medium) | Jan 15, 2025 |
date | long | January 15, 2025 |
time | 2:30 PM | |
datetime | Jan 15, 2025, 2:30 PM |
time pipe also accepts time-only strings like "14:30".
String Formatting
String pipes adjust casing and length —upper and lower normalize text for headings or labels, while truncate clamps to a maximum character count and appends ... when the string overflows:
| Pipe | Argument | Description |
|---|---|---|
upper | Uppercase the string | |
lower | Lowercase the string | |
truncate | max length | Clamp to N characters, append ... if truncated |
Array Operations
When state contains a list, you often need to summarize it — count the items, pull out the first or last entry, or collapse everything into a single readable string. The array pipes handle these without arithmetic or concatenation:| Pipe | Argument | Description |
|---|---|---|
length | Number of elements (also works on strings) | |
join | separator (default , ) | Join elements into a string |
first | First element | |
last | Last element |
Pipe Arguments
The argument after: is always a simple token — a number, a string, or an identifier. It can’t be a sub-expression. A few more examples:
Chaining
Pipes chain left to right. Each pipe receives the output of the previous one:Default Value Shorthand
A bare literal after| acts as a default value when the left side is null or undefined:
default pipe: {{ name | default:Anonymous }}. Both check specifically for null/undefined — an empty string "" won’t trigger the default.
For broader falsy defaults (including empty strings, zero, and false), use the || operator instead: