TSRX Playground

The published @tsrx/yuku, running in this tab: parse, analyze, generate.

Examples

Pick an example, or type your own TSRX. Everything below is computed in this tab.

playground.tsrx
export function Cart({ items }): unknown @{
  const count = items.length;
  <ul class="cart">
    @for (const item of items; key item.id) {
      <li>{item.label}</li>
    } @empty {
      <li>Your cart is empty</li>
    }
    @if (count > 0) { <li>{count} in the cart</li> }
    <style>.cart { display: grid; gap: 4px; }</style>
  </ul>
}
a TSRX component, highlighted with the TSRX grammar @tsrx/yuku

The program parse returns, as JSON: ESTree, with TSRX nodes such as JSXCodeBlock, JSXForExpression and JSXStyleElement.

the parser starts when this page loads