UNPKG

@teaui/core

Version:

A high-level terminal UI library for Node

64 lines (63 loc) 2.06 kB
import { Container, type Props as ContainerProps } from '../Container.js'; import { Size } from '../geometry.js'; import { Style } from '../Style.js'; import { View } from '../View.js'; import { Viewport } from '../Viewport.js'; import { System } from '../System.js'; import { type MouseEvent } from '../events/index.js'; interface Props extends ContainerProps { /** * Draw a border around the content. * @default true */ border?: boolean; /** * Index of the selected tab. * @default 0 */ selected?: number; } interface TabProps extends ContainerProps { title?: string; } export declare class Tabs extends Container { #private; static Section: typeof Section; static create(tabs: ([string, View] | Section)[], extraProps?: Props): Tabs; constructor(props?: Props); get tabs(): Section[]; get tabTitles(): TabTitle[]; get border(): boolean; set border(value: boolean); get selected(): number; set selected(value: number); update(props: Props): void; select(tab: number): void; addTab(tab: Section): Section; addTab(title: string, child: View): Section; removeTab(index: number | Section): void; add(child: View, at?: number): void; removeChild(child: View): void; naturalSize(available: Size): Size; receiveTick(dt: number): boolean; render(viewport: Viewport): void; } declare class TabTitle extends Container { #private; onClick: ((tab: TabTitle) => void) | undefined; constructor(title: string); get title(): string; set title(value: string); get titleStyle(): Style; naturalSize(available: Size): Size; receiveMouse(event: MouseEvent, system: System): void; render(viewport: Viewport): void; } declare class Section extends Container { readonly titleView: TabTitle; static create(title: string, child: View, extraProps?: Omit<TabProps, 'title' | 'view'>): Section; constructor({ title, ...props }: TabProps); get title(): string; set title(value: string); } export {};