Native Table
table.new and table.cell — native table namespace for plain managed widgets before reaching for the ATK table bridge.
Native Table Namespace: Use It Before Reaching for the ATK Table Bridge#
Choose native tables when#
You need a simple managed widget with rows, columns, and cell text that can be expressed directly through
table.new, table.cell, or ctx.table.new.
Choose the ATK bridge when#
The visual is a richer composite dashboard or you already rely on ATK-native layout helpers. The bridge is stronger for grouped payloads, while native tables are the cleanest first choice for plain widgets.
ctx.table API#
def build_visuals(frame, params=None, ctx=None):
if frame is None or frame.empty or ctx is None:
return None
last = frame.iloc[-1]
tbl = ctx.table.new(
key="stats_table",
rows=3,
columns=2,
position="top_right",
bgcolor="#1e222d",
border_color="#363a45",
border_width=1,
)
ctx.table.cell(tbl, row=0, column=0, text="Close", text_color="#d1d4dc")
ctx.table.cell(tbl, row=0, column=1, text=str(round(float(last["close"]), 2)), text_color="#ffffff")
ctx.table.cell(tbl, row=1, column=0, text="EMA", text_color="#d1d4dc")
ctx.table.cell(tbl, row=1, column=1, text=str(round(float(last.get("ema_fast", 0)), 2)), text_color="#00c853")
return tblUse ctx.table.new with a stable key. The render engine tracks the table by key across updates. Avoid
recomputing cell values that could have been prepared as frame columns — format them in
build_indicator_frame and read them as strings in build_visuals.