Skip to content

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 jsValue={unknown} />
jsValueoptionalunknown
<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" }} />