class Component
implements ComponentImplementation
import { Component } from "https://deno.land/x/tui@1.3.4/src/component.ts";
Base Component that should be used as base for creating other components
Constructors
new
Component(options: ComponentOptions)Type Parameters
optional
EventMap extends EventRecord = Record<never, never>Properties
rectangle: Rectangle | undefined
Returns component's rectangle
state: ComponentState
Returns current component state
readonly
style: StyleReturns current component style
theme: Theme
tui: Tui
view: ViewComponent<EventRecord> | undefined
Returns view that's currently associated with component
Methods
draw(): void
Function that's used for rendering component
It's called on tui
update event
interact(_method?: "keyboard" | "mouse"): void
Function that's used for interacting with a component It's called by keyboard and mouse control handlers
remove(): void
Remove component from tui
and dispatch removeComponent
event