$ Box

static output6 styles

Bordered panels and cards with 6 border styles, title positioning, and configurable padding.

# Preview

box demo
╭─ Server Status ────────────────╮
│                                  │
│  Status:  ● Online              │
│  Uptime:  12d 4h 32m           │
│  CPU:     23%                  │
│  Memory:  4.2 GB / 16 GB       │
│                                  │
╰──────────────────────────────────╯
Border styles:
╭──────╮  ┌──────┐  ╔══════╗  ┏━━━━━━┓  ┌┄┄┄┄┄┄┐  +------+
│round │  │single│  ║double║  ┃ heavy┃  ┆dashed┆  |ascii |
╰──────╯  └──────┘  ╚══════╝  ┗━━━━━━┛  └┄┄┄┄┄┄┘  +------+

# Usage

example.ts
import { Box, fg, style, colorize } from "@vr_patel/tui";

const box = new Box({
  title: "Server Status",
  borderStyle: "round",     // round | single | double | heavy | dashed | ascii
  borderColor: fg.cyan,
  padding: 1,
  paddingY: 1,
});

console.log(box.render(
  colorize("Status: ", fg.gray) + colorize("● Online", fg.green, style.bold) + "\n" +
  colorize("Uptime: ", fg.gray) + "12d 4h 32m" + "\n" +
  colorize("CPU:    ", fg.gray) + colorize("23%", fg.yellow)
));

# API

PropTypeDefaultDescription
titlestringundefinedTitle shown in the top border
titleAlignment"left" | "center" | "right""left"Title position in the border
borderStylestring | BorderStyle"round"Border style name or custom characters
borderColorstringfg.grayANSI color for the border
titleColorstringfg.brightWhite + boldANSI color for the title
paddingnumber1 (X) / 0 (Y)Padding inside the box
paddingXnumber1Horizontal padding
paddingYnumber0Vertical padding
widthnumberautoFixed width or auto-sized
dimBorderbooleanfalseApply dim style to border