Dashboard TUI library — grid layouts, panels, and more
Build dashboard-style terminal UIs with column grid layouts, framed panels, status bars, tabs, and more. Compose complex layouts from reusable components.
composer require sugarcraft/sugar-dash
use SugarCraft\Dash\Layout\Grid\{StackedGrid, Options, ItemOptions};
use SugarCraft\Dash\Components\Card\{Card, Text};
$grid = new StackedGrid(new Options(fitScreen: true));
$grid->addItem(Card::titled(Text::new('CPU 42%'), 'Load'), new ItemOptions(column: 0));
$grid->addItem(Card::titled(Text::new('3 alerts'), 'Alerts'), new ItemOptions(column: 1, expandVertical: true));
$grid->setSize(100, 24);
echo $grid->render(); // two bordered cards side by side; below 90 columns they stack
| Class | Method | Description |
|---|---|---|
| Layout\Grid\StackedGrid | __construct(Options = new Options()) | Column grid; columns stack vertically below the narrow breakpoint (90 cells) |
| Layout\Grid\StackedGrid | addItem(Item, ItemOptions = new ItemOptions()) | Add an item to a column |
| Layout\Grid\StackedGrid | setSize(width, height) / render() / withTheme(Theme) | Size, render to an ANSI string, theme |
| Layout\Grid\Options / ItemOptions | new Options(fitScreen: bool) / new ItemOptions(column: int, expandVertical: bool) | Grid and per-item options |
| Components\Card\Card | static titled(Item, string $title) | Bordered card with a title |
| Layout\Frame | static new(Item) / withTitle() / withBorder() / withPadding() | Framed panel |
VHS-recorded GIFs of every example shipped with the library. Regenerated automatically on every push that touches the source.