← TRON examples

API-mode form

The sameForm/Fieldmarkup as the Notes example, but with asubmitprop: the fields are posted as TRON toPOST /api/notesthroughapi.post()instead of a form action. Validation runs once, in the route — a 400 withissueslands on the matching Field.

Create a note

Optional

Created this session

Nothing yet.

What to look at

  • Submit with an empty title: the route throwserror(400, issues), the client surfaces it asApiError.body.issues, and Form feeds those issues into the same context the action path uses.
  • Small bodies go out as plain JSON under theapplication/troncontent type (valid TRON); the route reads both through the serializer'sparseBody.
  • Form actions still work unchanged — SvelteKit only dispatches form-encoded POSTs to them, which is why JSON / TRON clients target a+server.croute.
norns-ui v0.0.17 · early access