Files
rose-ash/sx/sxc/examples/json-encoding-demo.sx
giles a7da235459 SXC content: docs/examples/home/reference pages + SX testing runner
New sxc/ content tree with 120 page files across docs, examples, home,
and reference demos. sx/sx/testing/ adds page-runner.sx (317L) and
index-runner.sx (394L) — SX-native test runner pages for
browser-based evaluation.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-22 09:08:47 +00:00

33 lines
1.1 KiB
Plaintext

(defcomp
()
(div
(~tw :tokens "space-y-4")
(form
:sx-post "/sx/(geography.(hypermedia.(example.(api.json-echo))))"
:sx-target "#json-result"
:sx-swap "innerHTML"
:sx-encoding "json"
(~tw :tokens "space-y-3")
(div
(label (~tw :tokens "block text-sm font-medium text-stone-700 mb-1") "Name")
(input
:type "text"
:name "name"
:value "Ada Lovelace"
(~tw :tokens "w-full px-3 py-2 border border-stone-300 rounded text-sm")))
(div
(label (~tw :tokens "block text-sm font-medium text-stone-700 mb-1") "Age")
(input
:type "number"
:name "age"
:value "36"
(~tw :tokens "w-full px-3 py-2 border border-stone-300 rounded text-sm")))
(button
:type "submit"
(~tw :tokens "px-4 py-2 bg-violet-600 text-white rounded hover:bg-violet-700 transition-colors text-sm")
"Submit as JSON"))
(div
:id "json-result"
(~tw :tokens "p-3 rounded bg-stone-100 text-stone-500 text-sm")
"Submit the form to see the server echo the parsed JSON.")))