Atom
A component that renders a JavaScript value as a Python atom (atomic value). It handles various types of atomic values including numbers, booleans, strings, functions, arrays, and objects, converting them to Python-like syntax.
import { Atom } from "@alloy-js/python";
<Atom asFloat jsValue={unknown} />import { Atom } from "@alloy-js/python/stc";
Atom({ asFloat: boolean, jsValue: unknown }).children(children)| asFloat | optional boolean | |
| jsValue | optional unknown |
Example
Section titled “Example”<Atom jsValue={42} /> // renders "42"
<Atom jsValue={true} /> // renders "True"
<Atom jsValue="Hello" /> // renders '"Hello"'
<Atom jsValue={[1, 2, 3]} /> // renders "[1, 2, 3]"
<Atom jsValue={{ key: "value" }} />