GUI Handles

class viser.CommandHandle[source]

Handle for a command registered in the command palette.

Commands are shown in a command palette (Ctrl/Cmd+K, also Ctrl/Cmd+Shift+P on non-Firefox browsers) and can optionally be triggered via hotkeys.

(Experimental) The command palette API may change in future releases.

label: str

Label displayed in the command palette.

description: str | None

Description displayed below the label.

hotkey: HotkeyKey | None

Hotkey key, e.g. "K" or "R".

modifier: KeyModifier | None

Modifier-combo held with the hotkey, e.g. "cmd/ctrl" or "cmd/ctrl+shift". None matches “no modifiers held”.

disabled: bool

Whether the command is disabled (visible but not triggerable).

property icon: IconName | None

Icon displayed in the command palette.

on_trigger(func: Callable[[CommandEvent], NoneOrCoroutine]) Callable[[CommandEvent], NoneOrCoroutine][source]

Attach a function to call when this command is triggered.

Note: - If func is a regular function (defined with def), it will be executed in a thread pool. - If func is an async function (defined with async def), it will be executed in the event loop.

Using async functions can be useful for reducing race conditions.

Parameters:

func (Callable[[CommandEvent], NoneOrCoroutine])

Return type:

Callable[[CommandEvent], NoneOrCoroutine]

remove() None[source]

Remove this command from the command palette.

Return type:

None

class viser.GuiButtonGroupHandle[source]

Handle for a button group input in our visualizer.

value: str

Value of the input. Represents the currently selected button in the group.

on_click(func: Callable[[GuiEvent[TGuiHandle]], NoneOrCoroutine]) Callable[[GuiEvent[TGuiHandle]], NoneOrCoroutine][source]

Attach a function to call when a button in the group is clicked.

Note: - If func is a regular function (defined with def), it will be executed in a thread pool. - If func is an async function (defined with async def), it will be executed in the event loop.

Using async functions can be useful for reducing race conditions.

Parameters:
Return type:

Callable[[GuiEvent[TGuiHandle]], NoneOrCoroutine]

property disabled: bool

Button groups cannot be disabled.

remove() None

Permanently remove this GUI element from the visualizer.

Return type:

None

property update_timestamp: float

Read-only timestamp when this input was last updated.

options: Tuple[str, ...]

Tuple of buttons for the button group.

order: float

Order value for arranging GUI elements.

label: str

Label text for the GUI element.

hint: str | None

Optional hint text for the GUI element.

visible: bool

Visibility state of the GUI element.

class viser.GuiButtonHandle[source]

Handle for a button input in our visualizer.

value: bool

Value of the button. Set to True when the button is pressed. Can be manually set back to False.

property icon: IconName | None

Icon to display on the button. When set to None, no icon is displayed.

on_click(func: Callable[[GuiEvent[TGuiHandle]], NoneOrCoroutine]) Callable[[GuiEvent[TGuiHandle]], NoneOrCoroutine][source]

Attach a function to call when a button is pressed.

Note: - If func is a regular function (defined with def), it will be executed in a thread pool. - If func is an async function (defined with async def), it will be executed in the event loop.

Using async functions can be useful for reducing race conditions.

Parameters:
Return type:

Callable[[GuiEvent[TGuiHandle]], NoneOrCoroutine]

on_hold(func: None = None, callback_hz: float = 10.0) Callable[[_HoldCallback], _HoldCallback][source]
on_hold(func: _HoldCallback, callback_hz: float = 10.0) _HoldCallback

Attach a function to call repeatedly while a button is held down.

The callback will be triggered immediately when the button is pressed, and then repeatedly at the specified frequency until released.

Can be used as a decorator with or without arguments:

@button.on_hold def callback(event): …

@button.on_hold(callback_hz=30.0) def callback(event): …

Or called directly:

button.on_hold(callback) button.on_hold(callback, callback_hz=30.0)

Parameters:
  • func – The callback function to attach. If None, returns a decorator.

  • callback_hz – The frequency in Hz at which to call the callback while the button is held. Defaults to 10.0 Hz.

Note: - If func is a regular function (defined with def), it will be executed in a thread pool. - If func is an async function (defined with async def), it will be executed in the event loop.

Using async functions can be useful for reducing race conditions.

remove() None

Permanently remove this GUI element from the visualizer.

Return type:

None

property update_timestamp: float

Read-only timestamp when this input was last updated.

color: LiteralColor | Tuple[int, int, int] | None

Color of the button.

order: float

Order value for arranging GUI elements.

label: str

Label text for the GUI element.

hint: str | None

Optional hint text for the GUI element.

visible: bool

Visibility state of the GUI element.

disabled: bool

Disabled state of the GUI element.

class viser.GuiCheckboxHandle[source]

Handle for checkbox inputs.

value: bool

Value of the input. Synchronized automatically when assigned.

on_update(func: Callable[[GuiEvent[TGuiHandle]], NoneOrCoroutine]) Callable[[GuiEvent[TGuiHandle]], NoneOrCoroutine]

Attach a function to call when a GUI input is updated.

Note: - If func is a regular function (defined with def), it will be executed in a thread pool. - If func is an async function (defined with async def), it will be executed in the event loop.

Using async functions can be useful for reducing race conditions.

Parameters:
Return type:

Callable[[GuiEvent[TGuiHandle]], NoneOrCoroutine]

remove() None

Permanently remove this GUI element from the visualizer.

Return type:

None

remove_update_callback(callback: Literal['all'] | Callable = 'all') None

Remove update callbacks from the GUI input.

Parameters:

callback (Literal['all'] | ~typing.Callable) – Either “all” to remove all callbacks, or a specific callback function to remove.

Return type:

None

property update_timestamp: float

Read-only timestamp when this input was last updated.

order: float

Order value for arranging GUI elements.

label: str

Label text for the GUI element.

hint: str | None

Optional hint text for the GUI element.

visible: bool

Visibility state of the GUI element.

disabled: bool

Disabled state of the GUI element.

class viser.GuiDividerHandle[source]

Handle for updating and removing dividers.

remove() None

Permanently remove this GUI element from the visualizer.

Return type:

None

order: float

Order value for arranging GUI elements.

visible: bool

Visibility state of the divider.

class viser.GuiDropdownHandle[source]

Handle for a dropdown-style GUI input in our visualizer.

value: StringType

Value of the input. Represents the currently selected option in the dropdown.

property options: tuple[StringType, ...]

Options for our dropdown. Synchronized automatically when assigned.

For projects that care about typing: the static type of options should be consistent with the StringType associated with a handle. Literal types will be inferred where possible when handles are instantiated; for the most flexibility, we can declare handles as GuiDropdownHandle[str].

on_update(func: Callable[[GuiEvent[TGuiHandle]], NoneOrCoroutine]) Callable[[GuiEvent[TGuiHandle]], NoneOrCoroutine]

Attach a function to call when a GUI input is updated.

Note: - If func is a regular function (defined with def), it will be executed in a thread pool. - If func is an async function (defined with async def), it will be executed in the event loop.

Using async functions can be useful for reducing race conditions.

Parameters:
Return type:

Callable[[GuiEvent[TGuiHandle]], NoneOrCoroutine]

remove() None

Permanently remove this GUI element from the visualizer.

Return type:

None

remove_update_callback(callback: Literal['all'] | Callable = 'all') None

Remove update callbacks from the GUI input.

Parameters:

callback (Literal['all'] | ~typing.Callable) – Either “all” to remove all callbacks, or a specific callback function to remove.

Return type:

None

property update_timestamp: float

Read-only timestamp when this input was last updated.

order: float

Order value for arranging GUI elements.

label: str

Label text for the GUI element.

hint: str | None

Optional hint text for the GUI element.

visible: bool

Visibility state of the GUI element.

disabled: bool

Disabled state of the GUI element.

class viser.GuiFolderHandle[source]

Use as a context to place GUI elements into a folder.

remove() None[source]

Permanently remove this folder and all contained GUI elements from the visualizer.

Return type:

None

order: float

Order value for arranging GUI elements.

label: str | None

Label text for the GUI folder. If None, the folder is rendered without a header or border (useful for pure layout grouping).

visible: bool

Visibility state of the GUI folder.

expand_by_default: bool

Whether the folder should be expanded by default.

class viser.GuiFormHandle[source]

Use as a context to place GUI elements into a form.

A form is a folder whose children’s values can be committed together by calling submit() (typically from a button’s on_click handler) or by pressing Enter in a single-line text input inside the form.

Children of a form behave exactly like children of a folder. on_update callbacks on individual inputs continue to fire on every keystroke; the form’s on_submit() callback fires only when the form is submitted. Register one or both depending on whether you want live or commit semantics.

The form’s client-side dirty indicator highlights when any descendant input has been edited since the last submit.

Forms cannot be nested. Calling GuiApi.add_form() inside an existing form’s context will raise ValueError, because nested <form> elements are invalid HTML on the client.

Example:

with server.gui.add_form("Profile") as form:
    name = server.gui.add_text("Name", "")
    age = server.gui.add_number("Age", 0)
    save = server.gui.add_button("Save")

save.on_click(lambda _: form.submit())

@form.on_submit
def _(event):
    print(name.value, age.value)
on_submit(func: Callable[[GuiEvent[GuiFormHandle]], NoneOrCoroutine]) Callable[[GuiEvent[GuiFormHandle]], NoneOrCoroutine][source]

Attach a function to call when the form is submitted.

on_submit is independent from on_update callbacks on child inputs: child on_update callbacks fire on every keystroke (as normal), and the form’s on_submit fires when commit happens (via form.submit() or Enter in a single-line text input).

Note: - If func is a regular function (defined with def), it will be executed in a thread pool. - If func is an async function (defined with async def), it will be executed in the event loop.

Parameters:

func (Callable[[GuiEvent[GuiFormHandle]], NoneOrCoroutine])

Return type:

Callable[[GuiEvent[GuiFormHandle]], NoneOrCoroutine]

remove_submit_callback(callback: Literal['all'] | Callable = 'all') None[source]

Remove submit callbacks from the form.

Parameters:

callback (Literal['all'] | ~typing.Callable) – Either “all” to remove all callbacks, or a specific callback function to remove.

Return type:

None

submit() None[source]

Programmatically submit this form.

Fires all registered on_submit callbacks and broadcasts a GuiFormSubmitMessage to all clients so their dirty indicators are cleared.

Return type:

None

remove() None

Permanently remove this folder and all contained GUI elements from the visualizer.

Return type:

None

order: float

Order value for arranging GUI elements.

label: str | None

Label text for the GUI folder. If None, the folder is rendered without a header or border (useful for pure layout grouping).

visible: bool

Visibility state of the GUI folder.

expand_by_default: bool

Whether the folder should be expanded by default.

class viser.GuiHtmlHandle[source]

Handling for updating and removing HTML elements.

remove() None

Permanently remove this GUI element from the visualizer.

Return type:

None

order: float

Order value for arranging GUI elements.

content: str

HTML content to be displayed.

visible: bool

Visibility state of the markdown element.

class viser.GuiImageHandle[source]

Handle for updating and removing images.

remove() None

Permanently remove this GUI element from the visualizer.

Return type:

None

order: float

Order value for arranging GUI elements.

label: str | None

Label text for the image.

visible: bool

Visibility state of the image.

property image: ndarray

Current content of this image element. Synchronized automatically when assigned.

property format: Literal['auto', 'jpeg', 'png']

Image format. ‘auto’ will use PNG for RGBA images and JPEG for RGB.

class viser.GuiInputHandle[source]

A handle is created for each GUI element that is added in viser. Handles can be used to read and write state.

When a GUI element is added via ViserServer.gui, state is synchronized between all connected clients. When a GUI element is added via ClientHandle.gui, state is local to a specific client.

on_update(func: Callable[[GuiEvent[TGuiHandle]], NoneOrCoroutine]) Callable[[GuiEvent[TGuiHandle]], NoneOrCoroutine][source]

Attach a function to call when a GUI input is updated.

Note: - If func is a regular function (defined with def), it will be executed in a thread pool. - If func is an async function (defined with async def), it will be executed in the event loop.

Using async functions can be useful for reducing race conditions.

Parameters:
Return type:

Callable[[GuiEvent[TGuiHandle]], NoneOrCoroutine]

remove_update_callback(callback: Literal['all'] | Callable = 'all') None[source]

Remove update callbacks from the GUI input.

Parameters:

callback (Literal['all'] | ~typing.Callable) – Either “all” to remove all callbacks, or a specific callback function to remove.

Return type:

None

remove() None

Permanently remove this GUI element from the visualizer.

Return type:

None

property update_timestamp: float

Read-only timestamp when this input was last updated.

order: float

Order value for arranging GUI elements.

label: str

Label text for the GUI element.

hint: str | None

Optional hint text for the GUI element.

visible: bool

Visibility state of the GUI element.

disabled: bool

Disabled state of the GUI element.

class viser.GuiMarkdownHandle[source]

Handling for updating and removing markdown elements.

property content: str

Current content of this markdown element. Synchronized automatically when assigned.

remove() None

Permanently remove this GUI element from the visualizer.

Return type:

None

order: float

Order value for arranging GUI elements.

visible: bool

Visibility state of the markdown element.

class viser.GuiMultiSliderHandle[source]

Handle for multi-slider inputs.

value: tuple[IntOrFloat, ...]

Value of the input. Synchronized automatically when assigned.

on_update(func: Callable[[GuiEvent[TGuiHandle]], NoneOrCoroutine]) Callable[[GuiEvent[TGuiHandle]], NoneOrCoroutine]

Attach a function to call when a GUI input is updated.

Note: - If func is a regular function (defined with def), it will be executed in a thread pool. - If func is an async function (defined with async def), it will be executed in the event loop.

Using async functions can be useful for reducing race conditions.

Parameters:
Return type:

Callable[[GuiEvent[TGuiHandle]], NoneOrCoroutine]

remove() None

Permanently remove this GUI element from the visualizer.

Return type:

None

remove_update_callback(callback: Literal['all'] | Callable = 'all') None

Remove update callbacks from the GUI input.

Parameters:

callback (Literal['all'] | ~typing.Callable) – Either “all” to remove all callbacks, or a specific callback function to remove.

Return type:

None

property update_timestamp: float

Read-only timestamp when this input was last updated.

order: float

Order value for arranging GUI elements.

label: str

Label text for the GUI element.

hint: str | None

Optional hint text for the GUI element.

visible: bool

Visibility state of the GUI element.

disabled: bool

Disabled state of the GUI element.

min: float

Minimum value for the multi-slider.

max: float

Maximum value for the multi-slider.

step: float

Step size for the multi-slider.

min_range: float | None

Minimum allowed range between slider handles.

precision: int

Number of decimal places to display for the multi-slider values.

fixed_endpoints: bool

If True, the first and last handles cannot be moved.

class viser.GuiNumberHandle[source]

Handle for number inputs.

value: IntOrFloat

Value of the input. Synchronized automatically when assigned.

on_update(func: Callable[[GuiEvent[TGuiHandle]], NoneOrCoroutine]) Callable[[GuiEvent[TGuiHandle]], NoneOrCoroutine]

Attach a function to call when a GUI input is updated.

Note: - If func is a regular function (defined with def), it will be executed in a thread pool. - If func is an async function (defined with async def), it will be executed in the event loop.

Using async functions can be useful for reducing race conditions.

Parameters:
Return type:

Callable[[GuiEvent[TGuiHandle]], NoneOrCoroutine]

remove() None

Permanently remove this GUI element from the visualizer.

Return type:

None

remove_update_callback(callback: Literal['all'] | Callable = 'all') None

Remove update callbacks from the GUI input.

Parameters:

callback (Literal['all'] | ~typing.Callable) – Either “all” to remove all callbacks, or a specific callback function to remove.

Return type:

None

property update_timestamp: float

Read-only timestamp when this input was last updated.

order: float

Order value for arranging GUI elements.

label: str

Label text for the GUI element.

hint: str | None

Optional hint text for the GUI element.

visible: bool

Visibility state of the GUI element.

disabled: bool

Disabled state of the GUI element.

precision: int

Number of decimal places to display for the number value.

step: float

Step size for incrementing/decrementing the number value.

min: float | None

Minimum allowed value for the number input.

max: float | None

Maximum allowed value for the number input.

class viser.GuiPlotlyHandle[source]

Handle for updating and removing Plotly figures.

property figure: go.Figure

Current Plotly figure. Synchronized automatically when assigned.

remove() None

Permanently remove this GUI element from the visualizer.

Return type:

None

order: float

Order value for arranging GUI elements.

aspect: float

Aspect ratio of the plot.

visible: bool

Visibility state of the plot.

class viser.GuiRgbHandle[source]

Handle for RGB color inputs.

value: tuple[int, int, int]

Value of the input. Synchronized automatically when assigned.

on_update(func: Callable[[GuiEvent[TGuiHandle]], NoneOrCoroutine]) Callable[[GuiEvent[TGuiHandle]], NoneOrCoroutine]

Attach a function to call when a GUI input is updated.

Note: - If func is a regular function (defined with def), it will be executed in a thread pool. - If func is an async function (defined with async def), it will be executed in the event loop.

Using async functions can be useful for reducing race conditions.

Parameters:
Return type:

Callable[[GuiEvent[TGuiHandle]], NoneOrCoroutine]

remove() None

Permanently remove this GUI element from the visualizer.

Return type:

None

remove_update_callback(callback: Literal['all'] | Callable = 'all') None

Remove update callbacks from the GUI input.

Parameters:

callback (Literal['all'] | ~typing.Callable) – Either “all” to remove all callbacks, or a specific callback function to remove.

Return type:

None

property update_timestamp: float

Read-only timestamp when this input was last updated.

order: float

Order value for arranging GUI elements.

label: str

Label text for the GUI element.

hint: str | None

Optional hint text for the GUI element.

visible: bool

Visibility state of the GUI element.

disabled: bool

Disabled state of the GUI element.

class viser.GuiRgbaHandle[source]

Handle for RGBA color inputs.

value: tuple[int, int, int, int]

Value of the input. Synchronized automatically when assigned.

on_update(func: Callable[[GuiEvent[TGuiHandle]], NoneOrCoroutine]) Callable[[GuiEvent[TGuiHandle]], NoneOrCoroutine]

Attach a function to call when a GUI input is updated.

Note: - If func is a regular function (defined with def), it will be executed in a thread pool. - If func is an async function (defined with async def), it will be executed in the event loop.

Using async functions can be useful for reducing race conditions.

Parameters:
Return type:

Callable[[GuiEvent[TGuiHandle]], NoneOrCoroutine]

remove() None

Permanently remove this GUI element from the visualizer.

Return type:

None

remove_update_callback(callback: Literal['all'] | Callable = 'all') None

Remove update callbacks from the GUI input.

Parameters:

callback (Literal['all'] | ~typing.Callable) – Either “all” to remove all callbacks, or a specific callback function to remove.

Return type:

None

property update_timestamp: float

Read-only timestamp when this input was last updated.

order: float

Order value for arranging GUI elements.

label: str

Label text for the GUI element.

hint: str | None

Optional hint text for the GUI element.

visible: bool

Visibility state of the GUI element.

disabled: bool

Disabled state of the GUI element.

class viser.GuiSliderHandle[source]

Handle for slider inputs.

value: IntOrFloat

Value of the input. Synchronized automatically when assigned.

on_update(func: Callable[[GuiEvent[TGuiHandle]], NoneOrCoroutine]) Callable[[GuiEvent[TGuiHandle]], NoneOrCoroutine]

Attach a function to call when a GUI input is updated.

Note: - If func is a regular function (defined with def), it will be executed in a thread pool. - If func is an async function (defined with async def), it will be executed in the event loop.

Using async functions can be useful for reducing race conditions.

Parameters:
Return type:

Callable[[GuiEvent[TGuiHandle]], NoneOrCoroutine]

remove() None

Permanently remove this GUI element from the visualizer.

Return type:

None

remove_update_callback(callback: Literal['all'] | Callable = 'all') None

Remove update callbacks from the GUI input.

Parameters:

callback (Literal['all'] | ~typing.Callable) – Either “all” to remove all callbacks, or a specific callback function to remove.

Return type:

None

property update_timestamp: float

Read-only timestamp when this input was last updated.

order: float

Order value for arranging GUI elements.

label: str

Label text for the GUI element.

hint: str | None

Optional hint text for the GUI element.

visible: bool

Visibility state of the GUI element.

disabled: bool

Disabled state of the GUI element.

min: float

Minimum value for the slider.

max: float

Maximum value for the slider.

step: float

Step size for the slider.

precision: int

Number of decimal places to display for the slider value.

class viser.GuiTabGroupHandle[source]

Handle for a tab group. Call add_tab() to add a tab.

remove() None[source]

Remove this tab group and all contained GUI elements.

Return type:

None

add_tab(label: str, icon: IconName | None = None) GuiTabHandle

Add a tab. Returns a handle we can use to add GUI elements to it.

Parameters:
  • label (str)

  • icon (IconName | None)

Return type:

GuiTabHandle

order: float

Order value for arranging GUI elements.

visible: bool

Visibility state of the tab group.

class viser.GuiTabHandle[source]

Use as a context to place GUI elements into a tab.

removed: bool = False
property icon: IconName | None

Icon to display on the tab. When set to None, no icon is displayed.

remove() None[source]

Permanently remove this tab and all contained GUI elements from the visualizer.

Return type:

None

class viser.GuiTextHandle[source]

Handle for text inputs.

value: str

Value of the input. Synchronized automatically when assigned.

on_update(func: Callable[[GuiEvent[TGuiHandle]], NoneOrCoroutine]) Callable[[GuiEvent[TGuiHandle]], NoneOrCoroutine]

Attach a function to call when a GUI input is updated.

Note: - If func is a regular function (defined with def), it will be executed in a thread pool. - If func is an async function (defined with async def), it will be executed in the event loop.

Using async functions can be useful for reducing race conditions.

Parameters:
Return type:

Callable[[GuiEvent[TGuiHandle]], NoneOrCoroutine]

remove() None

Permanently remove this GUI element from the visualizer.

Return type:

None

remove_update_callback(callback: Literal['all'] | Callable = 'all') None

Remove update callbacks from the GUI input.

Parameters:

callback (Literal['all'] | ~typing.Callable) – Either “all” to remove all callbacks, or a specific callback function to remove.

Return type:

None

property update_timestamp: float

Read-only timestamp when this input was last updated.

order: float

Order value for arranging GUI elements.

label: str

Label text for the GUI element.

hint: str | None

Optional hint text for the GUI element.

visible: bool

Visibility state of the GUI element.

disabled: bool

Disabled state of the GUI element.

multiline: bool
class viser.GuiUploadButtonHandle[source]

Handle for an upload file button in our visualizer.

The .value attribute will be updated with the contents of uploaded files.

value: UploadedFile

Value of the input. Contains information about the uploaded file.

property icon: IconName | None

Icon to display on the upload button. When set to None, no icon is displayed.

on_upload(func: Callable[[GuiEvent[TGuiHandle]], NoneOrCoroutine]) Callable[[GuiEvent[TGuiHandle]], NoneOrCoroutine][source]

Attach a function to call when a file is uploaded.

Note: - If func is a regular function (defined with def), it will be executed in a thread pool. - If func is an async function (defined with async def), it will be executed in the event loop.

Using async functions can be useful for reducing race conditions.

Parameters:
Return type:

Callable[[GuiEvent[TGuiHandle]], NoneOrCoroutine]

remove() None

Permanently remove this GUI element from the visualizer.

Return type:

None

property update_timestamp: float

Read-only timestamp when this input was last updated.

color: LiteralColor | Tuple[int, int, int] | None

Color of the upload button.

mime_type: str

MIME type of the files that can be uploaded.

order: float

Order value for arranging GUI elements.

label: str

Label text for the GUI element.

hint: str | None

Optional hint text for the GUI element.

visible: bool

Visibility state of the GUI element.

disabled: bool

Disabled state of the GUI element.

class viser.GuiUplotHandle[source]

Handle for updating and removing Uplot figures.

remove() None

Permanently remove this GUI element from the visualizer.

Return type:

None

order: float

Order value for arranging GUI elements.

data: Tuple[npt.NDArray[np.float64], ...]

Tuple of 1D numpy arrays containing chart data. First array is x-axis data, subsequent arrays are y-axis data for each series. All arrays must have matching lengths. Minimum 2 arrays required.

mode: Literal[1, 2] | None

1 = aligned (all series share axes), 2 = faceted (each series gets its own subplot panel). Defaults to 1.

Type:

Chart layout mode

title: str | None

Chart title displayed at the top of the plot.

series: Tuple[uplot.Series, ...]

Series configuration objects defining visual appearance (colors, line styles, labels) and behavior for each data array. Must match data tuple length.

bands: Tuple[uplot.Band, ...] | None

High/low range visualizations between adjacent series indices. Useful for confidence intervals, error bounds, or min/max ranges.

scales: Dict[str, uplot.Scale] | None

Scale definitions controlling data-to-pixel mapping and axis ranges. Enables features like auto-ranging, manual bounds, time-based scaling, and logarithmic distributions. Multiple scales support dual-axis charts.

axes: Tuple[uplot.Axis, ...] | None

Axis configuration for positioning (top/right/bottom/left), tick formatting, grid styling, and spacing. Controls visual appearance of chart axes.

legend: uplot.Legend | None

Legend display options including positioning, styling, and custom value formatting for hover states.

cursor: uplot.Cursor | None

Interactive cursor behavior including hover detection, drag-to-zoom, and crosshair appearance. Controls user interaction with the chart.

focus: uplot.Focus | None

Visual highlighting when hovering over series. Controls alpha transparency of non-focused series to emphasize the active one.

aspect: float

Width-to-height ratio for chart display (width/height). 1.0 = square, >1.0 = wider. Used when height is None.

height: int | None

Fixed height in pixels. Overrides aspect ratio when set.

padding: Tuple[int, int, int, int] | None

Padding (top, right, bottom, left) in pixels.

visible: bool

Whether the chart is visible in the interface.

class viser.GuiVector2Handle[source]

Handle for 2D vector inputs.

value: tuple[float, float]

Value of the input. Synchronized automatically when assigned.

on_update(func: Callable[[GuiEvent[TGuiHandle]], NoneOrCoroutine]) Callable[[GuiEvent[TGuiHandle]], NoneOrCoroutine]

Attach a function to call when a GUI input is updated.

Note: - If func is a regular function (defined with def), it will be executed in a thread pool. - If func is an async function (defined with async def), it will be executed in the event loop.

Using async functions can be useful for reducing race conditions.

Parameters:
Return type:

Callable[[GuiEvent[TGuiHandle]], NoneOrCoroutine]

remove() None

Permanently remove this GUI element from the visualizer.

Return type:

None

remove_update_callback(callback: Literal['all'] | Callable = 'all') None

Remove update callbacks from the GUI input.

Parameters:

callback (Literal['all'] | ~typing.Callable) – Either “all” to remove all callbacks, or a specific callback function to remove.

Return type:

None

property update_timestamp: float

Read-only timestamp when this input was last updated.

order: float

Order value for arranging GUI elements.

label: str

Label text for the GUI element.

hint: str | None

Optional hint text for the GUI element.

visible: bool

Visibility state of the GUI element.

disabled: bool

Disabled state of the GUI element.

min: Tuple[float, float] | None

Minimum allowed values for each component of the vector.

max: Tuple[float, float] | None

Maximum allowed values for each component of the vector.

step: float

Step size for incrementing/decrementing each component of the vector.

precision: int

Number of decimal places to display for each component of the vector.

class viser.GuiVector3Handle[source]

Handle for 3D vector inputs.

value: tuple[float, float, float]

Value of the input. Synchronized automatically when assigned.

on_update(func: Callable[[GuiEvent[TGuiHandle]], NoneOrCoroutine]) Callable[[GuiEvent[TGuiHandle]], NoneOrCoroutine]

Attach a function to call when a GUI input is updated.

Note: - If func is a regular function (defined with def), it will be executed in a thread pool. - If func is an async function (defined with async def), it will be executed in the event loop.

Using async functions can be useful for reducing race conditions.

Parameters:
Return type:

Callable[[GuiEvent[TGuiHandle]], NoneOrCoroutine]

remove() None

Permanently remove this GUI element from the visualizer.

Return type:

None

remove_update_callback(callback: Literal['all'] | Callable = 'all') None

Remove update callbacks from the GUI input.

Parameters:

callback (Literal['all'] | ~typing.Callable) – Either “all” to remove all callbacks, or a specific callback function to remove.

Return type:

None

property update_timestamp: float

Read-only timestamp when this input was last updated.

order: float

Order value for arranging GUI elements.

label: str

Label text for the GUI element.

hint: str | None

Optional hint text for the GUI element.

visible: bool

Visibility state of the GUI element.

disabled: bool

Disabled state of the GUI element.

min: Tuple[float, float, float] | None

Minimum allowed values for each component of the vector.

max: Tuple[float, float, float] | None

Maximum allowed values for each component of the vector.

step: float

Step size for incrementing/decrementing each component of the vector.

precision: int

Number of decimal places to display for each component of the vector.

class viser.MainPanelHandle[source]

Handle for the main control panel. Returned by GuiApi.main_panel.

Supports the same placement / sizing / minimize commands as PanelHandle, but nothing else from it: the main panel has no tabs (its content is the inline GUI tree), no visible property, and cannot be removed. Because the control panel renders on every client, it is a legal anchor for other panels’ dock_* commands from any scope.

A fresh handle is returned on each access; placement state is keyed off the control panel’s fixed uuid, so handles are interchangeable.

Note

Panels are a new API surface; method names and placement semantics may still evolve in upcoming releases.

dock_above(anchor: PanelHandle | MainPanelHandle) None

Stack this panel directly above another panel (a column split).

The anchor must itself be DOCKED (a column split needs a docked neighbor to split against). If the anchor is floating or not yet placed, this falls back to docking on the right edge (with a warning); dock the anchor first.

Parameters:

anchor (PanelHandle | MainPanelHandle)

Return type:

None

dock_below(anchor: PanelHandle | MainPanelHandle) None

Stack this panel directly below another panel (a column split).

The anchor must itself be DOCKED (a column split needs a docked neighbor to split against). If the anchor is floating or not yet placed, this falls back to docking on the right edge (with a warning); dock the anchor first.

Parameters:

anchor (PanelHandle | MainPanelHandle)

Return type:

None

dock_left() None

Dock this panel to the left viewport edge.

Each new left-dock is inserted at the innermost position, so several panels docked to the left appear in call order from the edge inward. Calling again repositions an already-placed panel.

Return type:

None

dock_right() None

Dock this panel to the right viewport edge.

Each new right-dock is inserted at the innermost position, so several panels docked to the right appear in call order from the edge inward. Calling again repositions an already-placed panel.

Return type:

None

expand() None

Expand (un-minimize) the panel, the inverse of minimize().

Like minimize() this acts at container scope – expanding a panel reveals its whole stack (and clears a docked column’s rail) – and is imperative: it always expands, even if the user minimized the panel in the browser. Replayed to clients that connect later.

Return type:

None

float(*, x: float | None = None, y: float | None = None, width: float | None = None, height: float | None = None) None

Float this panel at an explicit position and size, in CSS pixels.

x / y are measured relative to the viewport – the canvas area inside any docked panels:

  • A non-negative value is a gap from the left / top: float(x=40) lands 40px from the canvas left edge (clear of a left-docked panel, not under it).

  • A negative value is a gap from the right / bottom: float(x=-15) puts the panel’s right edge 15px from the canvas right edge. So float(x=-15, y=15) is the top-right corner, and float(x=-15, y=-15) the bottom-right.

The panel re-resolves against these edges as the canvas changes (a dock added/removed, the window resized), so an edge-anchored panel stays put. Any argument left as None uses a client-chosen default (top-left); width / height set the floating window size.

Parameters:
Return type:

None

minimize() None

Minimize the panel (collapse it to a bar / rail strip).

Collapse is applied to the panel’s container – its floating window or its docked column – so panels stacked together minimize together, exactly like the on-screen minimize control. Imperative, like the dock_* / float() commands: it always minimizes, even if the user expanded the panel in the browser. Replayed to clients that connect later. On the mobile bottom sheet (where panels render as sections, not windows) this collapses the panel’s section.

TODO: add a matching imperative collapse/expand method for folders (GuiApi.add_folder()), which today only has the expand_by_default creation kwarg.

Return type:

None

set_height(height: float) None

Set the panel height in pixels.

Applies only to floating panels (sets the window height). A docked panel – whether solo or stacked via dock_above() / dock_below() – sizes to its split weights, so set_height has no effect there.

Parameters:

height (float)

Return type:

None

set_width(width: float) None

Set the panel width in pixels (region width when docked, window width when floating).

Parameters:

width (float)

Return type:

None

class viser.PanelHandle[source]

Handle for a standalone panel: a dockable / floating GUI container that lives outside the main control panel.

Create with GuiApi.add_panel(). Add content with add_tab(), and place it with the imperative dock_* / float() commands. A panel is a dedicated top-level entity (like a modal) – it is NOT part of the inline GUI tree – that carries its own tabs; a single-tab panel renders as a plain header.

Placement, sizing, and collapse are imperative commands, not synced state: they apply to connected clients and replay to clients that connect later, but the current layout is never read back from clients. There are no readable .width / position / minimized properties, and a user dragging or minimizing the panel afterward wins until the next explicit command. (This is why sizing is set_width() rather than a .width property.) minimize() / expand() act on the panel’s container – its floating window or its docked column – so panels stacked together minimize together, exactly like the on-screen minimize control.

The server owns a panel’s existence: users can rearrange, drag, minimize, and resize a panel, but cannot close it from the UI. A panel disappears only when remove() is called.

Note

Panels are a new API surface; method names and placement semantics may still evolve in upcoming releases.

add_tab(label: str, icon: IconName | None = None) GuiTabHandle[source]

Add a tab to the panel, returning a handle to populate it as a context.

A single-tab panel renders as a plain header; multiple tabs render as a tab strip. Raises if the panel has been removed (the shared _TabContainerMixin guard).

Parameters:
  • label (str)

  • icon (IconName | None)

Return type:

GuiTabHandle

remove() None[source]

Permanently remove this panel and all its tabs / contained elements.

This is the only way a panel disappears – there is no UI close button (see PanelHandle).

Return type:

None

dock_above(anchor: PanelHandle | MainPanelHandle) None

Stack this panel directly above another panel (a column split).

The anchor must itself be DOCKED (a column split needs a docked neighbor to split against). If the anchor is floating or not yet placed, this falls back to docking on the right edge (with a warning); dock the anchor first.

Parameters:

anchor (PanelHandle | MainPanelHandle)

Return type:

None

dock_below(anchor: PanelHandle | MainPanelHandle) None

Stack this panel directly below another panel (a column split).

The anchor must itself be DOCKED (a column split needs a docked neighbor to split against). If the anchor is floating or not yet placed, this falls back to docking on the right edge (with a warning); dock the anchor first.

Parameters:

anchor (PanelHandle | MainPanelHandle)

Return type:

None

dock_left() None

Dock this panel to the left viewport edge.

Each new left-dock is inserted at the innermost position, so several panels docked to the left appear in call order from the edge inward. Calling again repositions an already-placed panel.

Return type:

None

dock_right() None

Dock this panel to the right viewport edge.

Each new right-dock is inserted at the innermost position, so several panels docked to the right appear in call order from the edge inward. Calling again repositions an already-placed panel.

Return type:

None

expand() None

Expand (un-minimize) the panel, the inverse of minimize().

Like minimize() this acts at container scope – expanding a panel reveals its whole stack (and clears a docked column’s rail) – and is imperative: it always expands, even if the user minimized the panel in the browser. Replayed to clients that connect later.

Return type:

None

float(*, x: float | None = None, y: float | None = None, width: float | None = None, height: float | None = None) None

Float this panel at an explicit position and size, in CSS pixels.

x / y are measured relative to the viewport – the canvas area inside any docked panels:

  • A non-negative value is a gap from the left / top: float(x=40) lands 40px from the canvas left edge (clear of a left-docked panel, not under it).

  • A negative value is a gap from the right / bottom: float(x=-15) puts the panel’s right edge 15px from the canvas right edge. So float(x=-15, y=15) is the top-right corner, and float(x=-15, y=-15) the bottom-right.

The panel re-resolves against these edges as the canvas changes (a dock added/removed, the window resized), so an edge-anchored panel stays put. Any argument left as None uses a client-chosen default (top-left); width / height set the floating window size.

Parameters:
Return type:

None

minimize() None

Minimize the panel (collapse it to a bar / rail strip).

Collapse is applied to the panel’s container – its floating window or its docked column – so panels stacked together minimize together, exactly like the on-screen minimize control. Imperative, like the dock_* / float() commands: it always minimizes, even if the user expanded the panel in the browser. Replayed to clients that connect later. On the mobile bottom sheet (where panels render as sections, not windows) this collapses the panel’s section.

TODO: add a matching imperative collapse/expand method for folders (GuiApi.add_folder()), which today only has the expand_by_default creation kwarg.

Return type:

None

set_height(height: float) None

Set the panel height in pixels.

Applies only to floating panels (sets the window height). A docked panel – whether solo or stacked via dock_above() / dock_below() – sizes to its split weights, so set_height has no effect there.

Parameters:

height (float)

Return type:

None

set_width(width: float) None

Set the panel width in pixels (region width when docked, window width when floating).

Parameters:

width (float)

Return type:

None

order: float

Order value for arranging panels.

visible: bool

when False the panel renders nothing (its panes are removed from the dock layout) without being destroyed.

Type:

Visibility state of the panel

viser.PlaceableHandle = 'PanelHandle | MainPanelHandle'

str(object=’’) -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.__str__() (if defined) or repr(object). encoding defaults to sys.getdefaultencoding(). errors defaults to ‘strict’.

class viser.UploadedFile[source]

Result of a file upload.

name: str

Name of the file.

content: bytes

Contents of the file.