Skip to main content
Module

x/tui/mod.ts>Component

🦕 Deno module for creating Terminal User Interfaces
Latest
class Component
Re-export
import { Component } from "https://deno.land/x/tui@2.1.11/mod.ts";

Constructors

new
Component(options: ComponentOptions)

Properties

drawnObjects: Record<string, DrawObject | DrawObject[]>
lastInteraction: Interaction
parent: Component | Tui
style: Signal<Style>
optional
subComponentOf: Component
subComponents: Record<string, Component>
theme: Theme
tui: Tui
view: Signal<View | undefined>
visible: Signal<boolean>
zIndex: Signal<number>

Methods

changeDrawnObjectVisibility(visible: boolean, remove?): void

Changes visibility of drawnObjects (erases/draws them depending on {visible})

If {visible} is set to false and {remove} is set to true it deletes objects from drawnObjects

destroy(): void

Destroys component:

  • Disables all listeners
  • Removes all drawnObjects
  • calls destroy() on its children
  • Removes itself from subComponentOf.subComponents
  • Removes itself from parent.children
draw(): void

Draw component

If called more than one times it deletes previous drawnObjects

interact(method: "keyboard" | "mouse"): void

Interact with component using mouse/keyboard