Flexbox-like layout container for terminal UIs.
import { Flex } from 'nikcli-tui';
new Flex({ parent: screen, direction: 'row', gap: 2 });
npm run tsx:core-gallery
npm i nikcli-tui
import { Flex, Box } from 'nikcli-tui';
const row = new Flex({ parent: screen, top: 1, left: 2, width: 60, height: 6, direction: 'row', gap: 2, borderStyle: 'line' }); new Box({ parent: row.el, width: 10, height: 3, label: 'A', borderStyle: 'line' }); new Box({ parent: row.el, width: 14, height: 3, label: 'B', borderStyle: 'line' }); row.reflow();
const col = new Flex({ parent: screen, top: 8, left: 2, width: 60, height: 10, direction: 'column', gap: 1, borderStyle: 'line' }); new Box({ parent: col.el, height: 3, label: 'Header', borderStyle: 'line' }); new Box({ parent: col.el, height: 5, label: 'Body', borderStyle: 'line' }); new Box({ parent: col.el, height: 2, label: 'Footer', borderStyle: 'line' }); col.reflow();
const f = new Flex({ parent: screen, direction: 'row', gap: 2 }); f.setGap(4); f.reflow();