Skip to content

Reference

darsrc edited this page Jun 12, 2026 · 17 revisions

Reference

Compact reference for the public lcars_ui DSL.

Import

import lcars_ui as lcars

Lifecycle

lcars.config(name, theme="galaxy", subtitle=None, header_color="orange", sound_enabled=True, lang="en-US", force_uppercase=True, label_uppercase=True, lcars_font_headers=True, lcars_font_labels=True, lcars_font_text=False, visual_language="strict", strict_renderer="legacy")

lcars.run(ui_fn, host="127.0.0.1", port=8000, open_browser=True)

@lcars.live(interval=5.0)
def poll() -> None: ...

Pages

lcars.nav(label, page=None, color=None, segments=None)

with lcars.page(title, id=None, layout="auto"):
    ...

Layouts: auto, console, telemetry, grid, menu.

Containers

with lcars.data_panel(title="Data", color="blue", id=None, zone=None): ...
with lcars.control_panel(title="Controls", color="orange", id=None, zone=None): ...
with lcars.console(title, color="orange", id=None, zone=None) as console: ...
with lcars.padd(title, color="orange", id=None, zone=None) as padd: ...
with lcars.diagnostic(title, color="blue", id=None, zone=None) as diagnostic: ...
with lcars.box(title=None, subtitle=None, color="orange", id=None, zone=None) as box: ...
with lcars.sweep(title=None, subtitle=None, color="orange", reverse=False, id=None, zone=None) as sweep: ...
with lcars.bracket(color="orange", orientation="both", id=None, zone=None): ...

Slots:

with box.main(): ...
with box.side(): ...
with box.left_inputs(): ...
with box.right_inputs(): ...

with sweep.header(): ...
with sweep.column_inputs(): ...
with sweep.left(): ...
with sweep.right(): ...

Compatibility helpers:

with lcars.row(height="auto"): ...
with lcars.col(width="1fr"): ...
lcars.columns(["2fr", "1fr"])
with lcars.section(label, color=None): ...
with lcars.input_column(side="left"): ...
with lcars.raw(reason=None): ...

Zones: primary, side, readout, dock, rail, full.

Primitive Widgets

lcars.header(text_value, size="h2", color=None, id=None)
lcars.text(content, size="body", color=None, id=None)
lcars.markdown(content, color=None, id=None)
lcars.metric(label, value, status="ok", color=None, id=None)
lcars.alert(message, level="yellow", blink=False, id=None)
lcars.progress(label, value, color=None, show_label=True, id=None)

Values:

  • text(size): h1, h2, body, mono
  • header(size): h1 through h6
  • metric(status): ok, warn, crit
  • alert(level): yellow, red

Data Widgets

lcars.chart(data, title=None, color=None, id=None)
lcars.sparkline(data, title=None, id=None)
lcars.gauge(label, value, min=0.0, max=100.0, unit=None, color=None, warn_threshold=None, crit_threshold=None, id=None)
lcars.table(data, title=None, id=None)

Chart data: numeric list, dictionary of named numeric lists, pandas DataFrame, or pandas Series.

Table data: list of dictionaries, list of lists or tuples, flat list, or pandas DataFrame.

Input Widgets

clicked = lcars.button(label, color=None, id=None)
checked = lcars.toggle(label, value=False, color=None, id=None)
checked = lcars.checkbox(label, value=False, color=None, id=None)
choice = lcars.select(label, options, value=None, color=None, id=None)
choice = lcars.radio(label, options, value=None, color=None, id=None)
choice = lcars.radio_toggle(label, options, value=None, color=None, id=None)
text = lcars.text_input(label, placeholder="", password=False, id=None)
number = lcars.number_input(label, value=0.0, min=None, max=None, step=1.0, placeholder=None, id=None)

with lcars.form(label, action_id, submit_label="Submit", color=None, id=None): ...

Media

lcars.log(stream_id, max_lines=1000, title=None, id=None)
lcars.video_hls(src, title=None, autoplay=False, muted=False, color=None, id=None)
lcars.mic_button(action_id, title=None, upload_url="/lcars/upload/audio", timeout_ms=5000, color=None, id=None)

Effects

lcars.update(widget_id, **fields)
lcars.notify(message, level="info")
lcars.append_log(stream_id, *lines)
lcars.set_alert_condition(level)
lcars.set_theme(theme)

Values:

  • notify(level): info, error
  • set_alert_condition(level): normal, yellow, red
  • set_theme(theme): galaxy, tng, nemesis

Themes and Colors

Themes: galaxy, tng, nemesis.

Common color names:

  • Warm: orange, orange-peel, atomic-tangerine, golden-tanoi, sandy-brown
  • Yellow: pale-canary, tanoi, husk, yellow
  • Blue: anakiwa, mariner, bahama-blue, danub, near-blue, navy-blue
  • Purple: lilac, melrose, lavender-purple, purple
  • Red: red, hopbush, chestnut-rose, red-damask, tamarillo

Hex colors such as #ff9933 are accepted.

Clone this wiki locally