pantoken / platforms/compose/src / toCompose
Function: toCompose()
toCompose(
tokens,options):Promise<string>
Experimental
Emit Compose Kotlin for an explicit token IR. Returns the written file path.
Parameters
tokens
readonly Token[]
options
Returns
Promise<string>
Examples
Emit a specific theme's IR
ts
import { toCompose } from "@pantoken/compose";
import { byTheme } from "@pantoken/tokens";
const file = await toCompose(byTheme("canvas"), { outDir: "./ui/tokens" });
// writes ./ui/tokens/PanTokens.kt (object PanTokens { … })Dark mode with a custom object name
ts
import { toCompose } from "@pantoken/compose";
import { byTheme } from "@pantoken/tokens";
await toCompose(byTheme("rebrand"), {
outDir: "./ui/tokens",
mode: "dark",
className: "InstUITokens", // writes InstUITokens.kt
});