All 48 libraries

SugarDashboard

Dashboard TUI library — column grid, constraint layout, ratio grid, data grid, tree, modal, status bar, tabs, plot/canvas, and a module/plugin system

inspired by shahar3/bubble-grid · aristocratos/btop · gizak/termui dashboardlayoutgridpanel

SugarDashboard code coverage

Build dashboard-style terminal UIs with a column grid, constraint layout, ratio grid, data grid, tree views, modals, status bars, tabs, and plot/canvas rendering. Compose complex layouts from reusable components, and extend the whole system through the module/plugin layer. All motion is frame-driven — the library renders synchronously and the host supplies every frame, so a reduced-motion presentation is always reachable by holding the frames still.

Install

composer require sugarcraft/sugar-dashboard

Quickstart

use SugarCraft\Dashboard\Layout\Grid\{StackedGrid, Options, ItemOptions};
use SugarCraft\Dashboard\Components\Card\{Card, Text};

$grid = (new StackedGrid(new Options(fitScreen: true)))
    ->withItem(Card::titled(Text::new('CPU 42%'), 'Load'), new ItemOptions(column: 0))
    ->withItem(Card::titled(Text::new('3 alerts'), 'Alerts'), new ItemOptions(column: 1, expandVertical: true));

// Every with*() / setSize() returns a sized COPY — keep the result.
$grid = $grid->setSize(100, 24);
echo $grid->render();   // two bordered cards side by side; below 90 columns they stack

What's in the box

StackedGridColumn grid that splits width evenly (floor(width ÷ columns) per column) and stacks when narrow — gap and percentage sizing live in GridLayout.
FrameFramed panel with border, title, and padding.
StatusBarStatus bar component for dashboard footers.
TabsTabbed interface for switching between views.
Card / Paragraph / TextReusable UI components for building panels.
Event systemKeyboard, mouse, focus, and resize event handling.
DualSampleGraphbtop's history graph: two samples per cell quantized through the 5×5 graph_symbols table, in braille / block / block2 / tty families, with invert, no-zero, max-value scaling, gradient coloring and the graph_bg underlay.
Position-colored MeterMeter::withGradient($stops, positionWise: true) renders btop's one-row ■ bar — each cell colored at its own position on a 101-stop ramp, meter_bg tail, invert, memoized per shape.
GradientsGradient101::expand() (btop's integer ramp law), GradientStore named ramps (at('cpu', 73)), and value-driven BrailleCanvas::withGradient().
NetAutoScalebtop's network-graph ceiling hysteresis: grows or shrinks only after 5 sustained samples, 10 KiB floor, optional shared (sync) ceiling.
Process rowsProcRowComposer renders a btop process-list row (pid … mem, 5×1 cpu mini-graph on graph_bg, cpu%) with DistanceFade shading; ProcGraphTracker manages per-pid graphs.

btop-style graphs & meters

Ported from aristocratos/btop for candy-top; color and quantization laws are byte-faithful to btop. Run php examples/dual-sample-graph.php for every family.

use SugarCraft\Core\Util\Color;
use SugarCraft\Dashboard\Plot\Braille\DualSampleGraph;
use SugarCraft\Dashboard\Plot\Chart\Meter;

$stops = [Color::hex('#80d0a3'), Color::hex('#dcd179'), Color::hex('#d45454')];

echo DualSampleGraph::new(12, 3)
    ->withGradient($stops)
    ->withData(5, 12, 30, 55, 80, 95, 70, 45, 20, 10, 35, 60)
    ->render(), "\n";

echo Meter::new(0.62)->withWidth(20)->withGradient($stops, positionWise: true)->render(), "\n";

Showcase examples

Complex Dashboard Charts, stats, funnels, sparklines in a full StackedGrid layout.
View gif →
Metrics Dashboard Key statistics and status indicators.
View gif →
Status Indicators Spinners, progress bars, gauges, alerts.
View gif →
Interactive Dashboard Accordion, timeline, and card components.
View gif →
Server Showcase Production dashboard — gauges, charts, avatars, timeline in multi-column layout.
View gif →

Source & demos

Try the quickstart →

Concepts

The library renders synchronously. Nothing animates on its own: the host calls render() for every frame, so a static frame is always available and motion is the host's choice.

Grids and components are immutable. withItem() and setSize() return a changed copy, and the receiver keeps its old state. Keep the returned value, as the Quickstart and Troubleshooting examples do.

API reference

ClassMethodDescription
Layout\Grid\StackedGrid__construct(Options = new Options())Column grid; columns stack vertically below the narrow breakpoint (90 cells)
Layout\Grid\StackedGridaddItem(Item, ItemOptions = new ItemOptions())Add an item to a column
Layout\Grid\StackedGridsetSize(width, height) / render() / withTheme(Theme)Size, render to an ANSI string, theme
Layout\Grid\Options / ItemOptionsnew Options(fitScreen: bool) / new ItemOptions(column: int, expandVertical: bool)Grid and per-item options
Components\Card\Cardstatic titled(Item|string, string $title)Bordered card with a title
Layout\Framestatic new(Item) / withTitle() / withBorder() / withPadding()Framed panel
Plot\Gradient101static expand(list<Color> $stops)btop's 101-entry ramp (index = percent), truncating integer law
Plot\Braille\BrailleCanvaswithGradient(stops, ?scale) / withValue(v) / withoutGradient() / gradient() / value()Null-color dots take the ramp color at the current value
Plot\Braille\DualSampleGraphstatic new(width, height, family, invert, noZero, maxValue, offset)btop Draw::Graph; families FAMILY_BRAILLE / FAMILY_BLOCK / FAMILY_BLOCK2 / FAMILY_TTY
Plot\Braille\DualSampleGraphpush(...$v) / withData(...$v) / withGradient(stops) / withUnderlay(Color) / render(?profile)Append or replace history, color, underlay, render
Plot\Braille\DualSampleGraphstatic underlay(family, cells, Color)Bare btop graph_bg strip (⣀ ▄ 🬭 ░)
Plot\Chart\MeterwithGradient(stops, positionWise) / withGlyph() / withInvert() / withMeterBg()btop Draw::Meter position-colored bar; memoStats() / resetMemo()
Foundation\NetAutoScalestatic new(sync) / offer(down, up) / downloadMax() / uploadMax() / maxFor(dir) / counters(dir) / forceRescale() / rescaleNow() / rescalePending()btop net-graph ceiling hysteresis; the $sync / $rescaled result flags are public readonly
Foundation\GradientStorestatic fromStops(array) / static ramp(start, ?mid, ?end) / withGradient(name, start, ?mid, ?end) / at(name, percent) / gradient(name) / has(name) / names()Named 101-entry ramps (btop Theme::g)
Plot\DistanceFaderamp() / distance() / fadeIndex() / fadeColor() / metricPosition() / metricColor() / flatMetricColor() / metricValues()btop proc-list distance fade
Plot\ProcRow\ProcRowComposerstatic new(width) / withColumns() / withPalette() / withProcColors() / withProcGradient() / withFamily() / row(ProcRow, row, selected, selectMax, ?graph, followed, ?profile)One btop process-list row; ProcRow, ProcColumns, ProcRowPalette, ProcGraphTracker supply data, layout, colors and mini-graphs

Configuration

The defaults below are the values the classes ship with.

  • Options::$fitScreen: bool, default true. Option of Layout\Grid\Options. Whether columns fit the screen width. Widths under 90 cells collapse to one full-width column before this option is read.
  • ItemOptions(column:, expandVertical:): int, bool, default column 0 and expandVertical false. Places an item in a column and lets it take the spare height.
  • Narrow breakpoint: fixed at 90 cells in StackedGrid. Below this width it stacks every item into one column. StackedGrid::render() calls Breakpoint::narrow() with no threshold, so the threshold is not configurable on the grid. The second argument, Breakpoint::narrow($width, $threshold), is a parameter only of the standalone helper.
  • DualSampleGraph::new(..., $family): string, default FAMILY_BRAILLE. Symbol family: braille, block, block2 or tty.
  • DualSampleGraph::new(..., $invert, $noZero, $maxValue): bool, bool, int, default false, false, 0. Flips the graph, hides zero samples, and sets the scale ceiling.
  • Meter::withGradient($stops, positionWise:): list of colors, bool, default no gradient. Colors each cell by its position on the ramp when positionWise is true.

Keys

Keys\KeyMap binds keys to actions on a component's content. on() registers a key, optionally with Ctrl, Alt or Shift, and off() removes it. has() and registeredKeys() report what is bound. A key bound twice keeps its first action, and the later one is logged and ignored.

Each action is a callable that takes the Key and returns the Foundation\Item that replaces the content. Return $content to keep the content as it is; returning null throws a TypeError when the key is pressed.

use SugarCraft\Dashboard\Keys\KeyMap;

$keys = KeyMap::new($content)
    ->on('r', fn () => $content)
    ->on('q', fn () => $content, ctrl: true);

Keys\KeyRegistry is a separate, process-wide table. It stores each binding with a description and a category, so status bars and help screens can list them. register(), get(), byCategory(), categories() and match() read and write that table, and reset() empties it.

Theming

Foundation\Theme has five presets: dark(), light(), dracula(), oneDark() and githubDark(). Pass one to StackedGrid::withTheme(), which applies it to every theme-aware item in the grid. Items that do not implement Foundation\Drawable are passed through unchanged and keep their own theme.

use SugarCraft\Dashboard\Foundation\Theme;

$grid = $grid->withTheme(Theme::dracula());

Examples

examples/ holds 155 PHP files. Most are one component each, named after it (for example meter.php, modal.php, stackedGrid.php and gridLayout.php), and the dashboard-*.php files are full layouts. The headline examples are:

  • dashboard-live.php: The canonical interactive dashboard, driven by a Program event loop.
  • dashboard-showcase.php: A production-style server dashboard with gauges, charts, avatars and a timeline in a multi-column layout.
  • dual-sample-graph.php: The same CPU history through each symbol family, an inverted graph and a one-row meter.
  • plot-braille.php: Scatter and line modes of Plot, drawn with braille dots from identical data.
  • run-all.php: Batch runner that executes the component examples and reports each one's result.
  • generate-all.php: Generator that writes one example file per visual component.

Testing

cd sugar-dashboard
composer install
vendor/bin/phpunit

The suite is plain PHPUnit 10 with the root vendor/autoload.php bootstrap. It does not use sugar-testing.

Only methods declared in sugar-dashboard/src, or inherited from a parent declared there, are listed. A type that extends a class outside that tree, such as \RuntimeException, does not show the methods of that class.

SugarCraft\Dashboard\Components\Calendar

Calendar final class

A simple calendar component.

MethodSummary
__construct(private readonly int $year, private readonly int $month, private readonly int $startDayOfWeek = 0, private readonly ?int $highlightDay = null, private readonly array $markedDays = [], private readonly ?Color $headerColor = null, private readonly ?Color $todayColor = null, private readonly ?Color $markerColor = null)
static now(): selfCreate a calendar for the current month.
static of(int $year, int $month): selfCreate a calendar for a specific year and month.
setSize(int $width, int $height): \SugarCraft\Dashboard\Foundation\SizerSet the allocated dimensions for this calendar.
innerSize(): arrayCalculate the natural dimensions of this calendar.
render(): stringRender the calendar.
withStartDayOfWeek(int $day): selfSet the start day of week (0 = Sunday, 1 = Monday, etc).
withHighlightDay(?int $day): selfSet the highlighted day (e.g., today).
withMarkedDays(array $days): selfSet marked days (e.g., events).
withHeaderColor(?Color $color): selfSet the header color.
withTodayColor(?Color $color): selfSet the today color.
withMarkerColor(?Color $color): selfSet the color used for the marker glyph on marked days (finding sugar-dashboard-163: the markerColor the ctor accepts and render consults had no wither, so the promoted-only color trio was half-documented).

HeatmapCalendar final class

A calendar heatmap component (GitHub-style contributions).

MethodSummary
__construct(private readonly array $data, private readonly bool $showLabels = true, private readonly bool $showMonthLabels = false, private readonly bool $showDayLabels = true, private readonly ?Color $lowColor = null, private readonly ?Color $highColor = null, private readonly string $emptyChar = '·')
static new(array $data): selfCreate a new calendar heatmap with default styling.
static sample(int $weeks = 20, float $baseValue = 0.3): selfCreate sample data for demonstration.
setSize(int $width, int $height): \SugarCraft\Dashboard\Foundation\SizerSet the allocated dimensions for this heatmap.
render(): stringRender the calendar heatmap.
innerSize(): arrayCalculate the natural dimensions of this heatmap.
dataDimensions(): arrayGet the dimensions of the data grid.
getDataDimensions(): arrayBC forwarder for the pre-rename accessor name.
totalValue(): floatGet the total value across all cells.
getTotalValue(): floatBC forwarder for the pre-rename accessor name.
averageValue(): floatGet the average value across all cells.
getAverageValue(): floatBC forwarder for the pre-rename accessor name.
withLabels(bool $show): selfShow or hide labels.
withMonthLabels(bool $show): selfShow or hide month labels.
withDayLabels(bool $show): selfShow or hide day labels.
withLowColor(?Color $color): selfSet the low (cold) color.
withHighColor(?Color $color): selfSet the high (hot) color.
withEmptyChar(string $char): selfSet the empty cell character.

ListComponent final class

A scrollable list component with item selection.

MethodSummary
__construct(private readonly array $items, private readonly int $selected = 0, private readonly ?\Closure $filter = null, private readonly bool $showCursor = true, private readonly string $style = self::Bullet, private readonly HAlign $itemAlign = HAlign::Left)
static new(array $items): selfCreate a new list with the given items.
setSize(int $width, int $height): \SugarCraft\Dashboard\Foundation\SizerSet the allocated dimensions for this list.
render(): stringRender the list with selection cursor.
innerSize(): arrayCalculate the natural dimensions of this list when rendered.
withItems(array $items): selfSet the items for this list.
withSelected(int $selected): selfSet the selected index.
withFilter(?\Closure $filter): selfSet a filter predicate for items.
withShowCursor(bool $showCursor): selfShow or hide the cursor indicator.
withStyle(string $style): selfSet the list style (bullet, number, arrow, plain).
withItemAlign(HAlign $align): selfSet the item alignment within the list width.

SugarCraft\Dashboard\Components\Card

Accordion final class

An accordion component that displays collapsible sections.

MethodSummary
__construct(array $sections)
static new(array $sections): selfCreate a new accordion with the given sections.
static fromPairs(array $pairs): selfCreate an accordion from key-value pairs.
setSize(int $width, int $height): SizerSet the size of this accordion.
innerSize(): arrayGet the inner dimensions of this accordion.
withHeaderColor(Color $color): selfSet the header color.
withIcons(string $collapsed, string $expanded): selfSet custom icons for collapsed/expanded states.
withShowBorder(bool $show): selfToggle border visibility.
withSections(array $sections): selfUpdate sections.
withOpenSection(int $index): selfOpen a specific section by index.
render(): stringRender the accordion.

ActivityEvent final readonly class

An event in an activity feed.

MethodSummary
__construct(public string $actor, public string $action, public string $target, public string $type = 'default', public ?string $timestamp = null)

ActivityFeed final class

An activity feed component for displaying a stream of events.

MethodSummary
__construct(private readonly array $events = [], private readonly bool $showIcons = true, private readonly bool $showTimestamps = true, private readonly bool $showAvatars = false, private readonly ?Color $iconColor = null, private readonly ?Color $timestampColor = null, private readonly ?Color $textColor = null, private readonly int $maxItems = 10)
static new(array $events = []): selfCreate a new activity feed.
static sample(): selfCreate a sample activity feed for demonstration.
setSize(int $width, int $height): \SugarCraft\Dashboard\Foundation\SizerSet the allocated dimensions for this feed.
render(): stringRender the activity feed.
innerSize(): arrayCalculate the natural dimensions of this feed.
withEvents(array $events): selfSet the events.
withShowIcons(bool $show): selfShow or hide icons.
withShowTimestamps(bool $show): selfShow or hide timestamps.
withMaxItems(int $max): selfSet the maximum number of items to display.

Badge final class

A badge/tag component for displaying labels and statuses.

MethodSummary
__construct(private readonly string $text, private readonly ?Color $bgColor = null, private readonly ?Color $textColor = null, private readonly string $style = self::StyleSolid, private readonly string $size = self::SizeMd, private readonly ?string $icon = null)
static new(string $text): selfCreate a new badge.
static success(string $text): selfCreate a success badge.
static warning(string $text): selfCreate a warning badge.
static error(string $text): selfCreate an error badge.
static danger(string $text): selfCreate a danger badge.
static info(string $text): selfCreate an info badge.
static bool(?bool $value, string $yes = 'Yes', string $no = 'No', string $unknown = 'Unknown'): selfCreate a boolean badge: true → success (Yes), false → error (No), null → a subtle "Unknown" badge.
static tristate(?bool $value): selfCreate a tri-state checkbox glyph badge: true → "[x]" (green), false → "[ ]" (subdued), null → "[~]" (amber). Rendered as the bare glyph (subtle style) so it can sit inline in a toggle list.
setSize(int $width, int $height): \SugarCraft\Dashboard\Foundation\SizerSet the allocated dimensions for this badge.
innerSize(): arrayCalculate the natural dimensions of this badge.
render(): stringRender the badge.
withBgColor(?Color $color): selfSet the background color.
withTextColor(?Color $color): selfSet the text color.
withStyle(string $style): selfSet the style.
withSize(string $size): selfSet the size.
withIcon(?string $icon): selfSet the icon.
withTheme(Theme $theme): selfApply a theme to this badge, using the theme's primary color.
rect(): Rect
setRect(Rect $rect): self
draw(Buffer $buffer): void

BadgeGroup final class

A group of badges displayed in a row.

MethodSummary
__construct(array $badges = [], private readonly int $gap = 1, private readonly bool $wrap = false)
static fromLabels(array $labels): selfCreate a new badge group from a list of labels.
static success(array $labels): selfCreate a styled badge group with success badges.
static warning(array $labels): selfCreate a styled badge group with warning badges.
static danger(array $labels): selfCreate a styled badge group with danger badges.
static info(array $labels): selfCreate a styled badge group with info badges.
setSize(int $width, int $height): \SugarCraft\Dashboard\Foundation\SizerSet the allocated dimensions for this badge group.
render(): stringRender the badge group as a string.
innerSize(): arrayCalculate the natural dimensions of this badge group.
withBadges(array $badges): selfSet the badges in this group.
withAppended(Badge $badge): selfAdd a badge to this group.
withGap(int $gap): selfSet the gap between badges.
withWrap(bool $wrap): selfSet the wrap behavior.

BorderText final class

Text with ASCII-art style border characters.

MethodSummary
__construct(private readonly \SugarCraft\Dashboard\Foundation\Item|string $content, private readonly ?Color $borderColor = null, private readonly ?Color $textColor = null, private readonly string $style = 'single', private readonly int $topPadding = 0, private readonly int $bottomPadding = 0)
static new(\SugarCraft\Dashboard\Foundation\Item|string $content): selfCreate a new border text component.
static withBorders(\SugarCraft\Dashboard\Foundation\Item|string $content): selfCreate with a top and bottom border.
setSize(int $width, int $height): \SugarCraft\Dashboard\Foundation\SizerSet the allocated dimensions for this component.
render(): stringRender the bordered text.
innerSize(): arrayCalculate the natural dimensions.
withBorderColor(?Color $color): selfSet the border color.
withTextColor(?Color $color): selfSet the text color.
withStyle(string $style): selfSet the border style.
withPadding(int $top, int $bottom): selfSet the top and bottom padding.
withContent(\SugarCraft\Dashboard\Foundation\Item|string $content): selfSet the content.

BoxDrawing final class

Box drawing frame generator using Unicode box-drawing characters.

MethodSummary
__construct(private readonly ?string $title = null, private readonly ?string $subtitle = null, private readonly ?Color $borderColor = null, private readonly ?Color $bgColor = null, private readonly string $style = 'single', private readonly bool $showTopBorder = true, private readonly bool $showBottomBorder = true, private readonly bool $showLeftBorder = true, private readonly bool $showRightBorder = true, private readonly bool $showTitleBar = false, private readonly bool $showSubtitleBar = false)
static new(?string $title = null): selfCreate a new box drawing component.
static titled(string $title): selfCreate a box with a title.
static double(?string $title = null): selfCreate a double-line box.
static rounded(?string $title = null): selfCreate a rounded box.
static bold(?string $title = null): selfCreate a bold box.
setSize(int $width, int $height): \SugarCraft\Dashboard\Foundation\SizerSet the allocated dimensions for this component.
render(): stringRender the box drawing.
innerSize(): arrayCalculate the natural dimensions.
withTitle(?string $title): selfSet the title.
withSubtitle(?string $subtitle): selfSet the subtitle.
withBorderColor(?Color $color): selfSet the border color.
withBgColor(?Color $color): selfSet the background color.
withStyle(string $style): selfSet the border style.
withBorders(?bool $top = null, ?bool $bottom = null, ?bool $left = null, ?bool $right = null): selfShow/hide specific borders.

Bullet final class

A horizontal bullet chart component.

MethodSummary
__construct(private readonly float $actual, private readonly float $target, private readonly ?int $widthConstraint = null, private readonly bool $showTarget = true, private readonly bool $showComparative = false, private readonly ?float $comparative = null, private readonly ?Color $actualColor = null, private readonly ?Color $targetColor = null, private readonly ?Color $comparativeColor = null, private readonly ?Color $backgroundColor = null, private readonly string $filledChar = '█', private readonly string $emptyChar = '░', private readonly string $targetChar = '│', private readonly string $comparativeChar = '─')
static new(float $actual, float $target): selfCreate a new bullet chart with default styling.
setSize(int $width, int $height): \SugarCraft\Dashboard\Foundation\SizerSet the allocated dimensions for this bullet chart.
render(): stringRender the bullet chart as a string.
innerSize(): arrayCalculate the natural dimensions of this bullet chart.
withActual(float $actual): selfSet the actual value.
withTarget(float $target): selfSet the target value.
withWidth(int $width): selfSet the width constraint.
withShowTarget(bool $show): selfShow or hide the target marker.
withShowComparative(bool $show): selfShow or hide the comparative measure.
withComparative(?float $value): selfSet the comparative value.
withActualColor(?Color $color): selfSet the actual value color.
withTargetColor(?Color $color): selfSet the target color.
withComparativeColor(?Color $color): selfSet the comparative color.
withBackgroundColor(?Color $color): selfSet the background color.
withChars(string $filled, string $empty): selfSet custom characters for filled and empty portions.

CTA final class

A call-to-action button component.

MethodSummary
__construct(private readonly string $label = 'Get Started', private readonly string $description = '', private readonly ?Color $bgColor = null, private readonly ?Color $textColor = null, private readonly ?Color $borderColor = null, private readonly string $borderChar = '═', private readonly string $style = 'rounded', private readonly bool $showArrow = true)
static new(string $label, string $description = ''): selfCreate a new CTA button with default styling.
static primary(string $label, string $description = ''): selfCreate a primary CTA button.
static success(string $label, string $description = ''): selfCreate a success CTA button.
static danger(string $label, string $description = ''): selfCreate a danger/warning CTA button.
static outline(string $label, string $description = ''): selfCreate an outline style CTA button.
setSize(int $width, int $height): \SugarCraft\Dashboard\Foundation\SizerSet the allocated dimensions for this CTA.
render(): stringRender the CTA as a string.
innerSize(): arrayCalculate the natural dimensions of this CTA.
withLabel(string $label): selfSet the button label.
withDescription(string $description): selfSet the description text.
withBgColor(?Color $color): selfSet the background color.
withTextColor(?Color $color): selfSet the text color.
withBorderColor(?Color $color): selfSet the border color.
withBorderChar(string $char): selfSet the border character.
withStyle(string $style): selfSet the button style.
withShowArrow(bool $show): selfShow or hide the arrow.

Card final class

A card / container component with optional header and footer.

MethodSummary
__construct(private readonly \SugarCraft\Dashboard\Foundation\Item|string $content, private readonly ?string $title = null, private readonly \SugarCraft\Dashboard\Foundation\Item|string|null $footer = null, private readonly ?Color $borderColor = null, private readonly ?Color $titleColor = null, private readonly string $style = 'single', private readonly int $padding = 1)
static new(\SugarCraft\Dashboard\Foundation\Item|string $content): selfCreate a new card with default styling.
static titled(\SugarCraft\Dashboard\Foundation\Item|string $content, string $title): selfCreate a card with a title (factory method).
setSize(int $width, int $height): \SugarCraft\Dashboard\Foundation\SizerSet the allocated dimensions for this card.
render(): stringRender the card as a string.
innerSize(): arrayCalculate the natural dimensions of this card.
withContent(\SugarCraft\Dashboard\Foundation\Item|string $content): selfSet the card content.
withTitle(?string $title): selfSet the card title.
withFooter(\SugarCraft\Dashboard\Foundation\Item|string|null $footer): selfSet the card footer.
withBorderColor(?Color $color): selfSet the border color.
withTitleColor(?Color $color): selfSet the title color.
withStyle(string $style): selfSet the border style.
withPadding(int $padding): selfSet the content padding.
withTheme(Theme $theme): selfApply a theme to this card, using the theme's primary color for border and title.
rect(): Rect
setRect(Rect $rect): self
draw(Buffer $buffer): void

Chip final class

A chip component for compact, selectable items.

MethodSummary
__construct(private readonly string $label, private readonly ?Color $foregroundColor = null, private readonly ?Color $backgroundColor = null, private readonly bool $selected = false, private readonly bool $deletable = false, private readonly string $deleteIcon = '×')
static new(string $label): selfCreate a new chip with default styling.
static primary(string $label): selfCreate a primary-style chip.
static success(string $label): selfCreate a success-style chip.
static warning(string $label): selfCreate a warning-style chip.
static danger(string $label): selfCreate a danger-style chip.
setSize(int $width, int $height): \SugarCraft\Dashboard\Foundation\SizerSet the allocated dimensions for this chip.
render(): stringRender the chip as a string.
innerSize(): arrayCalculate the natural dimensions of this chip.
withLabel(string $label): selfSet the chip label.
withForegroundColor(?Color $color): selfSet the foreground (text) color.
withBackgroundColor(?Color $color): selfSet the background color.
withSelected(bool $selected): selfSet the selected state.
withDeletable(bool $deletable): selfSet the deletable state.
withDeleteIcon(string $icon): selfSet the delete icon character.

ChipGroup final class

A group of chips displayed in a row.

MethodSummary
__construct(array $chips = [], private readonly int $gap = 1, private readonly bool $wrap = false)
static fromLabels(array $labels): selfCreate a new chip group from a list of labels.
static primary(array $labels): selfCreate a styled chip group with primary chips.
static success(array $labels): selfCreate a styled chip group with success chips.
static warning(array $labels): selfCreate a styled chip group with warning chips.
static danger(array $labels): selfCreate a styled chip group with danger chips.
setSize(int $width, int $height): \SugarCraft\Dashboard\Foundation\SizerSet the allocated dimensions for this chip group.
render(): stringRender the chip group as a string.
innerSize(): arrayCalculate the natural dimensions of this chip group.
withChips(array $chips): selfSet the chips in this group.
withAppended(Chip $chip): selfAdd a chip to this group.
withGap(int $gap): selfSet the gap between chips.
withWrap(bool $wrap): selfSet the wrap behavior.

Code final class

A code block / snippet display component.

MethodSummary
__construct(private readonly string $code, private readonly ?string $language = null, private readonly ?int $maxWidth = null, private readonly bool $wordWrap = true, private readonly HAlign $horizontalAlign = HAlign::Left, private readonly ?Color $backgroundColor = null, private readonly ?Color $textColor = null, private readonly ?Color $borderColor = null, private readonly ?Color $languageColor = null)
static new(string $code, ?string $language = null): selfCreate a new code block with default styling.
setSize(int $width, int $height): \SugarCraft\Dashboard\Foundation\SizerSet the allocated dimensions for this code block.
render(): stringRender the code block as a string.
innerSize(): arrayCalculate the natural dimensions of this code block.
withLanguage(?string $language): selfSet the language label.
withMaxWidth(?int $maxWidth): selfSet the maximum width for word-wrapping.
withWordWrap(bool $wordWrap): selfEnable or disable word-wrapping.
withHorizontalAlign(HAlign $align): selfSet the horizontal alignment.
withBackgroundColor(?Color $color): selfSet the background color.
withTextColor(?Color $color): selfSet the text color.
withBorderColor(?Color $color): selfSet the border color.
withLanguageColor(?Color $color): selfSet the language label color.
withCode(string $code): selfSet new code content.

Comment final class

A comment/note display component.

MethodSummary
__construct(private readonly string $author, private readonly string $body, private readonly ?string $timestamp = null, private readonly ?Avatar $avatar = null, private readonly bool $isReply = false, private readonly bool $isEdited = false, private readonly ?Color $headerColor = null)
static new(string $author, string $body): selfCreate a new comment.
static reply(string $author, string $body): selfCreate a reply comment.
setSize(int $width, int $height): \SugarCraft\Dashboard\Foundation\SizerSet the allocated dimensions for this comment.
render(): stringRender the comment as a string.
innerSize(): arrayCalculate the natural dimensions of this comment.
withAuthor(string $author): selfSet the author name.
withBody(string $body): selfSet the comment body.
withTimestamp(?string $timestamp): selfSet the timestamp.
withAvatar(?Avatar $avatar): selfSet the avatar.
withIsReply(bool $isReply): selfSet the reply flag.
withIsEdited(bool $isEdited): selfSet the edited flag.
withHeaderColor(?Color $color): selfSet the header color.

Cover final class

A full coverage layout component.

MethodSummary
__construct(private readonly \SugarCraft\Dashboard\Foundation\Item $content, private readonly HAlign $horizontalAlign = HAlign::Center, private readonly VAlign $verticalAlign = VAlign::Middle)
static new(\SugarCraft\Dashboard\Foundation\Item $content): selfCreate a new cover layout with the given content.
static topLeft(\SugarCraft\Dashboard\Foundation\Item $content): selfCreate a cover layout aligned to the top-left corner.
static topRight(\SugarCraft\Dashboard\Foundation\Item $content): selfCreate a cover layout aligned to the top-right corner.
static bottomLeft(\SugarCraft\Dashboard\Foundation\Item $content): selfCreate a cover layout aligned to the bottom-left corner.
static bottomRight(\SugarCraft\Dashboard\Foundation\Item $content): selfCreate a cover layout aligned to the bottom-right corner.
setSize(int $width, int $height): \SugarCraft\Dashboard\Foundation\SizerSet the allocated dimensions for this cover layout.
render(): stringRender the cover layout - content fills the entire space.
innerSize(): arrayCalculate the natural dimensions of this layout.
withAlignment(HAlign $horizontalAlign): selfSet the horizontal alignment.
withVerticalAlign(VAlign $verticalAlign): selfSet the vertical alignment.
withContent(\SugarCraft\Dashboard\Foundation\Item $content): selfSet the content.

DefinitionList final class

A definition list: aligned label : value rows with a placeholder for missing values.

MethodSummary
__construct(private readonly array $rows = [], private readonly string $separator = ' : ', private readonly string $placeholder = '—', private readonly ?Color $labelColor = null, private readonly ?Color $valueColor = null, private readonly ?Color $placeholderColor = null)
static new(): selfCreate an empty definition list with default styling.
static fromMap(array $items): selfCreate a definition list from a label => value map.
row(string $label, ?string $value): selfAppend a label/value row. A null value renders as the placeholder.
withRows(array $rows): selfReplace all rows.
withSeparator(string $separator): selfSet the label/value separator (default " : ").
withPlaceholder(string $placeholder): selfSet the placeholder shown for null values (default "—").
withLabelColor(?Color $color): selfSet the label color.
withValueColor(?Color $color): selfSet the value color.
withPlaceholderColor(?Color $color): selfSet the color used for the null placeholder.
setSize(int $width, int $height): \SugarCraft\Dashboard\Foundation\SizerSet the allocated dimensions for this list.
innerSize(): arrayCalculate the natural dimensions of this list.
render(): stringRender the definition list, one row per line.

Diff final class

A text diff display component.

MethodSummary
__construct(private readonly string $oldText, private readonly string $newText, private readonly bool $showLineNumbers = true, private readonly bool $showContext = true, private readonly int $contextLines = 3, private readonly ?Color $addedColor = null, private readonly ?Color $removedColor = null, private readonly ?Color $unchangedColor = null)
static new(string $oldText, string $newText): selfCreate a new diff with default styling.
setSize(int $width, int $height): \SugarCraft\Dashboard\Foundation\SizerSet the allocated dimensions for this diff.
render(): stringRender the diff.
innerSize(): arrayCalculate the natural dimensions of this diff.
stats(): arrayGet statistics about the diff.
getStats(): arrayBC forwarder for the pre-rename accessor name.
withLineNumbers(bool $show): selfShow or hide line numbers.
withContext(bool $show): selfShow or hide context lines.
withContextLines(int $count): selfSet the context line count.
withAddedColor(?Color $color): selfSet the color for added lines.
withRemovedColor(?Color $color): selfSet the color for removed lines.

Divider final class

A divider line component.

MethodSummary
__construct(private readonly ?string $label = null, private readonly string $style = self::StyleSolid, private readonly ?Color $color = null, private readonly bool $horizontal = true, private readonly int $thickness = 1)
static new(?string $label = null): selfCreate a new divider.
static h(?string $label = null): selfCreate a horizontal divider.
static v(?string $label = null): selfCreate a vertical divider.
setSize(int $width, int $height): \SugarCraft\Dashboard\Foundation\SizerSet the allocated dimensions for this divider.
innerSize(): arrayCalculate the natural dimensions of this divider.
render(): stringRender the divider.
withStyle(string $style): selfSet the style.
withColor(?Color $color): selfSet the color.
withLabel(?string $label): selfSet the label.
withHorizontal(bool $horizontal): selfSet horizontal orientation.
withThickness(int $thickness): selfSet the thickness.

Features final class

A features grid display component.

MethodSummary
__construct(private readonly array $items = [], private readonly int $columns = 3, private readonly ?Color $iconColor = null, private readonly ?Color $titleColor = null, private readonly ?Color $descriptionColor = null, private readonly ?Color $borderColor = null, private readonly string $borderChar = '│')
static new(array $features): selfCreate a new features grid with default styling.
static compact(array $features): selfCreate a compact features grid with 2 columns.
setSize(int $width, int $height): \SugarCraft\Dashboard\Foundation\SizerSet the allocated dimensions for this features grid.
render(): stringRender the features grid as a string.
innerSize(): arrayCalculate the natural dimensions of this features grid.
withItems(array $items): selfSet the feature items.
withColumns(int $columns): selfSet the number of columns.
withIconColor(?Color $color): selfSet the icon color.
withTitleColor(?Color $color): selfSet the title color.
withDescriptionColor(?Color $color): selfSet the description color.
withBorderColor(?Color $color): selfSet the border color.
withBorderChar(string $char): selfSet the border character.

A page footer component.

MethodSummary
__construct(private readonly string $content = '', HAlign|string $align = HAlign::Left, private readonly ?Color $borderColor = null, private readonly ?Color $textColor = null, private readonly ?Color $bgColor = null, private readonly string $borderPosition = 'top')
static new(string $content = ''): selfCreate a new footer with default styling.
static copyright(string $holder = '', ?int $year = null): selfCreate a footer with copyright notice.
setSize(int $width, int $height): \SugarCraft\Dashboard\Foundation\SizerSet the allocated dimensions for this footer.
render(): stringRender the footer as a string.
innerSize(): arrayCalculate the natural dimensions of this footer.
withContent(string $content): selfSet the footer content.
withAlign(HAlign|string $align): selfSet the text alignment (HAlign case; legacy strings accepted with a deprecation notice).
withBorderColor(?Color $color): selfSet the border color.
withTextColor(?Color $color): selfSet the text color.
withBgColor(?Color $color): selfSet the background color.
withBorderPosition(string $position): selfSet the border position.

Header final class

A page header component for displaying titles and subtitles.

MethodSummary
__construct(private readonly string $title = '', private readonly string $subtitle = '', HAlign|string $alignment = HAlign::Left, private readonly ?Color $titleColor = null, private readonly ?Color $subtitleColor = null, private readonly ?Color $borderColor = null, private readonly bool $showDivider = false)
static new(string $title = ''): selfCreate a new header with default styling.
static centered(string $title): selfCreate a centered header.
static hero(string $title, string $subtitle = ''): selfCreate a large hero header with title and subtitle.
setSize(int $width, int $height): \SugarCraft\Dashboard\Foundation\SizerSet the allocated dimensions for this header.
render(): stringRender the header as a string.
innerSize(): arrayCalculate the natural dimensions of this header.
withTitle(string $title): selfSet the header title.
withSubtitle(string $subtitle): selfSet the header subtitle.
withAlignment(HAlign|string $alignment): selfSet the alignment (HAlign case; legacy strings accepted with a deprecation notice).
withTitleColor(?Color $color): selfSet the title color.
withSubtitleColor(?Color $color): selfSet the subtitle color.
withBorderColor(?Color $color): selfSet the border/divider color.
withDivider(bool $show = true): selfShow a divider line below the header.

Highlight final class

A syntax highlighting component for code display.

MethodSummary
__construct(private readonly string $code, private readonly string $language = self::LANG_TEXT, private readonly bool $lineNumbers = false, private readonly string $theme = self::THEME_DEFAULT, private readonly ?array $highlightedLines = null, private readonly int $tabWidth = 4)
static new(string $code = ''): selfCreate a new highlight component with default settings.
static php(string $code): selfCreate a new highlight component with PHP code.
static js(string $code): selfCreate a new highlight component with JavaScript code.
static python(string $code): selfCreate a new highlight component with Python code.
static bash(string $code): selfCreate a new highlight component with Bash code.
static json(string $code): selfCreate a new highlight component with JSON.
static monokai(string $code, string $language = self::LANG_TEXT): selfCreate with Monokai theme.
setSize(int $width, int $height): \SugarCraft\Dashboard\Foundation\SizerSet the allocated dimensions for this highlight component.
render(): stringRender the highlighted code as a string.
innerSize(): arrayCalculate the natural dimensions of this highlight component.
withCode(string $code): selfSet the code content.
withLanguage(string $language): selfSet the language.
withLineNumbers(bool $show): selfSet line numbers visibility.
withTheme(string $theme): selfSet the color theme.
withHighlightedLines(?array $lines): selfSet highlighted lines.
withTabWidth(int $width): selfSet the tab width.

Jumbotron final class

A hero/jumbotron section component.

MethodSummary
__construct(private readonly string $title = '', private readonly string $subtitle = '', private readonly string $buttonText = '', private readonly string $alignment = 'center', private readonly ?Color $titleColor = null, private readonly ?Color $subtitleColor = null, private readonly ?Color $buttonColor = null, private readonly ?Color $borderColor = null, private readonly bool $showBorder = true, private readonly bool $showShadow = false)
static new(string $title, string $subtitle = ''): selfCreate a new jumbotron with default styling.
static withButton(string $title, string $subtitle, string $buttonText): selfCreate a jumbotron with a call-to-action button.
static minimal(string $title, string $subtitle = ''): selfCreate a minimal jumbotron without borders.
static left(string $title, string $subtitle = ''): selfCreate a left-aligned jumbotron.
setSize(int $width, int $height): \SugarCraft\Dashboard\Foundation\SizerSet the allocated dimensions for this jumbotron.
render(): stringRender the jumbotron as a string.
innerSize(): arrayCalculate the natural dimensions of this jumbotron.
withTitle(string $title): selfSet the title.
withSubtitle(string $subtitle): selfSet the subtitle.
withButtonText(string $buttonText): selfSet the button text.
withAlignment(string $alignment): selfSet the alignment.
withTitleColor(?Color $color): selfSet the title color.
withSubtitleColor(?Color $color): selfSet the subtitle color.
withButtonColor(?Color $color): selfSet the button color.
withBorderColor(?Color $color): selfSet the border color.
withBorder(bool $show): selfToggle border visibility.
withShadow(bool $show): selfToggle shadow effect.

Kbd final class

A keyboard key display component.

MethodSummary
__construct(private readonly array $keys, private readonly ?Color $bgColor = null, private readonly ?Color $borderColor = null, private readonly ?Color $textColor = null, private readonly bool $showShadow = true, private readonly bool $rounded = true)
static new(array $keys): selfCreate a new key display.
static single(string $key): selfCreate a single key display.
static combo(string ...$keys): selfCreate a key combination display.
setSize(int $width, int $height): \SugarCraft\Dashboard\Foundation\SizerSet the allocated dimensions for this key display.
innerSize(): arrayCalculate the natural dimensions of this key display.
render(): stringRender the key display.
withBgColor(?Color $color): selfSet the background color.
withBorderColor(?Color $color): selfSet the border color.
withTextColor(?Color $color): selfSet the text color.
withShowShadow(bool $show): selfShow or hide shadow.
withRounded(bool $rounded): selfSet rounded corners.

Label final class

A form label component.

MethodSummary
__construct(private readonly string $text, private readonly bool $required = false, private readonly ?string $helpText = null, private readonly ?Color $color = null, private readonly string $requiredIndicator = ' *')
static new(string $text): selfCreate a new label with default styling.
static required(string $text): selfCreate a required label.
static withHelp(string $text, string $helpText): selfCreate a label with help text.
setSize(int $width, int $height): \SugarCraft\Dashboard\Foundation\SizerSet the allocated dimensions for this label.
render(): stringRender the label as a string.
innerSize(): arrayCalculate the natural dimensions of this label.
withText(string $text): selfSet the label text.
withRequired(bool $required): selfSet the required state.
withHelpText(?string $helpText): selfSet the help text.
withColor(?Color $color): selfSet the label color.
withRequiredIndicator(string $indicator): selfSet the required indicator text.

Leaderboard final class

A leaderboard component for displaying ranked items.

MethodSummary
__construct(private readonly array $items = [], private readonly string $rankStyle = 'number', private readonly int $topHighlight = 3, private readonly bool $showValue = true, private readonly bool $showTrend = false, private readonly ?Color $highlightColor = null, private readonly ?Color $valueColor = null, private readonly string $valueFormat = 'number')
static new(array $items = []): selfCreate a new leaderboard.
static sample(): selfCreate a sample leaderboard for demonstration.
setSize(int $width, int $height): \SugarCraft\Dashboard\Foundation\SizerSet the allocated dimensions for this leaderboard.
render(): stringRender the leaderboard.
innerSize(): arrayCalculate the natural dimensions of this leaderboard.
withRankStyle(string $style): selfSet the rank style.
withTopHighlight(int $count): selfSet the top highlight count.
withValueFormat(string $format): selfSet the value format.
withShowValue(bool $show): selfShow or hide values.
withShowTrend(bool $show): selfShow or hide trend indicators.
withHighlightColor(?Color $color): selfSet the highlight color for top items.
withValueColor(?Color $color): selfSet the value color.

Markdown final class

A markdown rendering component for text display.

MethodSummary
__construct(private readonly string $content, private readonly string $theme = self::THEME_DEFAULT, private readonly bool $enableLinks = true, private readonly bool $enableCodeHighlighting = true)
static new(string $content): selfCreate a new markdown component with default theme.
static monokai(string $content): selfCreate with Monokai theme.
setSize(int $width, int $height): \SugarCraft\Dashboard\Foundation\SizerSet the allocated dimensions for this markdown component.
render(): stringRender the markdown as a string.
innerSize(): arrayCalculate the natural dimensions of this markdown component.
withContent(string $content): selfSet the markdown content.
withTheme(string $theme): selfSet the color theme.
withEnableLinks(bool $enable): selfSet link rendering.
withEnableCodeHighlighting(bool $enable): selfSet code highlighting.

Metric final class

A single metric/number display component.

MethodSummary
__construct(private readonly float $value, private readonly ?string $label = null, private readonly ?int $widthConstraint = null, private readonly MetricTrend $trend = MetricTrend::Neutral, private readonly ?int $decimals = null, private readonly bool $showTrend = true, private readonly ?Color $valueColor = null, private readonly ?Color $labelColor = null, private readonly ?Color $trendColor = null, private readonly string $trendSpacing = ' ', private readonly HAlign $horizontalAlign = HAlign::Center)
static new(float $value, ?string $label = null): selfCreate a new metric with default styling.
setSize(int $width, int $height): \SugarCraft\Dashboard\Foundation\SizerSet the allocated dimensions for this metric.
render(): stringRender the metric as a string.
innerSize(): arrayCalculate the natural dimensions of this metric.
withValue(float $value): selfSet a new value.
withLabel(?string $label): selfSet the label.
withWidth(int $width): selfSet the width constraint.
withTrend(MetricTrend $trend): selfSet the trend direction.
withDecimals(?int $decimals): selfSet the number of decimal places.
withShowTrend(bool $show): selfShow or hide the trend indicator.
withValueColor(?Color $color): selfSet the value color.
withLabelColor(?Color $color): selfSet the label color.
withTrendColor(?Color $color): selfSet the trend color.
withTrendSpacing(string $spacing): selfSet the spacing between trend symbol and value.
withHorizontalAlign(HAlign $align): selfSet the horizontal alignment.

MetricCard final readonly class

A metric card for the metrics grid.

MethodSummary
__construct(public string $label, public ?string $value = null, public ?string $trendValue = null, public ?string $trend = null, public ?Color $color = null)
static fromNumber(string $label, float $number, int $decimalPlaces = 0): selfCreate a card from a number value.
static percent(string $label, float $value): selfCreate a percentage card.
static currency(string $label, float $value, string $symbol = '$'): selfCreate a currency card.

MetricTrend enum

Trend direction for metrics.

Cases: Up · Down · Neutral

PHP also provides cases(), from() and tryFrom().

MethodSummary
symbol(): stringGet the symbol for this trend.
defaultColor(): ColorGet the default color for this trend.
static fromDelta(float $delta, float $threshold = 0.0): selfDetermine trend from a delta value.

MetricsGrid final class

A metrics grid component for displaying a grid of stat cards.

MethodSummary
__construct(private readonly array $metrics = [], private readonly int $columns = 3, private readonly bool $showTrends = true, private readonly bool $showLabels = true, private readonly bool $compact = false, private readonly ?Color $borderColor = null, private readonly ?Color $valueColor = null, private readonly ?Color $labelColor = null)
static new(array $metrics = []): selfCreate a new metrics grid.
static sample(): selfCreate a sample metrics grid for demonstration.
setSize(int $width, int $height): \SugarCraft\Dashboard\Foundation\SizerSet the allocated dimensions for this grid.
render(): stringRender the metrics grid.
innerSize(): arrayCalculate the natural dimensions of this grid.
withMetrics(array $metrics): selfSet the metrics.
withColumns(int $columns): selfSet the number of columns.
withShowTrends(bool $show): selfShow or hide trends.
withShowLabels(bool $show): selfShow or hide labels.
withCompact(bool $compact): selfSet compact mode.

Paragraph final class

A paragraph component with styled line spacing and margins.

MethodSummary
__construct(private readonly string $text, private readonly ?int $maxWidth = null, private readonly bool $trim = true, private readonly HAlign $horizontalAlign = HAlign::Left, private readonly float $leading = 1.0, private readonly int $marginTop = 0, private readonly int $marginBottom = 0, private readonly VAlign $verticalAlign = VAlign::Top)
static new(string $text): selfCreate a new paragraph with default styling.
setSize(int $width, int $height): \SugarCraft\Dashboard\Foundation\SizerSet the allocated dimensions for this paragraph.
render(): stringRender the paragraph with styling applied.
innerSize(): arrayCalculate the natural dimensions of this paragraph when rendered.
withMaxWidth(int $maxWidth): selfSet a maximum width for word-wrapping.
withTrim(bool $trim): selfEnable or disable whitespace trimming.
withHorizontalAlign(HAlign $align): selfSet the horizontal alignment.
withLeading(float $leading): selfSet the leading (line spacing multiplier).
withMarginTop(int $margin): selfSet the top margin (number of blank lines before content).
withMarginBottom(int $margin): selfSet the bottom margin (number of blank lines after content).
withVerticalAlign(VAlign $align): selfSet the vertical alignment within allocated height.
withText(string $text): selfSet new text content.

Pricing final class

A pricing table component.

MethodSummary
__construct(private readonly array $plans = [], private readonly ?Color $headerColor = null, private readonly ?Color $priceColor = null, private readonly ?Color $borderColor = null, private readonly ?Color $highlightColor = null, private readonly ?Color $featureColor = null, private readonly bool $showBorders = true)
static new(array $plans): selfCreate a new pricing table with default styling.
static compact(array $plans): selfCreate a compact pricing display.
setSize(int $width, int $height): \SugarCraft\Dashboard\Foundation\SizerSet the allocated dimensions for this pricing table.
render(): stringRender the pricing table as a string.
innerSize(): arrayCalculate the natural dimensions of this pricing table.
withPlans(array $plans): selfSet the pricing plans.
withHeaderColor(?Color $color): selfSet the header color.
withPriceColor(?Color $color): selfSet the price color.
withBorderColor(?Color $color): selfSet the border color.
withHighlightColor(?Color $color): selfSet the highlight color (for recommended plan).
withFeatureColor(?Color $color): selfSet the feature text color.
withBorders(bool $show): selfToggle border visibility.

Profile final class

A user profile card component.

MethodSummary
__construct(private readonly string $name = '', private readonly string $role = '', private readonly string $bio = '', private readonly ?string $avatar = null, private readonly ?string $email = null, private readonly ?string $location = null, private readonly ?Color $avatarBgColor = null, private readonly ?Color $nameColor = null, private readonly ?Color $roleColor = null, private readonly ?Color $bioColor = null, private readonly ?Color $borderColor = null, private readonly string $layout = 'vertical')
static new(string $name, string $role, string $bio = '', ?string $avatar = null): selfCreate a new profile card with default styling.
static horizontal(string $name, string $role, string $bio = '', ?string $avatar = null): selfCreate a horizontal layout profile card.
static compact(string $name, string $role, ?string $avatar = null): selfCreate a compact profile card.
setSize(int $width, int $height): \SugarCraft\Dashboard\Foundation\SizerSet the allocated dimensions for this profile.
render(): stringRender the profile card as a string.
innerSize(): arrayCalculate the natural dimensions of this profile.
withName(string $name): selfSet the name.
withRole(string $role): selfSet the role.
withBio(string $bio): selfSet the bio.
withAvatar(?string $avatar): selfSet the avatar.
withEmail(?string $email): selfSet the email.
withLocation(?string $location): selfSet the location.
withAvatarBgColor(?Color $color): selfSet the avatar background color.
withNameColor(?Color $color): selfSet the name color.
withRoleColor(?Color $color): selfSet the role color.
withBioColor(?Color $color): selfSet the bio color.
withBorderColor(?Color $color): selfSet the border color.
withLayout(string $layout): selfSet the layout.

Stat final class

A single stat display component showing a label and value.

MethodSummary
__construct(private readonly ?string $label, private readonly ?string $value, private readonly ?string $subLabel = null, private readonly ?Color $valueColor = null, private readonly ?Color $labelColor = null, private readonly ?string $trend = null, private readonly HAlign $align = HAlign::Left, private readonly int $decimalPlaces = 0)
static new(?string $label = null, ?string $value = null): selfCreate a new stat display.
static number(?string $label, float $value, int $decimalPlaces = 0): selfCreate a stat from a number.
static percent(?string $label, float $value): selfCreate a percentage stat.
static currency(?string $label, float $value, string $symbol = '$'): selfCreate a currency stat.
setSize(int $width, int $height): \SugarCraft\Dashboard\Foundation\SizerSet the allocated dimensions for this stat.
innerSize(): arrayCalculate the natural dimensions of this stat.
render(): stringRender the stat display.
withLabel(?string $label): selfSet the label.
withValue(?string $value): selfSet the value.
withSubLabel(?string $subLabel): selfSet the sub-label.
withValueColor(?Color $color): selfSet the value color.
withLabelColor(?Color $color): selfSet the label color.
withTrend(?string $trend): selfSet the trend indicator.
withAlign(HAlign $align): selfSet the alignment.
withDecimalPlaces(int $places): selfSet decimal places for number formatting.

Stats final class

A statistics display component.

MethodSummary
__construct(private readonly array $items = [], private readonly ?Color $labelColor = null, private readonly ?Color $valueColor = null, private readonly ?Color $separatorColor = null, private readonly string $separator = '│', private readonly string $alignment = 'left')
static new(array $stats): selfCreate a new stats row with default styling.
static horizontal(array $stats): selfCreate a horizontal divider-style stats row.
setSize(int $width, int $height): \SugarCraft\Dashboard\Foundation\SizerSet the allocated dimensions for this stats row.
render(): stringRender the stats row as a string.
innerSize(): arrayCalculate the natural dimensions of this stats row.
withItems(array $items): selfSet the stats items.
withLabelColor(?Color $color): selfSet the label color.
withValueColor(?Color $color): selfSet the value color.
withSeparatorColor(?Color $color): selfSet the separator color.
withSeparator(string $separator): selfSet the separator character.
withAlignment(string $alignment): selfSet the alignment.

Tag final class

A tag / chip component for displaying labels and metadata.

MethodSummary
__construct(private readonly string $label, private readonly ?Color $foregroundColor = null, private readonly ?Color $backgroundColor = null, private readonly string $style = 'solid', private readonly string $icon = '')
static new(string $label): selfCreate a new tag with default styling.
static success(string $label): selfCreate a success-style tag.
static warning(string $label): selfCreate a warning-style tag.
static danger(string $label): selfCreate a danger-style tag.
static info(string $label): selfCreate an info-style tag.
static soft(string $label, Color $backgroundColor): selfCreate a soft-style tag (lighter background).
setSize(int $width, int $height): \SugarCraft\Dashboard\Foundation\SizerSet the allocated dimensions for this tag.
render(): stringRender the tag as a string.
innerSize(): arrayCalculate the natural dimensions of this tag.
withLabel(string $label): selfSet the tag label.
withForegroundColor(?Color $color): selfSet the foreground (text) color.
withBackgroundColor(?Color $color): selfSet the background color.
withStyle(string $style): selfSet the tag style.
withIcon(string $icon): selfSet the icon prefix.

Testimonial final class

A testimonial quote display component.

MethodSummary
__construct(private readonly array $items = [], private readonly ?Color $quoteColor = null, private readonly ?Color $authorColor = null, private readonly ?Color $roleColor = null, private readonly ?Color $accentColor = null, private readonly string $openQuote = '「', private readonly string $closeQuote = '」')
static new(array $testimonials): selfCreate a new testimonial with default styling.
static single(array $testimonial): selfCreate a single testimonial with centered styling.
setSize(int $width, int $height): \SugarCraft\Dashboard\Foundation\SizerSet the allocated dimensions for this testimonial.
render(): stringRender the testimonial as a string.
innerSize(): arrayCalculate the natural dimensions of this testimonial.
withItems(array $items): selfSet the testimonial items.
withQuoteColor(?Color $color): selfSet the quote text color.
withAuthorColor(?Color $color): selfSet the author name color.
withRoleColor(?Color $color): selfSet the role/company color.
withAccentColor(?Color $color): selfSet the accent/border color.
withQuoteChars(string $open, string $close): selfSet the quote characters.

Text final class

Word-wrapped text content component.

MethodSummary
__construct(private readonly string $text, private readonly ?int $maxWidth = null, private readonly bool $trim = true, private readonly HAlign $horizontalAlign = HAlign::Left)
static new(string $text): selfCreate a new text component.
setSize(int $width, int $height): \SugarCraft\Dashboard\Foundation\SizerSet the allocated dimensions for this text.
render(): stringRender the text, word-wrapped to the allocated width.
innerSize(): arrayCalculate the natural dimensions of this text when rendered.
withMaxWidth(int $maxWidth): selfSet a maximum width for word-wrapping.
withTrim(bool $trim): selfEnable or disable whitespace trimming.
withHorizontalAlign(HAlign $align): selfSet the horizontal alignment.
withText(string $text): selfSet new text content.

Transformer final class

Text case transformation component.

MethodSummary
__construct(private readonly \SugarCraft\Dashboard\Foundation\Item $content, private readonly string $transform = self::Upper)
static new(\SugarCraft\Dashboard\Foundation\Item $content): selfCreate a new transformer with uppercase transformation.
setSize(int $width, int $height): \SugarCraft\Dashboard\Foundation\SizerSet the allocated dimensions for this transformer.
render(): stringRender the transformed text.
innerSize(): arrayCalculate the natural dimensions of this transformer when rendered.
withUpper(): selfSet uppercase transformation (all characters uppercase).
withLower(): selfSet lowercase transformation (all characters lowercase).
withTitle(): selfSet title case transformation (first letter uppercase, rest lowercase).
withUpperFirst(): selfSet upper-first transformation (first char of text uppercase, rest lowercase).
withUpperWords(): selfSet upper-words transformation (first char of each word uppercase, rest lowercase).

SugarCraft\Dashboard\Components\Feedback

Alert final class

A non-modal alert feedback component.

MethodSummary
__construct(private readonly string $message = '', private readonly string $level = self::Info, private readonly ?string $title = null, private readonly ?Color $color = null, private readonly ?string $borderChar = null)
static new(string $message = ''): selfCreate a new alert with the given message.
static info(string $message): selfCreate a new info alert.
static success(string $message): selfCreate a new success alert.
static warning(string $message): selfCreate a new warning alert.
static error(string $message): selfCreate a new error alert.
setSize(int $width, int $height): \SugarCraft\Dashboard\Foundation\SizerSet the allocated dimensions for this alert.
render(): stringRender the alert as a string.
innerSize(): arrayCalculate the natural dimensions of this alert.
withMessage(string $message): selfSet the alert message.
withLevel(string $level): selfSet the alert level.
withTitle(?string $title): selfSet the alert title.
withColor(?Color $color): selfSet the alert color.
withBorderColor(?Color $color): selfSet the border color.
withBorderChar(string $char): selfSet the border character.
withBackgroundColor(?Color $color): selfSet the background color.

EmptyState final class

An empty state placeholder component.

MethodSummary
__construct(private readonly string $icon = '📭', private readonly string $title = 'Nothing here yet', private readonly ?string $description = null, private readonly ?string $action = null, private readonly ?Color $iconColor = null, private readonly ?Color $titleColor = null, private readonly ?Color $descriptionColor = null)
static new(): selfCreate a new empty state with default message.
static noResults(): selfCreate an empty state for no results.
static error(): selfCreate an empty state for errors.
static noData(): selfCreate an empty state for no data.
setSize(int $width, int $height): \SugarCraft\Dashboard\Foundation\SizerSet the allocated dimensions for this empty state.
render(): stringRender the empty state as a string.
innerSize(): arrayCalculate the natural dimensions of this empty state.
withIcon(string $icon): selfSet the icon.
withTitle(string $title): selfSet the title.
withDescription(?string $description): selfSet the description.
withAction(?string $action): selfSet the action hint.
withIconColor(?Color $color): selfSet the icon color.
withTitleColor(?Color $color): selfSet the title color.
withDescriptionColor(?Color $color): selfSet the description color.

LoadingText final class

An animated loading text component with cycling dots.

MethodSummary
__construct(private readonly string $text = 'Loading', private readonly string $style = self::Dots, private readonly ?Color $color = null, private readonly int $interval = 300)
static new(string $text = 'Loading'): selfCreate a new loading text with default styling.
setSize(int $width, int $height): \SugarCraft\Dashboard\Foundation\SizerSet the allocated dimensions for this loading text.
render(): stringRender the loading text at the current frame.
currentFrame(): stringGet the current animation frame based on time.
getCurrentFrame(): stringBC forwarder for the pre-rename accessor name.
frameAt(int $index): stringGet the frame at a specific index (for deterministic testing).
getFrameAt(int $index): stringBC forwarder for the pre-rename accessor name.
innerSize(): arrayCalculate the natural dimensions of this loading text.
style(): stringGet the animation style.
getStyle(): stringBC forwarder for the pre-rename accessor name.
interval(): intGet the animation interval in milliseconds.
getInterval(): intBC forwarder for the pre-rename accessor name.
withText(string $text): selfSet the loading text.
withStyle(string $style): selfSet the animation style.
withColor(?Color $color): selfSet the text color.
withInterval(int $interval): selfSet the animation interval in milliseconds.

Skeleton final class

A loading skeleton component.

MethodSummary
__construct(private readonly int $lines = 3, private readonly ?Color $backgroundColor = null, private readonly ?Color $foregroundColor = null, array $lineWidths = [], private readonly string $fillChar = '█', private readonly string $emptyChar = ' ')
static new(int $lines = 3): selfCreate a new skeleton with default settings.
static text(int $lines = 3): selfCreate a text-like skeleton.
static avatar(): selfCreate an avatar skeleton.
static card(): selfCreate a card skeleton.
setSize(int $width, int $height): \SugarCraft\Dashboard\Foundation\SizerSet the allocated dimensions for this skeleton.
render(): stringRender the skeleton as a string.
innerSize(): arrayCalculate the natural dimensions of this skeleton.
withLines(int $lines): selfSet the number of lines.
withLineWidths(array $widths): selfSet specific line widths.
withBackgroundColor(?Color $color): selfSet the background color.
withForegroundColor(?Color $color): selfSet the foreground (fill) color.
withFillChar(string $char): selfSet the fill character.
withEmptyChar(string $char): selfSet the empty character.

Spinner final class

A loading spinner component that displays cycling animation frames.

MethodSummary
__construct(private readonly array $frames = self::DEFAULT_FRAMES, int $interval = 80, private readonly ?Color $color = null, private readonly string $message = '')
static new(): selfCreate a new spinner with default styling.
setSize(int $width, int $height): \SugarCraft\Dashboard\Foundation\SizerSet the allocated dimensions for this spinner.
render(): stringRender the spinner at the current frame.
currentFrame(): stringGet the current frame character.
getCurrentFrame(): stringBC forwarder for the pre-rename accessor name.
frameAt(int $index): stringGet the frame at a specific index (for testing/ deterministic output).
getFrameAt(int $index): stringBC forwarder for the pre-rename accessor name.
innerSize(): arrayCalculate the natural dimensions of this spinner.
frameCount(): intGet the number of frames in the spinner.
getFrameCount(): intBC forwarder for the pre-rename accessor name.
withFrames(array $frames): selfSet custom spinner frames.
withInterval(int $interval): selfSet the spin interval in milliseconds.
withColor(?Color $color): selfSet the spinner color.
withMessage(string $message): selfSet the message displayed alongside the spinner.

SugarCraft\Dashboard\Components\Form

Checkbox final class

A checkbox group component.

MethodSummary
__construct(private readonly array $options, private readonly int $selectedIndex = 0, private readonly bool $multiSelect = true, private readonly ?Color $checkedColor = null, private readonly ?Color $uncheckedColor = null, private readonly string $checkedChar = '◉', private readonly string $uncheckedChar = '○')
static new(array $options): selfCreate a new checkbox group with default styling.
setSize(int $width, int $height): \SugarCraft\Dashboard\Foundation\SizerSet the allocated dimensions for this checkbox group.
render(): stringRender the checkbox group.
innerSize(): arrayCalculate the natural dimensions of this checkbox group.
withSelectedIndex(int $index): selfSet the selected/focused option index.
withOptionChecked(int $index, bool $checked): selfToggle an option's checked state.
withAllChecked(bool $checked): selfSet all options' checked state.
withMultiSelect(bool $multiSelect): selfSet multi-select mode.
withCheckedColor(?Color $color): selfSet the color for checked items.
withUncheckedColor(?Color $color): selfSet the color for unchecked items.
withChars(string $checked, string $unchecked): selfSet custom characters for checked and unchecked states.

CommandPalette final class

A command palette component (Cmd+K style).

MethodSummary
__construct(private readonly array $commands, private readonly string $query = '', private readonly int $selectedIndex = 0, private readonly ?Color $paletteColor = null, private readonly ?Color $selectedColor = null, private readonly ?Color $queryColor = null, private readonly ?Color $shortcutColor = null, private readonly string $placeholder = 'Type a command...', private readonly string $borderChar = '─', private readonly string $selectedChar = '▶')
static new(array $commands): selfCreate a new command palette with default styling.
setSize(int $width, int $height): \SugarCraft\Dashboard\Foundation\SizerSet the allocated dimensions for this command palette.
filteredCommands(): arrayGet filtered commands based on the current query.
getFilteredCommands(): arrayBC forwarder for the pre-rename accessor name.
render(): stringRender the command palette component.
innerSize(): arrayCalculate the natural dimensions of this command palette.
withQuery(string $query): selfSet the search query.
withSelectedIndex(int $index): selfSet the selected command index.
withCommands(array $commands): selfSet the commands.
withPaletteColor(?Color $color): selfSet the palette background color.
withSelectedColor(?Color $color): selfSet the selected item highlight color.
withQueryColor(?Color $color): selfSet the query text color.
withShortcutColor(?Color $color): selfSet the shortcut text color.
withPlaceholder(string $placeholder): selfSet the placeholder text.
withBorderChar(string $char): selfSet custom border character.
withSelectedChar(string $char): selfSet custom selected item character.

Cursor final class

A cursor component that renders a cursor character at a fixed position.

MethodSummary
__construct(private readonly string $style = self::Block, private readonly ?Color $color = null, private readonly bool $visible = true)
static new(): selfCreate a new cursor with default styling.
setSize(int $width, int $height): \SugarCraft\Dashboard\Foundation\SizerSet the allocated dimensions for this cursor.
cursorChar(): stringGet the cursor character based on the current style.
getCursorChar(): stringBC forwarder for the pre-rename accessor name.
render(): stringRender the cursor character.
innerSize(): arrayCalculate the natural dimensions of this cursor.
withStyle(string $style): selfSet the cursor style (block, underline, bar).
withColor(?Color $color): selfSet the cursor color.
withVisible(bool $visible): selfSet cursor visibility (useful for blinking cursor implementations).

CursorState enum

Cursor blinking states.

Cases: Visible · Hidden · Blink

PHP also provides cases().

Editor final class

A multi-line text editor component with cursor support.

MethodSummary
__construct(private readonly ?string $content = null, private readonly bool $showLineNumbers = true, private readonly bool $wordWrap = false, private readonly bool $readOnly = false, private readonly bool $showCursor = true, private readonly CursorState $cursorState = CursorState::Blink, private readonly ?Color $textColor = null, private readonly ?Color $lineNumberColor = null, private readonly ?Color $cursorColor = null, private readonly ?Color $selectionColor = null, private readonly ?Color $backgroundColor = null, private readonly ?Color $borderColor = null, private readonly string $style = 'single')
static new(?string $content = null): selfCreate a new editor with default styling.
static forFile(?string $filepath = null): selfCreate an editor for a file.
content(): stringGet the content as a string.
getContent(): stringBC forwarder for the pre-rename accessor name.
line(int $index): stringGet a specific line.
getLine(int $index): stringBC forwarder for the pre-rename accessor name.
lineCount(): intGet the number of lines.
getLineCount(): intBC forwarder for the pre-rename accessor name.
cursorPosition(): arrayGet the cursor position.
getCursorPosition(): arrayBC forwarder for the pre-rename accessor name.
setSize(int $width, int $height): \SugarCraft\Dashboard\Foundation\SizerSet the allocated dimensions for this editor.
render(): stringRender the editor as a string.
innerSize(): arrayCalculate the natural dimensions of this editor.
withContent(?string $content): selfSet the content.
withLineNumbers(bool $show): selfShow or hide line numbers.
withWordWrap(bool $wrap): selfEnable or disable word wrap.
withReadOnly(bool $readOnly): selfSet read-only mode.
withShowCursor(bool $show): selfShow or hide cursor.
withTextColor(?Color $color): selfSet the text color.
withStyle(string $style): selfSet the border style.

Input final class

A text input field component.

MethodSummary
__construct(private readonly ?string $value = null, private readonly ?string $placeholder = null, private readonly ?string $label = null, private readonly ?string $error = null, private readonly ?Color $borderColor = null, private readonly ?Color $textColor = null, private readonly ?Color $placeholderColor = null, private readonly ?Color $backgroundColor = null, private readonly bool $masked = false, private readonly string $style = 'single')
static new(?string $value = null): selfCreate a new input with default styling.
static labeled(?string $value, string $label): selfCreate an input with a label.
static password(?string $value = null): selfCreate a password input.
setSize(int $width, int $height): \SugarCraft\Dashboard\Foundation\SizerSet the allocated dimensions for this input.
render(): stringRender the input as a string.
innerSize(): arrayCalculate the natural dimensions of this input.
withValue(?string $value): selfSet the input value.
withPlaceholder(?string $placeholder): selfSet the placeholder text.
withLabel(?string $label): selfSet the label text.
withError(?string $error): selfSet the error message.
withBorderColor(?Color $color): selfSet the border color.
withTextColor(?Color $color): selfSet the text color.
withPlaceholderColor(?Color $color): selfSet the placeholder color.
withBackgroundColor(?Color $color): selfSet the background color.
withMasked(bool $masked): selfSet the masked state (for passwords).
withStyle(string $style): selfSet the border style.
withWidth(int $width): selfSet the input width.

Rating final class

A star rating component.

MethodSummary
__construct(private readonly int $maxStars = 5, private readonly float $value = 0.0, private readonly ?Color $filledColor = null, private readonly ?Color $emptyColor = null, private readonly string $filledChar = '★', private readonly string $emptyChar = '☆')
static new(int $maxStars = 5, float $value = 0.0): selfCreate a new rating with default styling.
static of(float $value, int $maxStars = 5): selfCreate a rating with a specific value.
setSize(int $width, int $height): \SugarCraft\Dashboard\Foundation\SizerSet the allocated dimensions for this rating.
render(): stringRender the rating as a string.
innerSize(): arrayCalculate the natural dimensions of this rating.
withMaxStars(int $maxStars): selfSet the maximum number of stars.
withValue(float $value): selfSet the rating value.
withFilledColor(?Color $color): selfSet the filled star color.
withEmptyColor(?Color $color): selfSet the empty star color.
withChars(string $filled, string $empty): selfSet custom star characters.

Slider final class

A slider / progress control component.

MethodSummary
__construct(private readonly float $value, private readonly float $min = 0.0, private readonly float $max = 100.0, private readonly bool $vertical = false, private readonly ?Color $trackColor = null, private readonly ?Color $thumbColor = null, private readonly bool $showValue = true, private readonly string $thumbChar = '●', private readonly string $trackChar = '─')
static new(float $value, float $min = 0.0, float $max = 100.0): selfCreate a new horizontal slider with default styling.
static vertical(float $value, float $min = 0.0, float $max = 100.0): selfCreate a vertical slider.
setSize(int $width, int $height): \SugarCraft\Dashboard\Foundation\SizerSet the allocated dimensions for this slider.
render(): stringRender the slider as a string.
innerSize(): arrayCalculate the natural dimensions of this slider.
withValue(float $value): selfSet the current value.
withMin(float $min): selfSet the minimum value.
withMax(float $max): selfSet the maximum value.
withRange(float $min, float $max): selfSet the value range.
withShowValue(bool $show): selfShow or hide the value label.
withTrackColor(?Color $color): selfSet the track color.
withThumbColor(?Color $color): selfSet the thumb color.
withChars(string $thumb, string $track): selfSet custom thumb and track characters.
withVertical(bool $vertical): selfMake the slider vertical.

SwitchComponent final class

An on/off switch component with slider-style display.

MethodSummary
__construct(private readonly bool $on = false, private readonly ?Color $onColor = null, private readonly ?Color $offColor = null, private readonly ?Color $textColor = null)
static new(bool $on = false): selfCreate a new switch with default styling.
static on(): selfCreate an "on" switch.
static off(): selfCreate an "off" switch.
setSize(int $width, int $height): \SugarCraft\Dashboard\Foundation\SizerSet the allocated dimensions for this switch.
render(): stringRender the switch as a string.
innerSize(): arrayCalculate the natural dimensions of this switch.
withOn(bool $on): selfSet the on/off state.
withOnColor(?Color $color): selfSet the "on" color.
withOffColor(?Color $color): selfSet the "off" color.
withTextColor(?Color $color): selfSet the text/bracket color.

Textarea final class

A multi-line text area input component.

MethodSummary
__construct(private readonly ?string $value = null, private readonly ?string $placeholder = null, private readonly ?string $label = null, private readonly ?string $error = null, private readonly ?Color $borderColor = null, private readonly ?Color $textColor = null, private readonly ?Color $placeholderColor = null, private readonly ?Color $backgroundColor = null, private readonly int $rows = 5, private readonly ?int $maxRows = null, private readonly string $style = 'single')
static new(?string $value = null, int $rows = 5): selfCreate a new textarea with default styling.
static labeled(?string $value, string $label, int $rows = 5): selfCreate a textarea with a label.
setSize(int $width, int $height): \SugarCraft\Dashboard\Foundation\SizerSet the allocated dimensions for this textarea.
render(): stringRender the textarea as a string.
innerSize(): arrayCalculate the natural dimensions of this textarea.
withValue(?string $value): selfSet the textarea value.
withPlaceholder(?string $placeholder): selfSet the placeholder text.
withLabel(?string $label): selfSet the label text.
withError(?string $error): selfSet the error message.
withBorderColor(?Color $color): selfSet the border color.
withTextColor(?Color $color): selfSet the text color.
withPlaceholderColor(?Color $color): selfSet the placeholder color.
withBackgroundColor(?Color $color): selfSet the background color.
withRows(int $rows): selfSet the number of rows.
withMaxRows(?int $maxRows): selfSet the maximum number of rows.
withStyle(string $style): selfSet the border style.

Toggle final class

A toggle switch component.

MethodSummary
__construct(private readonly bool $on = false, private readonly ?string $onLabel = null, private readonly ?string $offLabel = null, private readonly ?Color $onColor = null, private readonly ?Color $offColor = null, private readonly ?Color $trackColor = null)
static new(bool $on = false): selfCreate a new toggle with default styling.
static on(): selfCreate an "on" toggle.
static off(): selfCreate an "off" toggle.
setSize(int $width, int $height): \SugarCraft\Dashboard\Foundation\SizerSet the allocated dimensions for this toggle.
render(): stringRender the toggle as a string.
innerSize(): arrayCalculate the natural dimensions of this toggle.
withOn(bool $on): selfSet the on/off state.
withLabels(string $on, string $off): selfSet custom labels.
withOnColor(?Color $color): selfSet the "on" color.
withOffColor(?Color $color): selfSet the "off" color.
withTrackColor(?Color $color): selfSet the track background color.

SugarCraft\Dashboard\Components\GridTable

BorderChars final class

Box-drawing characters for table borders.

MethodSummary
__construct(public readonly string $topLeft, public readonly string $top, public readonly string $topRight, public readonly string $left, public readonly string $bottomLeft, public readonly string $bottom, public readonly string $bottomRight, public readonly string $right, public readonly string $topMid, public readonly string $bottomMid, public readonly string $center, public readonly string $leftJunction = '┣', public readonly string $rightJunction = '┫', public readonly string $topJunction = '┳', public readonly string $bottomJunction = '┻', public readonly string $innerJunction = '╋', public readonly string $innerDivider = '┃', public readonly string $freezeDivider = '║', public readonly string $freezeTopJunction = '╥', public readonly string $freezeBottomJunction = '╨', public readonly string $freezeInnerJunction = '╫')
static new(): selfGet default heavy border characters.
static rounded(): selfGet rounded thin border characters.
static borderless(): selfGet borderless characters (empty strings).
static minimal(): selfGet minimal border characters.

BorderConfig final class

Border configuration for each region of the grid.

MethodSummary
__construct(public readonly bool $showOuter = true, public readonly bool $showHeader = true, public readonly bool $showInner = true, public readonly bool $showFooter = false, public readonly ?BorderChars $chars = null)
static new(): selfCreate default heavy border configuration.
static rounded(): selfCreate rounded thin border configuration.
static borderless(): selfCreate borderless configuration.
static minimal(): selfCreate minimal border configuration (header only).
withOuter(bool $show): self
withHeader(bool $show): self
withInner(bool $show): self
withFooter(bool $show): self
withChars(BorderChars $chars): self

BorderRegion enum

Border regions of the table.

Cases: Outer · Header · Inner · Footer

PHP also provides cases().

Calc final class

Calculation utilities for grid layout.

MethodSummary
static gcd(int $a, int $b): intGreatest common divisor using Euclidean algorithm.
static calculateColumnWidths(array $rows, array $columns, int $availableWidth): arrayCalculate column widths to fill available width.
static truncate(string $str, int $maxWidth): stringTruncate a string to at most $maxWidth display cells, ending in an ellipsis when it is cut. Never splits a grapheme cluster.

Cell final class

Cell value object for data grid tables.

MethodSummary
__construct(private readonly mixed $value = null, private readonly ?string $format = null)
static new(mixed $value = null, ?string $format = null): self
value(): mixed
getValue(): mixedBC forwarder for the pre-rename accessor name.
format(): ?string
getFormat(): ?stringBC forwarder for the pre-rename accessor name.
toString(): string

Column final class

A column definition for the grid.

Not listed: the methods of SugarCraft\Core\Concerns\Mutable, a trait declared outside src/.

MethodSummary
static new(string $key, string $label, ?int $minWidth = null, ?int $maxWidth = null, bool $sortable = false, bool $filterable = false, ?callable $renderer = null): self
withMinWidth(int $width): selfCreate a column with minimum width constraint.
withMaxWidth(int $width): selfCreate a column with maximum width constraint.
sortable(): selfCreate a sortable column.
filterable(): selfCreate a filterable column.
withRenderer(callable $renderer): selfCreate a column with a custom renderer.

Filter final class

Filter state and logic for data grid tables.

MethodSummary
__construct(private readonly array $filters = [])
static none(): self
static fromArray(array $filters): self
filters(): array
getFilters(): arrayBC forwarder for the pre-rename accessor name.
filter(string $column): ?string
getFilter(string $column): ?stringBC forwarder for the pre-rename accessor name.
hasFilter(string $column): bool
isActive(): boolThe single activity truth: a filter entry counts only when its value is non-empty, matching self::hasFilter() polarity exactly. Storing '' via withFilter() is a neutral entry — kept for transport, never treated as active.
withFilter(string $column, string $value): self
withoutFilter(string $column): self
clear(): self

Table footer for data grid tables.

MethodSummary
__construct(private readonly ?array $summaryColumns = null, private readonly bool $showRowCount = true)
static new(?array $summaryColumns = null, bool $showRowCount = true): self
static none(): self
summaryColumns(): ?array
getSummaryColumns(): ?arrayBC forwarder for the pre-rename accessor name.
shouldShowRowCount(): bool
render(): string
withSummaryColumns(?array $summaryColumns): self
withShowRowCount(bool $show): self

GridTable final class

A full-featured data grid with sort, filter, pagination, and column freezing.

MethodSummary
__construct(array $columns = [], array $rows = [], ?SortState $sortState = null, ?BorderConfig $borderConfig = null)
static new(array $columns, array $rows = []): selfCreate a new GridTable with columns and rows.
setSize(int $width, int $height): SizerSet the allocated dimensions for this grid.
width(): ?intGet current width.
getWidth(): ?intBC forwarder for the pre-rename accessor name.
height(): ?intGet current height.
getHeight(): ?intBC forwarder for the pre-rename accessor name.
withColumns(array $columns): selfReturn a new GridTable with the given columns.
withRows(array $rows): selfReturn a new GridTable with the given rows.
withPerPage(int $perPage): selfReturn a new GridTable showing at most N rows per page.
sort(Column $column): selfReturn a new GridTable with sort applied to the given column.
filter(string $filterText): selfReturn a new GridTable with the given filter applied.
page(int $page): selfReturn a new GridTable with the given page set.
scrollTo(int $index): selfReturn a new GridTable scrolled to the given row index.
freezeColumns(int $count): selfReturn a new GridTable with N left columns frozen.
render(): stringRender the grid as a string.
sortState(): SortState
getSortState(): SortStateBC forwarder for the pre-rename accessor name.
filterText(): string
getFilterText(): stringBC forwarder for the pre-rename accessor name.
pagination(): Pagination
getPagination(): PaginationBC forwarder for the pre-rename accessor name.
frozenColumns(): int
getFrozenColumns(): intBC forwarder for the pre-rename accessor name.

Header final class

Table header for data grid tables.

MethodSummary
__construct(private readonly array $columns = [], private readonly bool $showSortIndicators = true, private readonly ?string $sortedColumn = null)
static new(array $columns = [], bool $showSortIndicators = true, ?string $sortedColumn = null): self
columns(): array
getColumns(): arrayBC forwarder for the pre-rename accessor name.
hasSortIndicators(): bool
sortedColumn(): ?string
getSortedColumn(): ?stringBC forwarder for the pre-rename accessor name.
render(): string
withSortedColumn(?string $column): self

Overflow final class

MethodSummary
__construct(private readonly OverflowMode $horizontal = OverflowMode::Truncate, private readonly OverflowMode $vertical = OverflowMode::Wrap)
static new(OverflowMode $horizontal = OverflowMode::Truncate, OverflowMode $vertical = OverflowMode::Wrap): self
static truncate(): self
static wrap(): self
static ellipsis(): self
horizontal(): OverflowMode
getHorizontal(): OverflowModeBC forwarder for the pre-rename accessor name.
vertical(): OverflowMode
getVertical(): OverflowModeBC forwarder for the pre-rename accessor name.

OverflowMode enum

Overflow handling for data grid tables.

Cases: Truncate · Wrap · Ellipsis

PHP also provides cases().

Pagination final class

Pagination state for the grid.

MethodSummary
__construct(public readonly int $page = 1, public readonly int $perPage = 20, public readonly int $totalRows = 0)
totalPages(): intTotal number of pages.
offset(): intZero-based offset for the current page.
clampPage(int $page): intClamp page to valid range.
withPage(int $page): selfCreate a new pagination with updated page.
withPerPage(int $perPage): selfCreate a new pagination with updated perPage.
normalized(): selfReturn this window with the page clamped into range for its own totalRows and perPage floored at 1. render() needs a window clamped against the filtered reality, which set-time clamping alone cannot provide (D-51, finding 044).
withTotalRows(int $totalRows): selfCreate a new pagination with updated totalRows.

Row final class

A data row with cells indexed by column key.

MethodSummary
__construct(public readonly array $cells = [])
get(string $key): mixedGet cell value by key.
has(string $key): boolCheck if row has a cell with the given key.

Scrolling final class

Scrolling configuration for data grid tables.

MethodSummary
__construct(private readonly bool $enabled = false, private readonly int $visibleRows = 10, private readonly int $rowHeight = 1)
static new(bool $enabled = false, int $visibleRows = 10, int $rowHeight = 1): self
static disabled(): self
isEnabled(): bool
visibleRows(): int
getVisibleRows(): intBC forwarder for the pre-rename accessor name.
rowHeight(): int
getRowHeight(): intBC forwarder for the pre-rename accessor name.
totalHeight(): int
getTotalHeight(): intBC forwarder for the pre-rename accessor name.
withEnabled(bool $enabled): self
withVisibleRows(int $visibleRows): self

Sort final class

Sort state and logic for data grid tables.

MethodSummary
__construct(private readonly ?string $column = null, private readonly SortDirection $direction = SortDirection::Asc)
static none(): self
static asc(string $column): self
static desc(string $column): self
column(): ?string
getColumn(): ?stringBC forwarder for the pre-rename accessor name.
direction(): SortDirection
getDirection(): SortDirectionBC forwarder for the pre-rename accessor name.
isSorted(): bool
toggleDirection(): self

SortDirection enum

Sort direction for grid columns.

Cases: Asc · Desc

PHP also provides cases().

SortState final class

Current sort state of the grid.

MethodSummary
__construct(public readonly ?string $key = null, public readonly SortDirection $direction = SortDirection::Asc)
toggle(?string $key): selfToggle direction if same key, otherwise reset to Asc.
isSortedBy(string $key): bool

SugarCraft\Dashboard\Components\Media

ASCIIBanner final class

ASCII art banner generator.

MethodSummary
__construct(private readonly string $title, private readonly ?string $subtitle = null, private readonly ?Color $borderColor = null, private readonly ?Color $textColor = null, private readonly string $style = 'classic', private readonly int $padding = 1)
static new(string $title): selfCreate a new ASCII banner.
static withTitleAndSubtitle(string $title, string $subtitle): selfCreate a banner with a title and subtitle.
static classic(string $title): selfCreate a classic ASCII banner.
static double(string $title): selfCreate a double-line banner.
static block(string $title): selfCreate a block-style banner.
static stars(string $title): selfCreate a star-decorated banner.
setSize(int $width, int $height): \SugarCraft\Dashboard\Foundation\SizerSet the allocated dimensions for this banner.
render(): stringRender the banner.
innerSize(): arrayCalculate the natural dimensions.
withSubtitle(?string $subtitle): selfSet the subtitle.
withBorderColor(?Color $color): selfSet the border color.
withTextColor(?Color $color): selfSet the text color.
withStyle(string $style): selfSet the banner style.
withPadding(int $padding): selfSet the padding.

Audio final class

An audio player component with waveform visualization.

MethodSummary
__construct(private readonly ?int $maxLength = null, private readonly bool $showWaveform = true, private readonly WaveformStyle $waveformStyle = WaveformStyle::Bars, private readonly ?Color $waveformColor = null, private readonly ?Color $progressColor = null, private readonly ?Color $trackColor = null, private readonly ?Color $textColor = null, private readonly ?string $title = null, private readonly ?string $artist = null, private readonly string $style = 'rounded')
static new(): selfCreate a new audio player with default styling.
setSize(int $width, int $height): \SugarCraft\Dashboard\Foundation\SizerSet the allocated dimensions for this audio player.
withWaveformData(array $data): selfSet the waveform data for visualization.
withPosition(int $seconds): selfSet the current playback position.
withDuration(int $seconds): selfSet the duration.
withPlaying(bool $playing): selfSet playing state.
withVolume(int $level): selfSet volume.
render(): stringRender the audio player as a string.
innerSize(): arrayCalculate the natural dimensions of this audio player.
withWaveformStyle(WaveformStyle $style): selfSet the waveform style.
withWaveformColor(?Color $color): selfSet the waveform color.
withProgressColor(?Color $color): selfSet the progress color.
withTrackColor(?Color $color): selfSet the track color.
withTextColor(?Color $color): selfSet the text color.
withTitle(?string $title): selfSet the title.
withArtist(?string $artist): selfSet the artist.
withStyle(string $style): selfSet the border style.

Avatar final class

A user avatar component with fallback support.

MethodSummary
__construct(private readonly ?string $imageUrl = null, private readonly ?string $name = null, private readonly int $size = self::SIZE_MEDIUM, private readonly ?Color $backgroundColor = null, private readonly ?Color $foregroundColor = null, private readonly ?string $status = null)
static fromName(string $name): selfCreate a new avatar with a name (displays initials as fallback).
static withImage(string $imageUrl, ?string $name = null): selfCreate a new avatar with an image URL.
static small(string $name): selfCreate a small avatar.
static large(string $name): selfCreate a large avatar.
static sizeToPixels(int $size): intGet the pixel width for a size constant.
setSize(int $width, int $height): \SugarCraft\Dashboard\Foundation\SizerSet the allocated dimensions for this avatar.
render(): stringRender the avatar as a string.
innerSize(): arrayCalculate the natural dimensions of this avatar.
withImageUrl(?string $url): selfSet the image URL.
withName(?string $name): selfSet the name (used for initials fallback).
withSize(int $size): selfSet the avatar size.
withBackgroundColor(?Color $color): selfSet the background color.
withForegroundColor(?Color $color): selfSet the foreground (text) color.
withStatus(?string $status): selfSet the status indicator.

AvatarGroup final class

A group of avatars displayed in a row.

MethodSummary
__construct(private readonly array $avatars = [], private readonly int $overlap = 2, private readonly ?int $maxDisplay = null, private readonly ?string $overflowIndicator = null, private readonly ?Color $overflowBackgroundColor = null, private readonly ?Color $overflowForegroundColor = null)
static fromNames(array $names): selfCreate a new avatar group from a list of names.
static compact(array $names, int $maxDisplay = 4): selfCreate a compact avatar group showing max N avatars.
setSize(int $width, int $height): \SugarCraft\Dashboard\Foundation\SizerSet the allocated dimensions for this avatar group.
render(): stringRender the avatar group as a string.
innerSize(): arrayCalculate the natural dimensions of this avatar group.
withAvatars(array $avatars): selfSet the avatars in this group.
withAppended(Avatar $avatar): selfAdd an avatar to this group.
withOverlap(int $overlap): selfSet the overlap amount between avatars.
withMaxDisplay(?int $maxDisplay): selfSet the maximum number of avatars to display.
withOverflowIndicator(?string $indicator): selfSet the overflow indicator text.
withOverflowColors(?Color $background, ?Color $foreground): selfSet the overflow indicator colors.

Barcode final class

A barcode display component.

MethodSummary
__construct(private readonly string $content, private readonly int $height = 3, private readonly bool $showText = true, private readonly ?Color $barColor = null)
static new(string $content): selfCreate a new barcode with default styling.
setSize(int $width, int $height): \SugarCraft\Dashboard\Foundation\SizerSet the allocated dimensions for this barcode.
render(): stringRender the barcode.
innerSize(): arrayCalculate the natural dimensions of this barcode.
withHeight(int $height): selfSet the barcode height (in character rows).
withShowText(bool $show): selfShow or hide the text label.
withBarColor(?Color $color): selfSet the bar color.
withContent(string $content): selfSet new content.

ControlsStyle enum

Video player controls display mode.

Cases: Auto · Always · Hidden

PHP also provides cases(), from() and tryFrom().

Emoji final class

An emoji display component.

MethodSummary
__construct(private readonly string $emoji, private readonly ?string $label = null, private readonly int $size = self::SIZE_MEDIUM, private readonly ?Color $tintColor = null, private readonly bool $showLabel = false)
static thumbsUp(?string $label = null): selfCreate a thumbs up emoji.
static thumbsDown(?string $label = null): selfCreate a thumbs down emoji.
static clap(?string $label = null): selfCreate a clap emoji.
static fire(?string $label = null): selfCreate a fire emoji.
static rocket(?string $label = null): selfCreate a rocket emoji.
static star(?string $label = null): selfCreate a star emoji.
static sparkle(?string $label = null): selfCreate a sparkle emoji.
static check(?string $label = null): selfCreate a check mark emoji.
static x(?string $label = null): selfCreate an X mark emoji.
static warning(?string $label = null): selfCreate a warning emoji.
static info(?string $label = null): selfCreate a info emoji.
static question(?string $label = null): selfCreate a question mark emoji.
static exclamation(?string $label = null): selfCreate an exclamation emoji.
static lightbulb(?string $label = null): selfCreate a light bulb emoji.
static trophy(?string $label = null): selfCreate a trophy emoji.
static medal(?string $label = null): selfCreate a medal emoji.
static smile(?string $label = null): selfCreate a smiley face emoji.
static sad(?string $label = null): selfCreate a sad face emoji.
static heart(?string $label = null): selfCreate a heart emoji.
static brokenHeart(?string $label = null): selfCreate a broken heart emoji.
setSize(int $width, int $height): \SugarCraft\Dashboard\Foundation\SizerSet the allocated dimensions for this emoji.
render(): stringRender the emoji as a string.
innerSize(): arrayCalculate the natural dimensions of this emoji.
withEmoji(string $emoji): selfSet the emoji.
withLabel(?string $label): selfSet the label.
withSize(int $size): selfSet the size.
withTintColor(?Color $color): selfSet the tint color.
withShowLabel(bool $show): selfSet whether to show the label.

FigletText final class

Figlet-style large text using ASCII art characters.

MethodSummary
__construct(private readonly string $text, private readonly ?Color $textColor = null, private readonly string $font = 'standard')
static new(string $text): selfCreate a new figlet text component.
static shadow(string $text): selfCreate with shadow font style.
static small(string $text): selfCreate with small font style.
setSize(int $width, int $height): \SugarCraft\Dashboard\Foundation\SizerSet the allocated dimensions for this component.
render(): stringRender the figlet text.
innerSize(): arrayCalculate the natural dimensions.
withTextColor(?Color $color): selfSet the text color.
withFont(string $font): selfSet the font style.

Icon final class

An icon display component.

MethodSummary
__construct(private readonly string $glyph, private readonly ?string $label = null, private readonly int $size = 1, private readonly ?Color $color = null, private readonly ?Color $labelColor = null)
static file(?string $name = null): selfCreate a file icon.
static folder(?string $name = null): selfCreate a folder icon.
static gear(?string $label = null): selfCreate a gear/settings icon.
static heart(?string $label = null): selfCreate a heart icon.
static star(?string $label = null): selfCreate a star icon.
static check(?string $label = null): selfCreate a checkmark icon.
static cross(?string $label = null): selfCreate an X/cross icon.
static info(?string $label = null): selfCreate an info icon.
static warning(?string $label = null): selfCreate a warning/alert icon.
static error(?string $label = null): selfCreate an error icon.
static home(?string $label = null): selfCreate a home icon.
static search(?string $label = null): selfCreate a search icon.
static music(?string $label = null): selfCreate a music note icon.
static play(?string $label = null): selfCreate a play icon.
static pause(?string $label = null): selfCreate a pause icon.
static stop(?string $label = null): selfCreate a stop icon.
static arrowUp(?string $label = null): selfCreate an up arrow icon.
static arrowDown(?string $label = null): selfCreate a down arrow icon.
static arrowLeft(?string $label = null): selfCreate a left arrow icon.
static arrowRight(?string $label = null): selfCreate a right arrow icon.
setSize(int $width, int $height): \SugarCraft\Dashboard\Foundation\SizerSet the allocated dimensions for this icon.
render(): stringRender the icon as a string.
innerSize(): arrayCalculate the natural dimensions of this icon.
withGlyph(string $glyph): selfSet the glyph.
withLabel(?string $label): selfSet the label.
withSize(int $size): selfSet the size (scaling factor).
withColor(?Color $color): selfSet the icon color.
withLabelColor(?Color $color): selfSet the label color.

Image final class

An image display component with fallback support.

MethodSummary
__construct(private readonly ?string $url = null, private readonly ?string $alt = null, private readonly ?int $maxWidth = null, private readonly ?int $maxHeight = null, private readonly string $format = self::FORMAT_BOX, private readonly ?Color $borderColor = null, private readonly ?Color $backgroundColor = null, private readonly ?Color $altColor = null)
static fromUrl(string $url, ?string $alt = null): selfCreate a new image with a URL.
static placeholder(?string $alt = null): selfCreate a placeholder image (no actual image URL).
setSize(int $width, int $height): \SugarCraft\Dashboard\Foundation\SizerSet the allocated dimensions for this image.
render(): stringRender the image as a string.
innerSize(): arrayCalculate the natural dimensions of this image.
withUrl(?string $url): selfSet the image URL.
withAlt(?string $alt): selfSet the alt text.
withMaxWidth(?int $maxWidth): selfSet the maximum width.
withMaxHeight(?int $maxHeight): selfSet the maximum height.
withFormat(string $format): selfSet the format.
withBorderColor(?Color $color): selfSet the border color.
withBackgroundColor(?Color $color): selfSet the background color.
withAltColor(?Color $color): selfSet the alt text color.

Marquee final class

A scrolling marquee text component.

MethodSummary
__construct(private readonly string $text, private readonly int $speed = 1, private readonly bool $leftToRight = true, private readonly ?Color $textColor = null, private readonly bool $fadeEdges = true, private readonly int $offset = 0)
static new(string $text): selfCreate a new marquee with the given text.
static fast(string $text): selfCreate a fast marquee.
static slow(string $text): selfCreate a slow marquee.
setSize(int $width, int $height): \SugarCraft\Dashboard\Foundation\SizerSet the allocated dimensions for this marquee.
innerSize(): arrayCalculate the natural dimensions of this marquee.
render(?int $frame = null): stringRender the marquee at a specific frame.
nextFrame(): selfAdvance the marquee to the next frame.
withSpeed(int $speed): selfSet the scroll speed.
withDirection(bool $leftToRight): selfSet scroll direction.
withTextColor(?Color $color): selfSet the text color.
withFadeEdges(bool $fade): selfEnable or disable edge fading.

Pictogram final class

A pictogram chart using icons/symbols to represent values.

MethodSummary
__construct(private readonly array $items, private readonly string $icon = '■', private readonly int $iconWidth = 1, private readonly int $maxIcons = 10, private readonly bool $showLabels = true, private readonly bool $showValues = true, private readonly bool $stacked = false)
static new(array $items): selfCreate a new pictogram with the given data.
static circles(array $items): selfCreate a pictogram with filled circles.
static stars(array $items): selfCreate a pictogram with stars.
setSize(int $width, int $height): \SugarCraft\Dashboard\Foundation\SizerSet the allocated dimensions for this pictogram.
innerSize(): arrayCalculate the natural dimensions of this pictogram.
render(): stringRender the pictogram.
withIcon(string $icon): selfSet the icon character.
withMaxIcons(int $max): selfSet the maximum number of icons per row.
withShowLabels(bool $show): selfShow or hide labels.
withShowValues(bool $show): selfShow or hide values.
withStacked(bool $stacked): selfEnable stacked mode.

Picture final class

A picture display component with fallback support.

MethodSummary
__construct(private readonly ?string $url = null, private readonly ?string $alt = null, private readonly ?string $caption = null, private readonly int $widthHint = 20, private readonly int $heightHint = 10, private readonly string $fallbackType = self::FALLBACK_PLACEHOLDER, private readonly ?string $fallbackValue = null, private readonly ?Color $borderColor = null, private readonly ?Color $backgroundColor = null, private readonly ?Color $captionColor = null)
static fromUrl(string $url, ?string $alt = null): selfCreate a picture with an image URL.
static withInitials(string $name, ?string $url = null): selfCreate a picture with initials fallback (like Avatar).
static withIcon(string $icon, ?string $url = null): selfCreate a picture with icon fallback.
static withEmoji(string $emoji, ?string $url = null): selfCreate a picture with emoji fallback.
static placeholder(): selfCreate a placeholder picture (no image URL).
setSize(int $width, int $height): \SugarCraft\Dashboard\Foundation\SizerSet the allocated dimensions for this picture.
render(): stringRender the picture as a string.
innerSize(): arrayCalculate the natural dimensions of this picture.
withUrl(?string $url): selfSet the image URL.
withAlt(?string $alt): selfSet the alt text.
withCaption(?string $caption): selfSet the caption.
withWidthHint(int $width): selfSet the width hint.
withHeightHint(int $height): selfSet the height hint.
withFallbackType(string $type): selfSet the fallback type.
withFallbackValue(?string $value): selfSet the fallback value.
withBorderColor(?Color $color): selfSet the border color.
withBackgroundColor(?Color $color): selfSet the background color.
withCaptionColor(?Color $color): selfSet the caption color.

PlaybackState enum

Video playback state.

Cases: Stopped · Playing · Paused · Buffering

PHP also provides cases(), from() and tryFrom().

QRCode final class

A QR code display component.

MethodSummary
__construct(private readonly string $content, private readonly int $size = 8, private readonly bool $bordered = true, private readonly ?Color $filledColor = null, private readonly ?Color $emptyColor = null)
static new(string $content): selfCreate a new QR code with default styling.
setSize(int $width, int $height): \SugarCraft\Dashboard\Foundation\SizerSet the allocated dimensions for this QR code.
render(): stringRender the QR code.
innerSize(): arrayCalculate the natural dimensions of this QR code.
withSize(int $size): selfSet the QR code size (grid dimensions).
withBordered(bool $bordered): selfShow or hide the border.
withFilledColor(?Color $color): selfSet the color for filled cells.
withEmptyColor(?Color $color): selfSet the color for empty cells.
withContent(string $content): selfSet new content.

Shadow final class

A shadow effect that wraps any Item.

MethodSummary
__construct(private readonly \SugarCraft\Dashboard\Foundation\Item $content, private readonly string $style = self::Normal, private readonly ?Color $color = null, private readonly int $xOffset = 1, private readonly int $yOffset = 1)
static new(\SugarCraft\Dashboard\Foundation\Item $content): selfCreate a new shadow with default styling.
setSize(int $width, int $height): \SugarCraft\Dashboard\Foundation\SizerSet the allocated dimensions for this shadow.
render(): stringRender the content with shadow effect.
innerSize(): arrayCalculate the natural dimensions of this shadow component.
withStyle(string $style): selfSet the shadow style (normal, heavy, none).
withColor(?Color $color): selfSet the shadow color.
withXOffset(int $offset): selfSet the horizontal offset (how far shadow extends right).
withYOffset(int $offset): selfSet the vertical offset (how far shadow extends down).
withOffset(int $x, int $y): selfSet both x and y offset.
withHeavy(): selfSet a heavy shadow style.
withNoShadow(): selfDisable the shadow effect.

Video final class

A video player component with playback controls and progress bar.

MethodSummary
__construct(private readonly ?int $maxLength = null, private readonly bool $showControls = true, private readonly ControlsStyle $controlsStyle = ControlsStyle::Auto, private readonly ?Color $progressColor = null, private readonly ?Color $bufferColor = null, private readonly ?Color $trackColor = null, private readonly ?Color $textColor = null, private readonly ?Color $backgroundColor = null, private readonly ?string $source = null, private readonly string $style = 'rounded')
static new(): selfCreate a new video player with default styling.
setSize(int $width, int $height): \SugarCraft\Dashboard\Foundation\SizerSet the allocated dimensions for this video player.
progressWidth(): intGet the progress bar width.
getProgressWidth(): intBC forwarder for the pre-rename accessor name.
render(): stringRender the video player as a string.
innerSize(): arrayCalculate the natural dimensions of this video player.
withShowControls(bool $show): selfSet the controls visibility.
withControlsStyle(ControlsStyle $style): selfSet the controls style.
withProgressColor(?Color $color): selfSet the progress bar color.
withTrackColor(?Color $color): selfSet the track color.
withTextColor(?Color $color): selfSet the text color.
withBackgroundColor(?Color $color): selfSet the background color.
withSource(?string $source): selfSet the video source.
withStyle(string $style): selfSet the border style.

WaveformStyle enum

Waveform visualization style.

Cases: Bars · Line · Blocks · Dots

PHP also provides cases(), from() and tryFrom().

SugarCraft\Dashboard\Components\Modal

Alert final class

An alert / message box component.

MethodSummary
__construct(private readonly string $message, private readonly ?string $title = null, private readonly ?Color $borderColor = null, private readonly ?Color $backgroundColor = null, private readonly ?Color $foregroundColor = null, private readonly string $borderChar = '│', private readonly string $icon = '')
static new(string $message): selfCreate a new alert with default styling.
static info(string $message): selfCreate an info-style alert.
static warning(string $message): selfCreate a warning-style alert.
static error(string $message): selfCreate an error/danger-style alert.
static success(string $message): selfCreate a success-style alert.
setSize(int $width, int $height): \SugarCraft\Dashboard\Foundation\SizerSet the allocated dimensions for this alert.
render(): stringRender the alert as a string.
innerSize(): arrayCalculate the natural dimensions of this alert.
withMessage(string $message): selfSet the alert message.
withTitle(?string $title): selfSet the alert title.
withBorderColor(?Color $color): selfSet the border color.
withBackgroundColor(?Color $color): selfSet the background color.
withForegroundColor(?Color $color): selfSet the foreground (text) color.
withBorderChar(string $char): selfSet the border character.
withIcon(string $icon): selfSet the icon prefix.

ConfirmModal final class

A confirmation modal dialog.

MethodSummary
__construct(private readonly string $message, private readonly string $confirmLabel = 'Confirm', private readonly string $cancelLabel = 'Cancel', private readonly bool $isDanger = false)
setSize(int $width, int $height): staticFindings sugar-dashboard-069/173 (D-70): the dialog answers the same SizedItem channel layout hosts measure. Framed chrome - and with it a navigable cursor surface - arrives with the composition design (173 deferral, disclosed); this ships the sizing contract.
innerSize(): array
static new(string $message): self
static danger(string $message): self
static ok(string $message): self
static yesNo(string $message): self
render(): string

Drawer final class

A slide-out drawer panel component.

MethodSummary
__construct(private readonly \SugarCraft\Dashboard\Foundation\Item|string $content, private readonly string $position = self::POSITION_LEFT, private readonly ?int $size = null, private readonly ?string $title = null, private readonly ?Color $borderColor = null, private readonly string $style = 'single', private readonly \SugarCraft\Dashboard\Foundation\Item|string|null $footer = null)
static new(\SugarCraft\Dashboard\Foundation\Item|string $content, string $position = self::POSITION_LEFT): selfCreate a new drawer with default styling.
static left(\SugarCraft\Dashboard\Foundation\Item|string $content): selfCreate a left-positioned drawer.
static right(\SugarCraft\Dashboard\Foundation\Item|string $content): selfCreate a right-positioned drawer.
static top(\SugarCraft\Dashboard\Foundation\Item|string $content): selfCreate a top-positioned drawer.
static bottom(\SugarCraft\Dashboard\Foundation\Item|string $content): selfCreate a bottom-positioned drawer.
setSize(int $width, int $height): \SugarCraft\Dashboard\Foundation\SizerSet the allocated dimensions for this drawer.
render(): stringRender the drawer as a string.
innerSize(): arrayCalculate the natural dimensions of this drawer.
withContent(\SugarCraft\Dashboard\Foundation\Item|string $content): selfSet the drawer content.
withPosition(string $position): selfSet the drawer position.
withSize(?int $size): selfSet the drawer size (width for left/right, height for top/bottom).
withTitle(?string $title): selfSet the drawer title.
withBorderColor(?Color $color): selfSet the border color.
withStyle(string $style): selfSet the border style.
withFooter(\SugarCraft\Dashboard\Foundation\Item|string|null $footer): selfSet the drawer footer.

ListModal final class

A modal dialog that displays a list of items.

MethodSummary
__construct(array $items = [], private readonly ?string $title = null, private mixed $onEdit = null, private mixed $onDelete = null)
static new(array $items, ?string $title = null): self
withSelectedIndex(?int $index): self
withOnEdit(callable $onEdit): self
withOnDelete(callable $onDelete): self
setSize(int $width, int $height): Sizer
innerSize(): array
render(): stringRender the list, honoring the allocated box (finding sugar-dashboard- 064: setSize used to be stored and never read).

Modal final class

A modal dialog overlay component.

MethodSummary
__construct(private readonly \SugarCraft\Dashboard\Foundation\Item|string $content, private readonly ?string $title = null, private readonly ?Color $borderColor = null, private readonly ?Color $bgColor = null, private readonly string $style = 'single', private readonly bool $showClose = true, private readonly string $closeLabel = '×')
static new(\SugarCraft\Dashboard\Foundation\Item|string $content): selfCreate a new modal with default styling.
static titled(\SugarCraft\Dashboard\Foundation\Item|string $content, string $title): selfCreate a modal with a title.
setSize(int $width, int $height): \SugarCraft\Dashboard\Foundation\SizerSet the allocated dimensions for this modal.
render(): stringRender the modal as a string.
innerSize(): arrayCalculate the natural dimensions of this modal.
withContent(\SugarCraft\Dashboard\Foundation\Item|string $content): selfSet the modal content.
withTitle(?string $title): selfSet the modal title.
withBorderColor(?Color $color): selfSet the border color.
withBgColor(?Color $color): selfSet the background color.
withStyle(string $style): selfSet the border style.
withShowClose(bool $show): selfShow or hide the close button.
withCloseLabel(string $label): selfSet the close button label.

MultiselectModal final class

A modal dialog for selecting multiple items from a list.

MethodSummary
__construct(array $options = [], array $selectedIndices = [], private readonly ?string $title = null)
static new(array $options, ?string $title = null): self
withSelectedIndices(array $indices): self
toggle(int $index): self
setSize(int $width, int $height): static
innerSize(): array
render(): string

Notification final class

A notification component for displaying alert messages.

MethodSummary
__construct(private readonly string $message = '', private readonly string $title = '', private readonly ?Color $borderColor = null, private readonly ?Color $backgroundColor = null, private readonly ?Color $titleColor = null, private readonly ?Color $messageColor = null, private readonly string $icon = '')
static new(string $message = ''): selfCreate a new notification with default styling.
static success(string $message): selfCreate a success notification.
static warning(string $message): selfCreate a warning notification.
static error(string $message): selfCreate an error/danger notification.
static info(string $message): selfCreate an info notification.
setSize(int $width, int $height): \SugarCraft\Dashboard\Foundation\SizerSet the allocated dimensions for this notification.
render(): stringRender the notification as a string.
innerSize(): arrayCalculate the natural dimensions of this notification.
withMessage(string $message): selfSet the notification message.
withTitle(string $title): selfSet the notification title.
withBorderColor(?Color $color): selfSet the border color.
withBackgroundColor(?Color $color): selfSet the background color.
withTitleColor(?Color $color): selfSet the title color.
withMessageColor(?Color $color): selfSet the message color.
withIcon(string $icon): selfSet the icon.

Popover final class

A popover component that displays content in a bordered box.

MethodSummary
__construct(private readonly string $title = '', private readonly string $content = '', private readonly ?Color $borderColor = null, private readonly ?Color $backgroundColor = null, private readonly ?Color $titleColor = null, private readonly bool $showArrow = true)
static new(string $title = '', string $content = ''): selfCreate a new popover with default styling.
static info(string $title, string $content): selfCreate an informational popover.
static warning(string $title, string $content): selfCreate a warning popover.
static danger(string $title, string $content): selfCreate a danger popover.
setSize(int $width, int $height): \SugarCraft\Dashboard\Foundation\SizerSet the allocated dimensions for this popover.
render(): stringRender the popover as a string.
innerSize(): arrayCalculate the natural dimensions of this popover.
withTitle(string $title): selfSet the popover title.
withContent(string $content): selfSet the popover content.
withBorderColor(?Color $color): selfSet the border color.
withBackgroundColor(?Color $color): selfSet the background color.
withTitleColor(?Color $color): selfSet the title color.
withShowArrow(bool $show): selfShow or hide the arrow.

ProgressModal final class

A modal dialog that shows a progress bar.

MethodSummary
__construct(private readonly int $current, private readonly int $total, private readonly ?string $label = null)
setSize(int $width, int $height): staticFinding sugar-dashboard-182 (D-70 design leg): the modal answers the SizedItem channel; the painted row is clipped to the allocation. The crash leg (negative bar paint) landed already via D-66; there is no with* surface on this class - factories stay the plain builders.
innerSize(): array
static new(int $current, int $total, ?string $label = null): self
render(): string

Wizard final class

A multi-step wizard component.

MethodSummary
__construct(array $steps = [], private readonly int $currentStep = 0, private readonly ?Color $completedColor = null, private readonly ?Color $currentColor = null, private readonly ?Color $upcomingColor = null, private readonly string $completedChar = '✓', private readonly string $currentChar = '●', private readonly string $upcomingChar = '○', private readonly string $connectorChar = '─')
static fromSteps(array $stepTitles): selfCreate a new wizard with the given step titles.
setSize(int $width, int $height): \SugarCraft\Dashboard\Foundation\SizerSet the allocated dimensions for this wizard.
render(): stringRender the wizard as a string.
innerSize(): arrayCalculate the natural dimensions of this wizard.
withSteps(array $steps): selfSet the wizard steps.
addStep(WizardStep $step): selfAdd a step to the wizard.
withCurrentStep(int $step): selfSet the current step index.
withCompletedColor(?Color $color): selfSet the completed color.
withCurrentColor(?Color $color): selfSet the current step color.
withUpcomingColor(?Color $color): selfSet the upcoming step color.
withCompletedChar(string $char): selfSet the completed character.
withCurrentChar(string $char): selfSet the current character.
withUpcomingChar(string $char): selfSet the upcoming character.
withConnectorChar(string $char): selfSet the connector character.

WizardStep final readonly class

A step in a wizard.

MethodSummary
__construct(public string $title, public ?string $description = null)
static new(string $title, ?string $description = null): selfCreate a new wizard step.

SugarCraft\Dashboard\Components\Modal\Msg

AnsweredDeleteMsg final readonly class

Represents a delete action on an item (used by ListModal, MultiselectModal).

MethodSummary
__construct(public readonly mixed $item, public readonly int $index)

AnsweredEditMsg final readonly class

Represents an edit action on an item (used by ListModal, MultiselectModal).

MethodSummary
__construct(public readonly mixed $item, public readonly int $index)

AnsweredNoMsg final readonly class

Represents a negative answer (No / Cancel).

AnsweredYesMsg final readonly class

Represents an affirmative answer (OK / Yes / Confirm).

ClosedMsg final readonly class

Represents the modal being closed (cancelled).

Msg abstract readonly class

Base class for modal message types (TEA-style).

SugarCraft\Dashboard\Components\Nav

Breadcrumb final class

A breadcrumb navigation component.

MethodSummary
__construct(private readonly array $items, private readonly string $separator = '›', private readonly ?Color $separatorColor = null, private readonly ?Color $itemColor = null, private readonly ?Color $activeColor = null, private readonly int $activeIndex = -1)
static new(array $items): selfCreate a new breadcrumb with default styling.
static fromPath(string $path, string $separator = '/'): selfCreate a breadcrumb from a path string (e.g., "Home / Category / Item").
setSize(int $width, int $height): \SugarCraft\Dashboard\Foundation\SizerSet the allocated dimensions for this breadcrumb.
render(): stringRender the breadcrumb as a string.
innerSize(): arrayCalculate the natural dimensions of this breadcrumb.
withItems(array $items): selfSet new breadcrumb items.
withSeparator(string $separator): selfSet the separator character.
withSeparatorColor(?Color $color): selfSet the separator color.
withItemColor(?Color $color): selfSet the item (inactive) color.
withActiveColor(?Color $color): selfSet the active item color.
withActiveIndex(int $index): selfSet the active item index (-1 for last item).

Ladder final class

A ladder diagram for displaying process steps and timeline.

MethodSummary
__construct(private readonly array $steps, private readonly bool $horizontal = false, private readonly ?Color $completeColor = null, private readonly ?Color $currentColor = null, private readonly ?Color $pendingColor = null)
static new(array $steps): selfCreate a new ladder diagram.
static horizontal(array $steps): selfCreate a horizontal ladder.
setSize(int $width, int $height): \SugarCraft\Dashboard\Foundation\SizerSet the allocated dimensions for this ladder.
innerSize(): arrayCalculate the natural dimensions of this ladder.
render(): stringRender the ladder diagram.
withHorizontal(bool $horizontal): selfSet horizontal orientation.
withCompleteColor(?Color $color): selfSet complete color.
withCurrentColor(?Color $color): selfSet current color.
withPendingColor(?Color $color): selfSet pending color.

Menu final class

A horizontal menu bar component with dropdown submenus.

MethodSummary
__construct(private readonly array $items, private readonly int $selectedIndex = 0, private readonly int $submenuIndex = 0, private readonly bool $submenuOpen = false, private readonly ?Color $barColor = null, private readonly ?Color $itemColor = null, private readonly ?Color $activeItemColor = null, private readonly ?Color $submenuColor = null)
static new(array $items): selfCreate a new menu with default styling.
setSize(int $width, int $height): \SugarCraft\Dashboard\Foundation\SizerSet the allocated dimensions for this menu.
render(): stringRender the menu component.
innerSize(): arrayCalculate the natural dimensions of this menu.
withSelectedIndex(int $index): selfSet the selected top-level item index.
withSubmenuIndex(int $index): selfSet the submenu item index.
withSubmenuOpen(bool $open): selfSet whether the submenu is open.
withItems(array $items): selfSet the menu items.
withBarColor(?Color $color): selfSet the bar color.
withItemColor(?Color $color): selfSet the item color.
withActiveItemColor(?Color $color): selfSet the active item highlight color.
withSubmenuColor(?Color $color): selfSet the submenu color.

Navbar final class

A horizontal navigation bar component.

MethodSummary
__construct(private readonly array $items = [], private readonly ?string $brand = null, private readonly ?Color $borderColor = null, private readonly ?Color $activeColor = null, private readonly ?Color $inactiveColor = null, private readonly ?Color $bgColor = null)
static new(array $items = []): selfCreate a new navbar with default styling.
static brand(string $brand, array $items = []): selfCreate a navbar with a brand name.
setSize(int $width, int $height): \SugarCraft\Dashboard\Foundation\SizerSet the allocated dimensions for this navbar.
render(): stringRender the navbar as a string.
innerSize(): arrayCalculate the natural dimensions of this navbar.
withItems(array $items): selfSet the navbar items.
withBrand(?string $brand): selfSet the brand name.
withBorderColor(?Color $color): selfSet the border color.
withActiveColor(?Color $color): selfSet the active item color.
withInactiveColor(?Color $color): selfSet the inactive item color.
withBgColor(?Color $color): selfSet the background color.
withActiveItem(int $index): selfMark an item as active by index.

Pagination final class

A pagination control component.

MethodSummary
__construct(private readonly int $currentPage, private readonly int $totalPages, private readonly ?Color $activeColor = null, private readonly ?Color $inactiveColor = null, private readonly bool $showFirstLast = true, private readonly bool $showPrevNext = true, private readonly string $prevLabel = '‹', private readonly string $nextLabel = '›')
static new(int $currentPage, int $totalPages): selfCreate a new pagination with default styling.
setSize(int $width, int $height): \SugarCraft\Dashboard\Foundation\SizerSet the allocated dimensions for this pagination.
render(): stringRender the pagination as a string.
innerSize(): arrayCalculate the natural dimensions of this pagination.
withCurrentPage(int $page): selfSet the current page.
withTotalPages(int $total): selfSet the total pages.
withActiveColor(?Color $color): selfSet the active page color.
withInactiveColor(?Color $color): selfSet the inactive page color.
withShowFirstLast(bool $show): selfShow or hide first/last buttons.
withShowPrevNext(bool $show): selfShow or hide prev/next buttons.
withPrevLabel(string $label): selfSet the previous button label.
withNextLabel(string $label): selfSet the next button label.

PaginationSimple final class

A simple pagination control component.

MethodSummary
__construct(private readonly int $currentPage, private readonly int $totalPages, private readonly ?Color $activeColor = null, private readonly ?Color $inactiveColor = null, private readonly string $prevLabel = '‹', private readonly string $nextLabel = '›')
static new(int $currentPage, int $totalPages): selfCreate a new simple pagination with default styling.
setSize(int $width, int $height): \SugarCraft\Dashboard\Foundation\SizerSet the allocated dimensions for this pagination.
render(): stringRender the pagination as a string.
innerSize(): arrayCalculate the natural dimensions of this pagination.
withCurrentPage(int $page): selfSet the current page.
withTotalPages(int $total): selfSet the total pages.
withActiveColor(?Color $color): selfSet the active page color.
withInactiveColor(?Color $color): selfSet the inactive page color.
withPrevLabel(string $label): selfSet the previous button label.
withNextLabel(string $label): selfSet the next button label.

Scrollbar final class

A scrollbar component for terminal content.

MethodSummary
__construct(private readonly float $position = 0.0, private readonly float $viewportRatio = 0.3, private readonly int $heightConstraint = 10, private readonly ?Color $thumbColor = null, private readonly ?Color $trackColor = null, private readonly bool $showArrows = true, private readonly string $thumbChar = '█', private readonly string $trackChar = '│', private readonly string $arrowUp = '▲', private readonly string $arrowDown = '▼')
static new(float $position, float $viewportRatio = 0.3): selfCreate a new scrollbar with default styling.
setSize(int $width, int $height): \SugarCraft\Dashboard\Foundation\SizerSet the allocated dimensions for this scrollbar.
render(): stringRender the scrollbar as a string.
innerSize(): arrayCalculate the natural dimensions of this scrollbar.
withPosition(float $position): selfSet the scroll position (0.0 to 1.0).
withViewportRatio(float $ratio): selfSet the viewport ratio (how much of the content is visible, 0.1 to 1.0).
withHeight(int $height): selfSet the height constraint.
withThumbColor(?Color $color): selfSet the thumb color.
withTrackColor(?Color $color): selfSet the track color.
withShowArrows(bool $show): selfShow or hide arrow buttons.
withChars(string $thumb, string $track): selfSet custom thumb and track characters.
withArrows(string $up, string $down): selfSet custom arrow characters.

Sequence final class

A sequence diagram component for visualizing object interactions.

MethodSummary
__construct(private ?Color $lifelineColor = null, private ?Color $messageColor = null, private ?Color $textColor = null, private ?Color $activationColor = null, private string $style_ = 'rounded')
static new(): selfCreate a new sequence diagram with default styling.
setSize(int $width, int $height): \SugarCraft\Dashboard\Foundation\SizerSet the allocated dimensions for this sequence diagram.
withParticipant(SequenceParticipant $participant): selfAdd a participant to the diagram.
addParticipant(string $id, string $label, ?Color $color = null): selfAdd a participant by parameters.
withParticipants(array $participants): selfAdd all participants at once.
withMessage(SequenceMessage $message): selfAdd a message to the diagram.
addMessage(string $id, string $from, string $to, string $label, ?Color $color = null): selfAdd a message by parameters.
addReply(string $id, string $from, string $to, string $label, ?Color $color = null): selfAdd a reply message.
withMessages(array $messages): selfAdd all messages at once.
withShowLabels(bool $show): selfShow or hide labels.
withShowActivations(bool $show): selfShow or hide activations.
withStyle(string $style): selfSet the border style.
render(): stringRender the sequence diagram as a string.
innerSize(): arrayCalculate the natural dimensions of this sequence diagram.
withLifelineColor(?Color $color): selfSet the lifeline color.
withMessageColor(?Color $color): selfSet the message color.
withTextColor(?Color $color): selfSet the text color.
withActivationColor(?Color $color): selfSet the activation color.
withBorderStyle(string $style): selfSet the border style.

SequenceMessage final class

A message sent between participants in a sequence diagram.

MethodSummary
__construct(public readonly string $id, public readonly string $from, public readonly string $to, public readonly string $label, public readonly bool $isReply = false, public readonly ?Color $color = null)
static reply(string $id, string $from, string $to, string $label, ?Color $color = null): selfCreate a reply message.

SequenceParticipant final class

A participant (object/actor) in a sequence diagram.

MethodSummary
__construct(public readonly string $id, public readonly string $label, public readonly ?Color $color = null)
static actor(string $id, string $label): selfCreate an actor participant.
static object(string $id, string $label): selfCreate an object participant.

Stepper final class

A stepper / step indicator component for multi-step wizards.

MethodSummary
__construct(private readonly array $steps, private readonly bool $showNumbers = true, private readonly ?Color $completedColor = null, private readonly ?Color $activeColor = null, private readonly ?Color $pendingColor = null, private readonly ?Color $connectorColor = null)
static new(array $steps): selfCreate a new stepper with default styling.
static fromLabels(array $stepLabels, int $currentStep = 0): selfCreate a stepper with specific step labels and current step index.
setSize(int $width, int $height): \SugarCraft\Dashboard\Foundation\SizerSet the allocated dimensions for this stepper.
render(): stringRender the stepper as a string.
innerSize(): arrayCalculate the natural dimensions of this stepper.
withSteps(array $steps): selfSet the steps.
withActiveStep(int $step): selfSet the current active step.
withShowNumbers(bool $show): selfShow or hide step numbers.
withCompletedColor(?Color $color): selfSet the completed step color.
withActiveColor(?Color $color): selfSet the active step color.
withPendingColor(?Color $color): selfSet the pending step color.
withConnectorColor(?Color $color): selfSet the connector color.

SugarCraft\Dashboard\Components\Select

AutoPositionHelper final class

Determines optimal overlay position based on available space. Mirrors teafields position.go auto-positioning logic.

MethodSummary
static vertical(int|string $anchorRectY, int $anchorHeight, int $availableHeight): OverlayPositionGiven anchorRect (y, height) and availableHeight, returns OverlayPosition::Top or OverlayPosition::Bottom depending on which has more room.

ColorPicker final class

A color picker component with preset color swatches.

MethodSummary
__construct(private readonly array $palette = [], private readonly ?int $selectedIndex = 0, private readonly bool $showHex = true, private readonly int $columns = 4, private readonly ?Color $selectedColor = null, private readonly ?Color $hoverColor = null)
static new(?int $selectedIndex = null): selfCreate a new color picker with default palette.
static fromPalette(array $hexColors, ?int $selectedIndex = null): selfCreate with a custom palette.
setSize(int $width, int $height): \SugarCraft\Dashboard\Foundation\SizerSet the allocated dimensions for this color picker.
render(): stringRender the color picker as a string.
innerSize(): arrayCalculate the natural dimensions of this color picker.
withSelectedIndex(int $index): selfSet the selected color index.
withShowHex(bool $show): selfSet whether to show hex code.
withColumns(int $cols): selfSet the number of columns.
withSelectedColor(?Color $color): selfSet the selected color highlight style.
withHoverColor(?Color $color): selfSet the hover color style.
withPalette(array $palette): selfSet a new palette.

ComboBox final class

A combobox component with search filtering.

MethodSummary
__construct(private readonly string $placeholder = 'Search...', private readonly array $options = [], private readonly string $query = '', private readonly int $selectedIndex = 0, private readonly ?Color $inputColor = null, private readonly ?Color $matchColor = null, private readonly ?Color $selectedColor = null)
static new(string $placeholder = 'Search...', array $options = []): selfCreate a new combobox with default styling.
setSize(int $width, int $height): \SugarCraft\Dashboard\Foundation\SizerSet the allocated dimensions for this combobox.
render(): stringRender the combobox as a string.
innerSize(): arrayCalculate the natural dimensions of this combobox.
withPlaceholder(string $placeholder): selfSet the placeholder text.
withOptions(array $options): selfSet the options.
withQuery(string $query): selfSet the search query.
withSelectedIndex(int $index): selfSet the selected result index.
withInputColor(?Color $color): selfSet the input color.
withMatchColor(?Color $color): selfSet the match highlight color.
withSelectedColor(?Color $color): selfSet the selected item color.

DatePicker final class

A date picker component.

MethodSummary
__construct(private readonly int $year = 0, private readonly int $month = 0, private readonly int $selectedDay = 0, private readonly int $startDayOfWeek = self::DAYS_SUNDAY, private readonly ?Color $headerColor = null, private readonly ?Color $selectedColor = null, private readonly ?Color $todayColor = null, private readonly ?Color $weekendColor = null)
static new(int $year, int $month, ?int $selectedDay = null): selfCreate a new date picker with default styling.
static today(): selfCreate for current month.
setSize(int $width, int $height): \SugarCraft\Dashboard\Foundation\SizerSet the allocated dimensions for this date picker.
render(): stringRender the date picker as a string.
innerSize(): arrayCalculate the natural dimensions of this date picker.
withDate(int $year, int $month): selfSet the year and month.
withSelectedDay(int $day): selfSet the selected day.
withPreviousMonth(): selfNavigate to the previous month.
withNextMonth(): selfNavigate to the next month.
withStartDayOfWeek(int $day): selfSet the starting day of week.
withHeaderColor(?Color $color): selfSet the header color.
withSelectedColor(?Color $color): selfSet the selected day color.
withTodayColor(?Color $color): selfSet the today highlight color.
withWeekendColor(?Color $color): selfSet the weekend day color.

Dropdown final class

A dropdown menu component.

MethodSummary
__construct(private readonly string $label, private readonly array $items, private readonly bool $expanded = false, private readonly int $selectedIndex = 0, private readonly ?Color $triggerColor = null, private readonly ?Color $menuColor = null, private readonly ?Color $selectedItemColor = null, private readonly string $expandIcon = '▾', private readonly string $collapseIcon = '▸')
static new(string $label, array $items): selfCreate a new dropdown with default styling.
setSize(int $width, int $height): \SugarCraft\Dashboard\Foundation\SizerSet the allocated dimensions for this dropdown.
render(): stringRender the dropdown component.
innerSize(): arrayCalculate the natural dimensions of this dropdown.
withLabel(string $label): selfSet the dropdown label.
withItems(array $items): selfSet the dropdown items.
withExpanded(bool $expanded): selfSet the expanded state.
withSelectedIndex(int $index): selfSet the selected item index.
withTriggerColor(?Color $color): selfSet the trigger color.
withMenuColor(?Color $color): selfSet the menu color.
withSelectedItemColor(?Color $color): selfSet the selected item highlight color.
withIcons(string $expand, string $collapse): selfSet custom expand/collapse icons.

Option final class

Represents a single option in a select dropdown.

MethodSummary
__construct(public readonly string $label, public readonly ?string $value = null, public readonly ?string $icon = null, public readonly bool $disabled = false)
static fromArray(array $data): selfCreate an option from an array.
toArray(): arrayConvert to array representation.

OverlayPosition enum

Positioning options for overlay components like dropdowns, tooltips, and modals.

Cases: Top · Bottom · Left · Right · TopStart · TopEnd · BottomStart · BottomEnd · LeftStart · LeftEnd · RightStart · RightEnd · Center

PHP also provides cases(), from() and tryFrom().

MethodSummary
opposite(): selfGet the opposite position.
isHorizontal(): boolCheck if this is a horizontal position.
isVertical(): boolCheck if this is a vertical position.

Radio final class

A radio button group component.

MethodSummary
__construct(private readonly array $options, private readonly int $selectedIndex = 0, private readonly ?Color $selectedColor = null, private readonly ?Color $unselectedColor = null, private readonly string $selectedChar = '◉', private readonly string $unselectedChar = '○')
static new(array $options): selfCreate a new radio group with default styling.
setSize(int $width, int $height): \SugarCraft\Dashboard\Foundation\SizerSet the allocated dimensions for this radio group.
render(): stringRender the radio group.
innerSize(): arrayCalculate the natural dimensions of this radio group.
withSelectedIndex(int $index): selfSet the selected option index.
withOptions(array $options): selfSet new options.
withSelectedColor(?Color $color): selfSet the color for selected items.
withUnselectedColor(?Color $color): selfSet the color for unselected items.
withChars(string $selected, string $unselected): selfSet custom characters for selected and unselected states.

Select final class

A dropdown select component.

MethodSummary
__construct(private readonly array $options, private readonly int $selectedIndex = 0, private readonly ?Color $selectedColor = null, private readonly ?Color $unselectedColor = null, private readonly string $selectedChar = '▶', private readonly string $unselectedChar = '○')
static new(array $options): selfCreate a new select component with default styling.
setSize(int $width, int $height): \SugarCraft\Dashboard\Foundation\SizerSet the allocated dimensions for this select component.
render(): stringRender the select component.
innerSize(): arrayCalculate the natural dimensions of this select component.
withSelectedIndex(int $index): selfSet the selected option index.
withOptions(array $options): selfSet new options.
withSelectedColor(?Color $color): selfSet the color for selected items.
withUnselectedColor(?Color $color): selfSet the color for unselected items.
withChars(string $selected, string $unselected): selfSet custom characters for selected and unselected states.

SugarCraft\Dashboard\Components\StatusBar

MenuItem final class

A menu item for use in status bar menus.

MethodSummary
__construct(private readonly string $label, private readonly ?string $shortcut = null, private readonly ?\SugarCraft\Dashboard\Components\StatusBar\StatusIndicator $indicator = null)
static new(string $label): self
render(): string

SeparatorKind enum

Separator kinds for status bar menus.

Cases: Line · Dotted · Dashed · Double

PHP also provides cases(), from() and tryFrom().

StatusBar final class

A horizontal status bar with multiple segments.

MethodSummary
__construct(private readonly string $left = '', private readonly string $center = '', private readonly string $right = '', private readonly ?Color $foreground = null, private readonly ?Color $background = null, private readonly string $leftBorder = '', private readonly string $rightBorder = '')
static new(): selfCreate a new status bar with default styling.
setSize(int $width, int $height): \SugarCraft\Dashboard\Foundation\SizerSet the allocated dimensions for this status bar.
render(): stringRender the status bar as a string.
innerSize(): arrayCalculate the natural dimensions of this status bar.
withLeft(string $left): selfSet the left segment content.
withCenter(string $center): selfSet the center segment content.
withRight(string $right): selfSet the right segment content.
withSegments(string $left, string $center, string $right): selfSet all segment contents at once.
withForeground(?Color $color): selfSet the foreground color.
withBackground(?Color $color): selfSet the background color.
withBorders(string $left, string $right): selfSet border characters for left and right sides.

StatusIndicator final class

A status indicator dot/light component.

MethodSummary
__construct(private readonly string $status = self::Online, private readonly ?Color $color = null, private readonly bool $pulse = false, private readonly int $size = 1)
static new(string $status = self::Online): selfCreate a new status indicator with default styling.
static online(): selfCreate an online/success status indicator.
static offline(): selfCreate an offline status indicator.
static warning(): selfCreate a warning status indicator.
static error(): selfCreate an error status indicator.
static info(): selfCreate an info status indicator.
setSize(int $width, int $height): \SugarCraft\Dashboard\Foundation\SizerSet the allocated dimensions for this indicator.
render(?float $now = null): stringRender the status indicator.
symbol(): stringGet the symbol character for the indicator.
getSymbol(): stringBC forwarder for the pre-rename accessor name.
status(): stringGet the current status type.
getStatus(): stringBC forwarder for the pre-rename accessor name.
innerSize(): arrayCalculate the natural dimensions of this indicator.
withStatus(string $status): selfSet the status type.
withColor(?Color $color): selfSet the indicator color.
withPulse(bool $pulse): selfEnable or disable pulse animation.
withSize(int $size): selfSet the size (number of indicator characters).

SugarCraft\Dashboard\Components\System

Clock final class

A digital clock display component.

MethodSummary
__construct(private readonly bool $use24Hour = false, private readonly bool $showSeconds = true, private readonly bool $showDate = false, private readonly ?Color $color = null)
static new(): selfCreate a new clock with default styling (24-hour with seconds).
static twentyFourHour(): selfCreate a 24-hour format clock.
setSize(int $width, int $height): \SugarCraft\Dashboard\Foundation\SizerSet the allocated dimensions for this clock.
render(?int $now = null): stringRender the clock showing current time.
innerSize(): arrayCalculate the natural dimensions of this clock.
with24Hour(bool $use24Hour): selfUse 24-hour format instead of 12-hour.
withSeconds(bool $show): selfShow or hide seconds.
withDate(bool $show): selfShow or hide the date.
withColor(?Color $color): selfSet the clock color.

Console final class

A styled console output component.

MethodSummary
__construct(array $entries = [], private readonly ?int $maxEntries = null, private readonly bool $showTimestamps = false, private readonly bool $wordWrap = true, private readonly ?ConsoleStream $minStream = null, private readonly bool $showPrefix = true, private readonly ?int $timestampWidth = null, private readonly ?Color $timestampColor = null, private readonly ?Color $prefixColor = null)
static new(): selfCreate a new console with default styling.
setSize(int $width, int $height): \SugarCraft\Dashboard\Foundation\SizerSet the allocated dimensions for this console.
render(): stringRender the console as a string.
innerSize(): arrayCalculate the natural dimensions of this console.
withEntries(array $entries): selfAdd console entries.
withEntry(ConsoleEntry $entry): selfAdd a single console entry.
withMaxEntries(?int $max): selfSet the maximum number of entries to display.
withTimestamps(bool $show): selfShow or hide timestamps.
withWordWrap(bool $wordWrap): selfEnable or disable word-wrapping.
withMinStream(?ConsoleStream $stream): selfSet the minimum stream level to display.
withShowPrefix(bool $show): selfShow or hide stream prefixes.
withTimestampWidth(?int $width): selfSet the timestamp column width.
withTimestampColor(?Color $color): selfSet the timestamp color.
withPrefixColor(?Color $color): selfSet the prefix color.

ConsoleEntry final readonly class

MethodSummary
__construct(public string $message, public ConsoleStream $stream = ConsoleStream::Stdout, public ?Color $color = null)
static new(string $message, ConsoleStream $stream = ConsoleStream::Stdout, ?Color $color = null): self
static info(string $message): self
static success(string $message): self
static warning(string $message): self
static error(string $message): self
static debug(string $message): self
static raw(string $message): self

ConsoleStream enum

Cases: Stdout · Stderr · Info · Success · Warning · Error · Debug · Raw

PHP also provides cases(), from() and tryFrom().

MethodSummary
defaultColor(): Color
prefix(): string
isError(): bool
sortOrder(): int

HexDump final class

A hexadecimal dump display component.

MethodSummary
__construct(private readonly string $data, private readonly int $bytesPerLine = self::BYTES_PER_LINE_16, private readonly ?Color $offsetColor = null, private readonly ?Color $hexColor = null, private readonly ?Color $asciiColor = null, private readonly ?Color $nonPrintableColor = null, private readonly bool $uppercase = true)
static new(string $data): selfCreate a new hex dump with default styling (Catppuccin Mocha theme).
static compact(string $data): selfCreate a hex dump with 8 bytes per line (compact).
setSize(int $width, int $height): \SugarCraft\Dashboard\Foundation\SizerSet the allocated dimensions for this hex dump.
render(): stringRender the hex dump as a string.
innerSize(): arrayCalculate the natural dimensions of this hex dump.
withBytesPerLine(int $bytesPerLine): selfSet the bytes per line (8 or 16).
withOffsetColor(?Color $color): selfSet the offset column color.
withHexColor(?Color $color): selfSet the hex bytes color.
withAsciiColor(?Color $color): selfSet the ASCII column color.
withNonPrintableColor(?Color $color): selfSet the non-printable character color.
withUppercase(bool $uppercase): selfSet uppercase or lowercase hex output.
withData(string $data): selfSet new data content.

Log final class

A log viewer component with severity level filtering and display.

MethodSummary
__construct(array $entries = [], private readonly ?int $maxEntries = null, private readonly ?LogLevel $minLevel = null, private readonly bool $showTimestamps = true, private readonly bool $wordWrap = true, private readonly ?int $timestampWidth = null, private readonly ?Color $timestampColor = null)
static new(): selfCreate a new log viewer with default styling.
setSize(int $width, int $height): \SugarCraft\Dashboard\Foundation\SizerSet the allocated dimensions for this log viewer.
render(): stringRender the log viewer as a string.
innerSize(): arrayCalculate the natural dimensions of this log viewer.
withEntries(array $entries): selfAdd log entries to the viewer.
withEntry(LogEntry $entry): selfAdd a single log entry.
withMaxEntries(?int $max): selfSet the maximum number of entries to keep.
withMinLevel(?LogLevel $level): selfSet the minimum log level to display.
withTimestamps(bool $show): selfShow or hide timestamps.
withWordWrap(bool $wordWrap): selfEnable or disable word-wrapping.
withTimestampWidth(?int $width): selfSet the timestamp column width.
withTimestampColor(?Color $color): selfSet the timestamp color.

LogEntry final readonly class

A log entry with timestamp, level, and message.

MethodSummary
__construct(public string $timestamp, public LogLevel $level, public string $message)
static new(string $message, LogLevel $level = LogLevel::Info, ?string $timestamp = null): selfCreate a new log entry.

LogLevel enum

Log entry severity levels.

Cases: Debug · Info · Warn · Error · Fatal

PHP also provides cases(), from() and tryFrom().

MethodSummary
defaultColor(): ColorGet the default color for this severity level.
sortOrder(): intGet the sort order for this level (lower = more severe).

LogViewer final class

A scrollable log viewer component with severity-based colors.

MethodSummary
__construct(array $entries, private readonly bool $showTimestamps = false, private readonly bool $showSeverityPrefix = true, private readonly bool $scrollToBottom = true, private readonly int $visibleLines = 10)
static new(array $entries): selfCreate a new log viewer with the given entries.
static fromMessages(array $messages): selfCreate a log viewer from a simple list of messages (all info level).
setSize(int $width, int $height): \SugarCraft\Dashboard\Foundation\SizerSet the allocated dimensions for this log viewer.
render(): stringRender the log viewer.
innerSize(): arrayCalculate the natural dimensions of this log viewer.
entryCount(): intGet the number of entries.
getEntryCount(): intBC forwarder for the pre-rename accessor name.
withEntries(array $entries): selfSet the log entries.
withEntry(array $entry): selfAdd a new entry to the log.
withShowTimestamps(bool $show): selfShow or hide timestamps.
withShowSeverityPrefix(bool $show): selfShow or hide severity prefix.
withScrollToBottom(bool $bottom): selfSet scroll behavior (true = bottom, false = top).
withVisibleLines(int $lines): selfSet the number of visible lines.

NProgress final class

A YouTube-style thin progress bar component.

MethodSummary
__construct(private readonly float $ratio = 0.0, private readonly ?Color $color = null, private readonly ?Color $trackColor = null, private readonly bool $showPercentage = false)
static new(float $ratio = 0.0): selfCreate a new nprogress bar with default styling.
static loading(): selfCreate a loading-state nprogress (indeterminate).
setSize(int $width, int $height): \SugarCraft\Dashboard\Foundation\SizerSet the allocated dimensions for this progress bar.
render(): stringRender the progress bar as a string.
innerSize(): arrayCalculate the natural dimensions of this progress bar.
withRatio(float $ratio): selfSet the progress ratio (0.0 to 1.0).
withColor(?Color $color): selfSet the bar color.
withTrackColor(?Color $color): selfSet the track (background) color.
withShowPercentage(bool $show): selfShow or hide the percentage text.
withTheme(Theme $theme): selfApply a theme to this progress bar, using the theme's primary color for the bar and background for the track.

ProgressBar final class

A simple horizontal progress bar component.

MethodSummary
__construct(private readonly float $ratio, private readonly ?int $widthConstraint = null, private readonly bool $showPercentage = true, private readonly ?Color $filledColor = null, private readonly ?Color $emptyColor = null, private readonly string $filledChar = '█', private readonly string $emptyChar = '░', private readonly bool $labelAfter = true)
static new(float $ratio): selfCreate a new progress bar with default styling.
setSize(int $width, int $height): \SugarCraft\Dashboard\Foundation\SizerSet the allocated dimensions for this progress bar.
render(): stringRender the progress bar as a string.
innerSize(): arrayCalculate the natural dimensions of this progress bar.
withWidth(int $width): selfSet the width constraint (number of bar characters).
withPercentage(bool $show): selfShow or hide the percentage label.
withFilledColor(?Color $color): selfSet the color for the filled portion.
withEmptyColor(?Color $color): selfSet the color for the empty portion.
withChars(string $filled, string $empty): selfSet custom characters for filled and empty portions.
withRatio(float $ratio): selfSet a new ratio value.
withLabelAfter(bool $after): selfSet whether label appears after or before the bar.

ProgressList final class

A list component with progress indicators for each item.

MethodSummary
__construct(private readonly array $items, private readonly bool $showProgressBars = true, private readonly bool $showPercentages = true, private readonly int $progressBarWidth = 20, private readonly HAlign $labelAlign = HAlign::Left)
static new(array $items): selfCreate a new progress list with the given items.
setSize(int $width, int $height): \SugarCraft\Dashboard\Foundation\SizerSet the allocated dimensions for this list.
render(): stringRender the progress list.
innerSize(): arrayCalculate the natural dimensions of this list.
withItems(array $items): selfSet the items for this list.
withShowProgressBars(bool $show): selfShow or hide progress bars.
withShowPercentages(bool $show): selfShow or hide percentages.
withProgressBarWidth(int $width): selfSet the progress bar width.
withLabelAlign(HAlign $align): selfSet the label alignment.

PromptStyle enum

Terminal prompt styles.

Cases: Bash · Pwsh · PS · Simple

PHP also provides cases(), from() and tryFrom().

MethodSummary
prompt(string $cwd = '~'): stringGet the prompt string for this style.

Stopwatch final class

A stopwatch component.

MethodSummary
__construct(private readonly int $elapsedMilliseconds = 0, private readonly bool $showMilliseconds = true, private readonly bool $isRunning = false, private readonly ?Color $color = null)
static new(): selfCreate a new stopped stopwatch at zero.
static start(): selfCreate a running stopwatch.
setSize(int $width, int $height): \SugarCraft\Dashboard\Foundation\SizerSet the allocated dimensions for this stopwatch.
render(): stringRender the stopwatch display.
innerSize(): arrayCalculate the natural dimensions of this stopwatch.
elapsedSeconds(): intGet the elapsed time in seconds.
getElapsedSeconds(): intBC forwarder for the pre-rename accessor name.
elapsedMilliseconds(): intGet the elapsed milliseconds.
getElapsedMilliseconds(): intBC forwarder for the pre-rename accessor name.
withElapsedMillis(int $milliseconds): selfSet the elapsed time in MILLISECONDS.
withElapsed(int $milliseconds): selfSet the elapsed time in milliseconds.
withRunning(bool $isRunning): selfSet the running state.
withMilliseconds(bool $show): selfShow or hide milliseconds.
withColor(?Color $color): selfSet the stopwatch color.

Terminal final class

A terminal emulator component with command history and scrollback.

MethodSummary
__construct(private readonly ?int $maxHistory = null, private readonly ?int $maxOutput = null, private readonly bool $showPrompt = true, private readonly PromptStyle $promptStyle = PromptStyle::Bash, private readonly ?string $customPrompt = null, private readonly ?Color $promptColor = null, private readonly ?Color $inputColor = null, private readonly ?Color $outputColor = null, private readonly ?Color $errorColor = null, private readonly ?Color $backgroundColor = null, private readonly ?Color $borderColor = null, private readonly string $style = 'rounded')
static new(): selfCreate a new terminal with default styling.
setSize(int $width, int $height): \SugarCraft\Dashboard\Foundation\SizerSet the allocated dimensions for this terminal.
prompt(): stringGet the prompt string.
getPrompt(): stringBC forwarder for the pre-rename accessor name.
input(): stringGet the current input.
getInput(): stringBC forwarder for the pre-rename accessor name.
history(): arrayGet the command history.
getHistory(): arrayBC forwarder for the pre-rename accessor name.
output(): arrayGet the output lines.
getOutput(): arrayBC forwarder for the pre-rename accessor name.
type(string $input): selfType a command into the terminal.
submit(): selfSubmit the current command.
withOutput(string $text, bool $isError = false): selfAdd output text.
withBlankLine(): selfAdd a blank line to output.
historyUp(): selfNavigate history up (previous command).
historyDown(): selfNavigate history down (next command).
clearScreen(): selfClear the screen (adds clear command to output).
clearInput(): selfClear the input line.
render(): stringRender the terminal as a string.
innerSize(): arrayCalculate the natural dimensions of this terminal.
withPromptStyle(PromptStyle $style): selfSet the prompt style.
withCustomPrompt(?string $prompt): selfSet a custom prompt string.
withShowPrompt(bool $show): selfShow or hide the prompt.
withMaxHistory(?int $max): selfSet the maximum history size.
withMaxOutput(?int $max): selfSet the maximum output size.
withPromptColor(?Color $color): selfSet the prompt color.
withInputColor(?Color $color): selfSet the input color.
withOutputColor(?Color $color): selfSet the output color.
withStyle(string $style): selfSet the border style.

Timer final class

A countdown timer component.

MethodSummary
__construct(private readonly int $totalSeconds, private readonly int $elapsedSeconds = 0, private readonly bool $isRunning = false, private readonly ?Color $color = null, private readonly ?Color $warningColor = null, private readonly int $warningThreshold = 60)
static new(int $seconds): selfCreate a new timer with the specified duration.
static fromMinutes(int $minutes): selfCreate a timer from minutes.
setSize(int $width, int $height): \SugarCraft\Dashboard\Foundation\SizerSet the allocated dimensions for this timer.
render(): stringRender the timer display.
innerSize(): arrayCalculate the natural dimensions of this timer.
remainingSeconds(): intGet the remaining seconds.
getRemainingSeconds(): intBC forwarder for the pre-rename accessor name.
isExpired(): boolCheck if timer has expired.
withElapsedSeconds(int $seconds): selfSet the elapsed time in SECONDS (for ticking).
withElapsed(int $seconds): selfSet the elapsed time in seconds.
withRunning(bool $isRunning): selfSet the running state.
withColor(?Color $color): selfSet the timer color.
withWarningColor(?Color $color): selfSet the warning color (used when time is running low).
withWarningThreshold(int $seconds): selfSet the warning threshold in seconds.

SugarCraft\Dashboard\Components\Table

TableBordered final class

A table component with box-drawing character borders.

MethodSummary
__construct(private readonly array $columns, private readonly array $rows, private readonly ?Color $borderColor = null, private readonly ?Color $headerColor = null, private readonly ?Color $headerBackgroundColor = null, private readonly bool $showHeader = true)
static new(array $columns, array $rows = []): selfCreate a new bordered table with default styling.
setSize(int $width, int $height): \SugarCraft\Dashboard\Foundation\SizerSet the allocated dimensions for this table.
render(): stringRender the table as a string.
innerSize(): arrayCalculate the natural dimensions of this table.
withColumns(array $columns): selfSet the column definitions.
withRows(array $rows): selfSet the data rows.
withAddedRow(array $row): selfAdd a data row.
withBorderColor(?Color $color): selfSet the border color.
withHeaderColor(?Color $color): selfSet the header text color.
withHeaderBackgroundColor(?Color $color): selfSet the header background color.
withShowHeader(bool $show): selfShow or hide the header row.

TableChart final class

A data table component with customizable columns, rows, and styling.

MethodSummary
__construct(private readonly array $columnHeaders = [], private readonly array $rows = [], private readonly ?array $columnWidths = null, private readonly ?array $columnAlignments = null, private readonly bool $showHeader = true, private readonly bool $zebraStriping = true, private readonly ?Color $headerColor = null, private readonly ?Color $borderColor = null, private readonly ?Color $zebraColor = null, private readonly string $borderStyle = 'rounded')
static new(array $columnHeaders, array $rows = []): selfCreate a new table chart.
static sample(): selfCreate a sample table for demonstration.
setSize(int $width, int $height): \SugarCraft\Dashboard\Foundation\SizerSet the allocated dimensions for this table.
render(): stringRender the table.
innerSize(): arrayCalculate the natural dimensions of this table.
withRows(array $rows): selfSet the rows.
withShowHeader(bool $show): selfSet the header visibility.
withZebraStriping(bool $zebra): selfSet zebra striping.
withBorderStyle(string $style): selfSet the border style.
withHeaderColor(?Color $color): selfSet the header color.

TableZebra final class

A table component with alternating row colors (zebra striping).

MethodSummary
__construct(private readonly array $columns, private readonly array $rows, private readonly ?Color $oddRowColor = null, private readonly ?Color $evenRowColor = null, private readonly ?Color $headerColor = null, private readonly ?Color $headerBackgroundColor = null, private readonly bool $showHeader = true, private readonly bool $showSeparators = false)
static new(array $columns, array $rows = []): selfCreate a new zebra-striped table with default styling (Catppuccin Mocha).
static plain(array $columns, array $rows = []): selfCreate a zebra table with no row colors (plain).
setSize(int $width, int $height): \SugarCraft\Dashboard\Foundation\SizerSet the allocated dimensions for this table.
render(): stringRender the table as a string.
innerSize(): arrayCalculate the natural dimensions of this table.
withColumns(array $columns): selfSet the column definitions.
withRows(array $rows): selfSet the data rows.
withAddedRow(array $row): selfAdd a data row.
withOddRowColor(?Color $color): selfSet the odd row background color.
withEvenRowColor(?Color $color): selfSet the even row background color.
withHeaderColor(?Color $color): selfSet the header text color.
withHeaderBackgroundColor(?Color $color): selfSet the header background color.
withShowHeader(bool $show): selfShow or hide the header row.
withShowSeparators(bool $show): selfShow or hide row separators.

SugarCraft\Dashboard\Components\Tabs

TabPane final class

A pane container for tab content.

MethodSummary
__construct(private readonly \SugarCraft\Dashboard\Foundation\Item $content, private readonly ?Color $borderColor = null, private readonly string $borderChar = '│', private readonly bool $padded = true)
static new(\SugarCraft\Dashboard\Foundation\Item $content): selfCreate a new tab pane with default styling.
setSize(int $width, int $height): \SugarCraft\Dashboard\Foundation\SizerSet the allocated dimensions for this tab pane.
render(): stringRender the tab pane.
innerSize(): arrayCalculate the natural dimensions of this tab pane.
withBorderColor(?Color $color): selfSet the border color.
withBorderChar(string $char): selfSet the border character.
withPadded(bool $padded): selfSet the padded flag.

Tabs final class

A tabbed interface component.

MethodSummary
__construct(private readonly array $tabs, private readonly int $selectedIndex = 0, private readonly ?Color $activeColor = null, private readonly ?Color $inactiveColor = null, private readonly string $separator = '│', private readonly string $activeChar = '─')
static new(array $tabs): selfCreate a new tabs component with default styling.
setSize(int $width, int $height): \SugarCraft\Dashboard\Foundation\SizerSet the allocated dimensions for these tabs.
render(): stringRender the tabs component.
innerSize(): arrayCalculate the natural dimensions of these tabs.
withSelectedIndex(int $index): selfSet the selected tab index.
withActiveColor(?Color $color): selfSet the color for the active tab.
withInactiveColor(?Color $color): selfSet the color for inactive tabs.
withSeparator(string $separator): selfSet the separator character between tabs.
withActiveChar(string $char): selfSet the character used for active tab underline.
withTabs(array $tabs): selfSet new tabs content.

TabsVertical final class

A vertical tabs component.

MethodSummary
__construct(private readonly array $tabs, private readonly int $selectedIndex = 0, private readonly ?Color $activeColor = null, private readonly ?Color $inactiveColor = null, private readonly string $separator = '│', private readonly int $labelWidth = 12)
static new(array $tabs): selfCreate a new vertical tabs component with default styling.
setSize(int $width, int $height): \SugarCraft\Dashboard\Foundation\SizerSet the allocated dimensions for these vertical tabs.
render(): stringRender the vertical tabs component.
innerSize(): arrayCalculate the natural dimensions of these vertical tabs.
withSelectedIndex(int $index): selfSet the selected tab index.
withActiveColor(?Color $color): selfSet the color for the active tab.
withInactiveColor(?Color $color): selfSet the color for inactive tabs.
withSeparator(string $separator): selfSet the separator character between labels and content.
withLabelWidth(int $width): selfSet the width reserved for tab labels.
withTabs(array $tabs): selfSet new tabs content.

SugarCraft\Dashboard\Components\Toast

Hint final class

A hint / caption text component.

MethodSummary
__construct(private readonly string $text, private readonly ?Color $color = null, private readonly string $style = 'normal', private readonly string $icon = '')
static new(string $text): selfCreate a new hint with default styling.
static muted(string $text): selfCreate a muted/secondary hint.
static italic(string $text): selfCreate an italic hint.
static info(string $text): selfCreate an info-style hint.
static success(string $text): selfCreate a success-style hint.
static warning(string $text): selfCreate a warning-style hint.
static danger(string $text): selfCreate a danger-style hint.
setSize(int $width, int $height): \SugarCraft\Dashboard\Foundation\SizerSet the allocated dimensions for this hint.
render(): stringRender the hint as a string.
innerSize(): arrayCalculate the natural dimensions of this hint.
withText(string $text): selfSet the hint text.
withColor(?Color $color): selfSet the hint color.
withStyle(string $style): selfSet the hint style.
withIcon(string $icon): selfSet the icon prefix.

Level enum

Log levels for toast notifications.

Cases: Info · Warning · Error · Success

PHP also provides cases(), from() and tryFrom().

MethodSummary
icon(): stringGet the default icon for this level.
isError(): boolCheck if this level represents an error condition.
isHighlighted(): boolCheck if this level should be highlighted.

NoticePosition enum

Positioning options for toast notifications on screen.

Cases: TopLeft · TopCenter · TopRight · BottomLeft · BottomCenter · BottomRight · CenterLeft · CenterRight · Center · Anchor

PHP also provides cases(), from() and tryFrom().

MethodSummary
vertical(): stringGet the vertical alignment for this position.
horizontal(): stringGet the horizontal alignment for this position.
isCorner(): boolCheck if this is a corner position.
isCenter(): boolCheck if this is a center position.
isAnchor(): boolCheck if this is an anchor position (positioned relative to an element).
toToastPosition(): ToastPositionMap onto the sugar-toast ToastPosition used by the shared engine.

Notification final class

A single notification DTO held by NotificationQueue.

MethodSummary
__construct(public readonly string $message, public readonly Level $level = Level::Info, public readonly ?string $title = null)
static info(string $message, ?string $title = null): self
static warning(string $message, ?string $title = null): self
static error(string $message, ?string $title = null): self
static success(string $message, ?string $title = null): self

NotificationQueue final class

Dual-ring notification queue per Homedash pattern.

MethodSummary
__construct(int $maxItems = 20, int $maxHistory = 50)
static new(): self
push(Notification $notification): selfPush a notification onto the items ring.
dismiss(): selfDismiss the head of the items ring, moving it to history.
current(): ?NotificationReturn the head of the items ring, or null if empty.
recent(int $n): arrayReturn the last $n notifications from history, newest-first.
all(): arrayReturn all active items.
history(): arrayReturn all history items, oldest-first.
count(): intReturn the number of active items.
historyCount(): intReturn the number of history items.
isEmpty(): boolCheck if the items ring is empty.
hasHistory(): boolCheck if history has any entries.
withMaxItems(int $maxItems): selfNew instance carrying both rings under a different items cap.
withMaxHistory(int $maxHistory): selfNew instance carrying both rings under a different history cap.

Toast final class

A toast / notification component.

MethodSummary
__construct(private readonly string $message, private readonly ?string $title = null, private readonly ?Color $backgroundColor = null, private readonly ?Color $foregroundColor = null, private readonly ?Color $borderColor = null, private readonly string $icon = '', private readonly int $maxWidth = 60, private readonly ToastType $type = ToastType::Info)
static fromNotification(Notification $notification): selfBridge a Notification DTO into a styled Toast.
static fromQueue(NotificationQueue $queue): ?selfBridge a NotificationQueue, rendering its current head as a toast.
static typeForLevel(Level $level): ToastTypeMap a sugar-dashboard Level onto the sugar-toast ToastType.
static new(string $message): selfCreate a new toast with default styling.
static info(string $message): selfCreate an info-style toast.
static success(string $message): selfCreate a success-style toast.
static warning(string $message): selfCreate a warning-style toast.
static error(string $message): selfCreate an error-style toast.
setSize(int $width, int $height): \SugarCraft\Dashboard\Foundation\SizerSet the allocated dimensions for this toast.
render(): stringRender the toast as a string via the sugar-toast engine.
innerSize(): arrayCalculate the natural dimensions of this toast.
withMessage(string $message): selfSet the toast message.
withTitle(?string $title): selfSet the toast title.
withBackgroundColor(?Color $color): selfSet the background color.
withForegroundColor(?Color $color): selfSet the foreground (text) color.
withBorderColor(?Color $color): selfSet the border color.
withIcon(string $icon): selfSet the icon.
withMaxWidth(int $maxWidth): selfSet the maximum width.

Tooltip final class

A tooltip component.

MethodSummary
__construct(private readonly string $text, private readonly string $position = 'top', private readonly ?Color $backgroundColor = null, private readonly ?Color $foregroundColor = null, private readonly ?Color $borderColor = null)
static new(string $text): selfCreate a new tooltip with default styling.
static dark(string $text): selfCreate a tooltip with a dark background.
static info(string $text): selfCreate a tooltip with an info style.
static warning(string $text): selfCreate a tooltip with a warning style.
static danger(string $text): selfCreate a tooltip with a danger/error style.
setSize(int $width, int $height): \SugarCraft\Dashboard\Foundation\SizerSet the allocated dimensions for this tooltip.
render(): stringRender the tooltip as a string.
innerSize(): arrayCalculate the natural dimensions of this tooltip.
withText(string $text): selfSet the tooltip text.
withPosition(string $position): selfSet the position of the tooltip indicator.
withBackgroundColor(?Color $color): selfSet the background color.
withForegroundColor(?Color $color): selfSet the foreground (text) color.
withBorderColor(?Color $color): selfSet the border color.

SugarCraft\Dashboard\Components\Tree

ArrayTreeProvider final class

Basic tree data provider implementation.

MethodSummary
__construct(array $nodes, array $childrenMap, array $rootIds = [])
roots(): array
children(string $nodeId): array
node(string $nodeId): ?TreeNode
hasChildren(string $nodeId): bool
depth(string $nodeId): int
totalValue(): float

BranchPattern enum

Branch line patterns.

Cases: Solid · Dashed · Dotted · Double

PHP also provides cases(), from() and tryFrom().

BranchStyle final class

Style options for tree branches.

MethodSummary
__construct(public readonly ?Color $color = null, public readonly BranchPattern $pattern = BranchPattern::Solid, public readonly int $width = 1, public readonly bool $showArrow = true)
static solid(?Color $color = null): selfCreate a solid branch style.
static dashed(?Color $color = null): selfCreate a dashed branch style.
static dotted(?Color $color = null): selfCreate a dotted branch style.
static double(?Color $color = null): selfCreate a double-line branch style.
withColor(?Color $color): selfCreate a copy with a different color.
withPattern(BranchPattern $pattern): selfCreate a copy with a different pattern.
withWidth(int $width): selfCreate a copy with a different width.
withArrow(bool $showArrow): selfCreate a copy with or without arrow.
lineChar(): stringGet the line character(s) for this branch style.
getLineChar(): stringBC forwarder for the pre-rename accessor name.
connectorChar(): stringGet the connector character for this branch style.
getConnectorChar(): stringBC forwarder for the pre-rename accessor name.
endConnectorChar(): stringGet the end connector character for this branch style.
getEndConnectorChar(): stringBC forwarder for the pre-rename accessor name.

ClassDiagram final class

A UML class diagram component for visualizing class structures.

MethodSummary
__construct(private ?Color $classColor = null, private ?Color $interfaceColor = null, private ?Color $abstractColor = null, private ?Color $relationColor = null, private ?Color $textColor = null, private string $style_ = 'rounded')
static new(): selfCreate a new class diagram with default styling.
setSize(int $width, int $height): \SugarCraft\Dashboard\Foundation\SizerSet the allocated dimensions for this class diagram.
withClass(UMLClass $class): selfAdd a class to the diagram.
addClass(string $id, string $name, bool $isAbstract = false, bool $isInterface = false): selfAdd a class by parameters.
withClasses(array $classes): selfSet all classes at once.
withRelation(ClassRelation $relation): selfAdd a relation to the diagram.
withInheritance(string $child, string $parent): selfAdd an inheritance relation.
withRelations(array $relations): selfSet all relations at once.
withShowVisibility(bool $show): selfShow or hide visibility modifiers.
withShowTypes(bool $show): selfShow or hide type annotations.
withShowPackages(bool $show): selfShow or hide package names.
withStyle(string $style): selfSet the border style.
render(): stringRender the class diagram as a string.
innerSize(): arrayCalculate the natural dimensions of this class diagram.
withClassColor(?Color $color): selfSet the class color.
withInterfaceColor(?Color $color): selfSet the interface color.
withAbstractColor(?Color $color): selfSet the abstract class color.
withRelationColor(?Color $color): selfSet the relation color.
withTextColor(?Color $color): selfSet the text color.
withBorderStyle(string $style): selfSet the border style.

ClassMember final class

UML class member (attribute or method).

MethodSummary
__construct(public readonly Visibility $visibility, public readonly string $name, public readonly string $type = '', public readonly bool $isStatic = false, public readonly bool $isAbstract = false)
static public(string $name, string $type = ''): selfCreate a public member.
static private(string $name, string $type = ''): selfCreate a private member.
static protected(string $name, string $type = ''): selfCreate a protected member.
static static(self $member): selfCreate a static member.
render(): stringRender the member as a string.

ClassRelation final class

A relationship between classes.

MethodSummary
__construct(public readonly string $id, public readonly string $from, public readonly string $to, public readonly string $type = 'association', public readonly string $label = '', public readonly ?Color $color = null)
static association(string $from, string $to, string $label = ''): selfCreate an association relationship.
static inheritance(string $from, string $to): selfCreate an inheritance relationship.
static implementation(string $from, string $to): selfCreate an implementation relationship.
static aggregation(string $from, string $to, string $label = ''): selfCreate an aggregation relationship.
static composition(string $from, string $to, string $label = ''): selfCreate a composition relationship.
static dependency(string $from, string $to, string $label = ''): selfCreate a dependency relationship.

ConnectionStyle enum

Connection line styles for mind map branches.

Cases: Straight · Curved · Rounded

PHP also provides cases(), from() and tryFrom().

Dendrogram final class

A Dendrogram component for hierarchical clustering visualization.

MethodSummary
__construct(private ?Color $nodeColor = null, private ?Color $lineColor = null, private ?Color $textColor = null, private ?Color $leafColor = null)
static new(): selfCreate a new dendrogram with default styling.
static sample(): selfCreate a sample dendrogram for demonstration.
setSize(int $width, int $height): \SugarCraft\Dashboard\Foundation\SizerSet the allocated dimensions for this dendrogram.
withRoot(DendrogramNode $root): selfSet the root node.
withShowLabels(bool $show): selfShow or hide labels.
withShowValues(bool $show): selfShow or hide values.
withHorizontal(bool $horizontal): selfUse horizontal orientation.
withStyle(string $style): selfSet the border style.
withNodeSize(int $width, int $height): selfSet node dimensions.
render(): stringRender the dendrogram as a string.
innerSize(): arrayCalculate the natural dimensions of this dendrogram.
withNodeColor(?Color $color): selfSet the node color.
withLineColor(?Color $color): selfSet the line color.
withTextColor(?Color $color): selfSet the text color.
withLeafColor(?Color $color): selfSet the leaf color.

DendrogramNode final class

MethodSummary
__construct(public readonly string $id, public readonly string $label, public readonly float $value = 0.0, public readonly ?Color $color = null)
withChildren(array $children): self
withColor(?Color $color): self
totalValue(): float
getTotalValue(): floatBC forwarder for the pre-rename accessor name.
depth(): int
getDepth(): intBC forwarder for the pre-rename accessor name.

DrilldownTree final class

A drill-down tree view component.

MethodSummary
__construct(private ?Color $nodeColor = null, private ?Color $selectedColor = null, private ?Color $textColor = null, private ?Color $lineColor = null, private string $style = 'rounded')
static new(TreeNode $root): selfCreate a new drill-down tree with default styling.
setSize(int $width, int $height): \SugarCraft\Dashboard\Foundation\SizerSet the allocated dimensions for this drill-down tree.
withRoot(TreeNode $root): selfSet the root node.
withPath(string $path): selfSet the current drill-down path.
withShowValues(bool $show): selfShow or hide values.
withShowIcons(bool $show): selfShow or hide icons.
withExpanded(bool $expanded): selfSet expanded state.
withOnEnter(callable $onEnter): selfSet the onEnter lifecycle hook.
withOnExit(callable $onExit): selfSet the onExit lifecycle hook.
pushNode(string $nodeId): selfPush a node onto the navigation stack and call onEnter.
popNode(): selfPop a node from the navigation stack and call onExit.
navigationStack(): arrayGet the current navigation stack.
getNavigationStack(): arrayBC forwarder for the pre-rename accessor name.
breadcrumbItems(): arrayGet breadcrumb items from the navigation stack.
getBreadcrumbItems(): arrayBC forwarder for the pre-rename accessor name.
render(): stringRender the drill-down tree as a string.
innerSize(): arrayCalculate the natural dimensions of this drill-down tree.
withNodeColor(?Color $color): selfSet the node color.
withSelectedColor(?Color $color): selfSet the selected path color.
withTextColor(?Color $color): selfSet the text color.
withLineColor(?Color $color): selfSet the line color.
withStyle(string $style): selfSet the border style.

EdgeStyle enum

Cases: Solid · Dashed · Dotted · Double

PHP also provides cases(), from() and tryFrom().

Flowchart final class

A flowchart component for visualizing processes and decisions.

MethodSummary
__construct(private readonly ?int $maxNodes = null, private readonly ?Color $processColor = null, private readonly ?Color $decisionColor = null, private readonly ?Color $startEndColor = null, private readonly ?Color $ioColor = null, private readonly ?Color $arrowColor = null, private readonly ?Color $textColor = null, private readonly ?Color $backgroundColor = null, private readonly string $style = 'rounded')
static new(): selfCreate a new flowchart with default styling.
setSize(int $width, int $height): \SugarCraft\Dashboard\Foundation\SizerSet the allocated dimensions for this flowchart.
withNode(FlowchartNode $node): selfAdd a node to the flowchart.
addNode(string $id, string $label, FlowchartNodeType $type = FlowchartNodeType::Process): selfAdd a node by parameters.
withNodes(array $nodes): selfSet all nodes at once.
withConnection(string $fromId, string $toId): selfConnect two nodes.
withStartNode(string $nodeId): selfSet the start node ID.
withShowArrows(bool $show): selfShow or hide arrows.
withShowLabels(bool $show): selfShow or hide labels.
withFlowDirection(string $direction): selfSet the flow direction.
render(): stringRender the flowchart as a string.
innerSize(): arrayCalculate the natural dimensions of this flowchart.
withProcessColor(?Color $color): selfSet the process color.
withDecisionColor(?Color $color): selfSet the decision color.
withStartEndColor(?Color $color): selfSet the start/end color.
withIoColor(?Color $color): selfSet the I/O color.
withArrowColor(?Color $color): selfSet the arrow color.
withTextColor(?Color $color): selfSet the text color.
withBackgroundColor(?Color $color): selfSet the background color.
withStyle(string $style): selfSet the border style.

FlowchartNode final class

MethodSummary
__construct(public readonly string $id, public readonly string $label, public readonly FlowchartNodeType $type = FlowchartNodeType::Process, public readonly ?Color $color = null)
withNext(string $nextId): self
static process(string $id, string $label): self
static decision(string $id, string $label): self
static startEnd(string $id, string $label): self
static inputOutput(string $id, string $label): self

FlowchartNodeType enum

Cases: Process · Decision · StartEnd · InputOutput · Connector · Data

PHP also provides cases(), from() and tryFrom().

Gantt final class

A Gantt chart component for project scheduling visualization.

MethodSummary
__construct(private ?int $maxTasks = null, private ?Color $barColor = null, private ?Color $milestoneColor = null, private ?Color $gridColor = null, private ?Color $textColor = null, private ?Color $backgroundColor = null, private string $style = 'rounded')
static new(): selfCreate a new Gantt chart with default styling.
setSize(int $width, int $height): \SugarCraft\Dashboard\Foundation\SizerSet the allocated dimensions for this Gantt chart.
withTask(GanttTask $task): selfAdd a task to the chart.
addTask(string $name, int $startDay, int $duration, ?Color $color = null): selfAdd a task by parameters.
withTasks(array $tasks): selfSet all tasks at once.
withTimeRange(int $startDay, int $totalDays): selfSet the project time range.
withTimeScale(TimeScale $scale): selfSet the time scale.
withShowProgress(bool $show): selfShow or hide progress.
withShowToday(bool $show): selfShow or hide today marker.
render(): stringRender the Gantt chart as a string.
innerSize(): arrayCalculate the natural dimensions of this Gantt chart.
withBarColor(?Color $color): selfSet the bar color.
withMilestoneColor(?Color $color): selfSet the milestone color.
withGridColor(?Color $color): selfSet the grid color.
withTextColor(?Color $color): selfSet the text color.
withBackgroundColor(?Color $color): selfSet the background color.
withStyle(string $style): selfSet the border style.

GanttTask final class

A Gantt chart task with start time and duration.

MethodSummary
__construct(public readonly string $name, public readonly int $startDay, public readonly int $duration, public readonly ?Color $color = null, public readonly ?float $progress = null, public readonly bool $milestone = false)
withProgress(float $progress): selfCreate a copy with progress.
asMilestone(): selfCreate a milestone variant.

MindMap final class

A mind map component for hierarchical data visualization.

MethodSummary
__construct(private ?int $maxDepth = null, private MindMapDirection $direction = MindMapDirection::LeftRight, private ConnectionStyle $connectionStyle = ConnectionStyle::Rounded, private ?Color $rootColor = null, private ?Color $nodeColor = null, private ?Color $lineColor = null, private ?Color $textColor = null, private ?Color $backgroundColor = null, private string $style = 'rounded')
static new(): selfCreate a new mind map with default styling.
setSize(int $width, int $height): \SugarCraft\Dashboard\Foundation\SizerSet the allocated dimensions for this mind map.
withRoot(MindMapNode $root): selfSet the root node.
withRootText(string $text): selfSet the root node text.
withChild(string $text, ?Color $color = null, ?string $icon = null): selfAdd a child to the root node.
withCollapsed(bool $collapsed): selfSet collapsed state.
render(): stringRender the mind map as a string.
innerSize(): arrayCalculate the natural dimensions of this mind map.
withDirection(MindMapDirection $direction): selfSet the layout direction.
withConnectionStyle(ConnectionStyle $style): selfSet the connection style.
withRootColor(?Color $color): selfSet the root node color.
withNodeColor(?Color $color): selfSet the node color.
withLineColor(?Color $color): selfSet the line color.
withTextColor(?Color $color): selfSet the text color.
withBackgroundColor(?Color $color): selfSet the background color.
withStyle(string $style): selfSet the border style.

MindMapDirection enum

Layout direction for mind map branches.

Cases: LeftRight · RightLeft · TopBottom · BottomTop

PHP also provides cases(), from() and tryFrom().

MindMapNode final class

A mind map node with optional children.

MethodSummary
__construct(public readonly string $text, public readonly ?Color $color = null, public readonly ?string $icon = null)
withChild(MindMapNode $child): selfAdd a child node.
addChild(string $text, ?Color $color = null, ?string $icon = null): selfCreate a new child node and add it.

Network final class

A network diagram component for visualizing connected data.

MethodSummary
__construct(private ?int $maxNodes = null, private ?Color $nodeColor = null, private ?Color $edgeColor = null, private ?Color $labelColor = null, private ?Color $textColor = null, private ?Color $backgroundColor = null, private string $style = 'rounded')
static new(): selfCreate a new network diagram with default styling.
setSize(int $width, int $height): \SugarCraft\Dashboard\Foundation\SizerSet the allocated dimensions for this network diagram.
withNode(NetworkNode $node): selfAdd a node to the network.
addNode(string $id, string $label, NetworkShape $shape = NetworkShape::Circle): selfAdd a node by parameters.
withNodes(array $nodes): selfSet all nodes at once.
withEdge(array $edge): selfAdd an edge between nodes.
addEdge(string $from, string $to, ?string $label = null): selfAdd an edge by parameters.
withEdges(array $edges): selfSet all edges at once.
withShowLabels(bool $show): selfShow or hide node labels.
withShowWeights(bool $show): selfShow or hide edge weights.
withDirected(bool $directed): selfSet directed mode (arrowheads) or undirected.
withLayoutAlgorithm(string $algorithm): selfSet the layout algorithm.
render(): stringRender the network diagram as a string.
innerSize(): arrayCalculate the natural dimensions of this network diagram.
withNodeColor(?Color $color): selfSet the node color.
withEdgeColor(?Color $color): selfSet the edge color.
withLabelColor(?Color $color): selfSet the label color.
withTextColor(?Color $color): selfSet the text color.
withBackgroundColor(?Color $color): selfSet the background color.
withStyle(string $style): selfSet the border style.

NetworkNode final class

MethodSummary
__construct(public readonly string $id, public readonly string $label, public readonly NetworkShape $shape = NetworkShape::Circle, public readonly ?Color $color = null, public readonly ?string $icon = null)
withConnection(string $nodeId): self

NetworkShape enum

Cases: Circle · Square · Diamond · Hexagon · Star

PHP also provides cases(), from() and tryFrom().

OrgChart final class

An organizational chart component for hierarchy visualization.

MethodSummary
__construct(private ?int $maxDepth = null, private OrgChartStyle $style = OrgChartStyle::TopDown, private ?Color $rootColor = null, private ?Color $nodeColor = null, private ?Color $lineColor = null, private ?Color $textColor = null, private ?Color $backgroundColor = null, private string $borderStyle = 'rounded')
static new(): selfCreate a new org chart with default styling.
setSize(int $width, int $height): \SugarCraft\Dashboard\Foundation\SizerSet the allocated dimensions for this org chart.
withRoot(OrgChartNode $root): selfSet the root node.
withRootByName(string $name, ?string $title = null): selfSet the root node by name.
withReport(string $name, ?string $title = null, ?string $department = null, ?Color $color = null): selfAdd a direct report to the root.
withCollapsed(bool $collapsed): selfSet collapsed state.
render(): stringRender the org chart as a string.
innerSize(): arrayCalculate the natural dimensions of this org chart.
withStyle(OrgChartStyle $style): selfSet the layout style.
withRootColor(?Color $color): selfSet the root color.
withNodeColor(?Color $color): selfSet the node color.
withLineColor(?Color $color): selfSet the line color.
withTextColor(?Color $color): selfSet the text color.
withBackgroundColor(?Color $color): selfSet the background color.
withBorderStyle(string $style): selfSet the border style.

OrgChartNode final class

An organizational chart node with optional reports.

MethodSummary
__construct(public readonly string $name, public readonly ?string $title = null, public readonly ?string $department = null, public readonly ?Color $color = null, public readonly ?string $avatar = null)
withReport(OrgChartNode $report): selfAdd a direct report.
withReportByName(string $name, ?string $title = null, ?string $department = null): selfAdd a direct report by name.

OrgChartStyle enum

Organizational chart layout style.

Cases: TopDown · LeftRight · Tree

PHP also provides cases(), from() and tryFrom().

PERT final class

A PERT (Program Evaluation and Review Technique) chart component.

MethodSummary
__construct(private ?Color $nodeColor = null, private ?Color $arrowColor = null, private ?Color $textColor = null, private ?Color $criticalColor = null, private ?Color $pendingColor = null, private ?Color $inProgressColor = null, private ?Color $completedColor = null, private ?Color $delayedColor = null)
static new(): selfCreate a new PERT chart with default styling.
static sample(): selfCreate a sample PERT chart for demonstration.
setSize(int $width, int $height): \SugarCraft\Dashboard\Foundation\SizerSet the allocated dimensions for this PERT chart.
withTasks(array $tasks): selfSet all tasks at once.
withTask(PertTask $task): selfAdd a task.
addTask(string $id, string $name, int $duration, array $dependencies = []): selfAdd a task by parameters.
withShowDuration(bool $show): selfShow or hide duration.
withShowStatus(bool $show): selfShow or hide status.
withCriticalPath(bool $show): selfShow or hide critical path.
withShowGrid(bool $show): selfShow or hide grid.
withStyle(string $style): selfSet the border style.
render(): stringRender the PERT chart as a string.
innerSize(): arrayCalculate the natural dimensions of this PERT chart.
withNodeColor(?Color $color): selfSet the node color.
withArrowColor(?Color $color): selfSet the arrow color.
withTextColor(?Color $color): selfSet the text color.
withCriticalColor(?Color $color): selfSet the critical path color.

PertStatus enum

Status of a PERT task.

Cases: Pending · InProgress · Completed · Delayed

PHP also provides cases(), from() and tryFrom().

PertTask final class

A task node in a PERT chart.

MethodSummary
__construct(public readonly string $id, public readonly string $name, public readonly int $duration, public readonly ?Color $color = null, public PertStatus $status = PertStatus::Pending)
withDependencies(array $dependencies): selfCreate a copy with dependencies.
withColor(?Color $color): selfCreate a copy with a different color.
withStatus(PertStatus $status): selfCreate a copy with a different status.
withDuration(int $duration): selfCreate a copy with a different duration.

Sankey final class

A Sankey diagram component for flow visualization.

MethodSummary
__construct(private ?Color $nodeColor = null, private ?Color $flowColor = null, private ?Color $labelColor = null, private string $style = 'rounded')
static new(): selfCreate a new Sankey diagram with default styling.
setSize(int $width, int $height): \SugarCraft\Dashboard\Foundation\SizerSet the allocated dimensions for this Sankey diagram.
withNode(SankeyNode $node): selfAdd a node to the diagram.
addNode(string $id, string $label, float $value, ?Color $color = null): selfAdd a node by parameters.
withNodes(array $nodes): selfAdd all nodes at once.
withFlow(SankeyFlow $flow): selfAdd a flow to the diagram.
addFlow(string $source, string $target, float $value, ?Color $color = null): selfAdd a flow by parameters.
withFlows(array $flows): selfAdd all flows at once.
withHorizontal(bool $horizontal): selfSet horizontal or vertical layout.
withShowLabels(bool $show): selfShow or hide labels.
withShowValues(bool $show): selfShow or hide values.
render(): stringRender the Sankey diagram as a string.
innerSize(): arrayCalculate the natural dimensions of this Sankey diagram.
withNodeColor(?Color $color): selfSet the node color.
withFlowColor(?Color $color): selfSet the flow color.
withLabelColor(?Color $color): selfSet the label color.
withStyle(string $style): selfSet the border style.
withNodeWidth(int $width): selfSet the node width.
withNodeSpacing(int $spacing): selfSet the node spacing.

SankeyFlow final class

A flow connection between two nodes in a Sankey diagram.

MethodSummary
__construct(public readonly string $source, public readonly string $target, public readonly float $value, public readonly ?Color $color = null)
withColor(?Color $color): selfCreate a copy with a different color.

SankeyNode final class

A node in a Sankey diagram.

MethodSummary
__construct(public readonly string $id, public readonly string $label, public readonly float $value, public readonly ?Color $color = null)
withColor(?Color $color): selfCreate a copy with a different color.

StateMachine final class

A state machine diagram component for visualizing system states and transitions.

MethodSummary
__construct(private ?Color $stateColor = null, private ?Color $initialColor = null, private ?Color $finalColor = null, private ?Color $transitionColor = null, private ?Color $textColor = null, private string $style_ = 'rounded')
static new(): selfCreate a new state machine diagram with default styling.
setSize(int $width, int $height): SizerSet the allocated dimensions for this state diagram.
withState(StateNode $state): selfAdd a state to the diagram.
addState(string $id, string $label, bool $isInitial = false, bool $isFinal = false): selfAdd a state by parameters.
withStates(array $states): selfSet all states at once.
withTransition(StateTransition $transition): selfAdd a transition to the diagram.
addTransition(string $from, string $to, string $label): selfAdd a transition by parameters.
addGuard(string $from, string $to, string $condition): selfAdd a guard transition.
withTransitions(array $transitions): selfSet all transitions at once.
withInitialState(string $stateId): selfSet the initial state ID.
withShowActions(bool $show): selfShow or hide actions.
withShowLabels(bool $show): selfShow or hide labels.
withStyle(string $style): selfSet the border style.
render(): stringRender the state machine diagram as a string.
innerSize(): arrayCalculate the natural dimensions of this state diagram.
withStateColor(?Color $color): selfSet the state color.
withInitialColor(?Color $color): selfSet the initial state color.
withFinalColor(?Color $color): selfSet the final state color.
withTransitionColor(?Color $color): selfSet the transition color.
withTextColor(?Color $color): selfSet the text color.
withBorderStyle(string $style): selfSet the border style.

StateNode final class

A state in a state machine diagram.

MethodSummary
__construct(public readonly string $id, public readonly string $label, public readonly bool $isInitial = false, public readonly bool $isFinal = false, public readonly ?Color $color = null)
withEntry(string $action): selfAdd an entry action.
withExit(string $action): selfAdd an exit action.
withInternal(string $action): selfAdd an internal action.
static initial(string $id, string $label): selfCreate an initial state.
static final(string $id, string $label): selfCreate a final state.
static state(string $id, string $label): selfCreate a normal state.

StateTransition final class

A transition between states in a state machine diagram.

MethodSummary
__construct(public readonly string $id, public readonly string $from, public readonly string $to, public readonly string $label, public readonly TransitionType $type = TransitionType::Normal, public readonly ?Color $color = null)
static guard(string $id, string $from, string $to, string $label): selfCreate a guard transition (conditional).

Sunburst final class

A Sunburst chart component for radial hierarchical visualization.

MethodSummary
__construct(private ?Color $segmentColor = null, private ?Color $textColor = null, private ?Color $centerColor = null)
static new(): selfCreate a new Sunburst chart with default styling.
setSize(int $width, int $height): \SugarCraft\Dashboard\Foundation\SizerSet the allocated dimensions for this Sunburst chart.
withSegment(SunburstSegment $segment): selfAdd a segment to the chart.
addSegment(string $id, string $label, float $value, ?Color $color = null): selfAdd a segment by parameters.
withSegments(array $segments): selfSet all segments at once.
withCenterLabel(string $label): selfSet the center label.
withShowLabels(bool $show): selfShow or hide labels.
withShowValues(bool $show): selfShow or hide values.
withMaxDepth(int $depth): selfSet maximum nesting depth.
withStyle(string $style): selfSet the border style.
render(): stringRender the Sunburst chart as a string.
innerSize(): arrayCalculate the natural dimensions of this Sunburst chart.
withSegmentColor(?Color $color): selfSet the default segment color.
withTextColor(?Color $color): selfSet the text color.
withCenterColor(?Color $color): selfSet the center circle color.

SunburstSegment final class

A segment in a Sunburst chart.

MethodSummary
__construct(public readonly string $id, public readonly string $label, public readonly float $value, public readonly ?Color $color = null)
withChildren(array $children): selfCreate a copy with children.
withColor(?Color $color): selfCreate a copy with a different color.
totalValue(): floatCalculate total value including children.
getTotalValue(): floatBC forwarder for the pre-rename accessor name.

TimeScale enum

Gantt chart time scale.

Cases: Hours · Days · Weeks · Months

PHP also provides cases(), from() and tryFrom().

Timeline final class

A timeline component for displaying chronological events.

MethodSummary
__construct(private array $events, private string $lineStyle = 'solid', private HAlign $align = HAlign::Left, private bool $showDescriptions = true, private bool $showIcons = true, private bool $reverse = false)
static new(array $events): selfCreate a new timeline with the given events.
static mocha(array $events): selfCreate a timeline with default Catppuccin Mocha colors.
setSize(int $width, int $height): \SugarCraft\Dashboard\Foundation\SizerSet the allocated dimensions for this timeline.
innerSize(): arrayCalculate the natural dimensions of this timeline.
render(): stringRender the timeline.
withLineStyle(string $style): selfSet the line style.
withAlign(HAlign $align): selfSet the alignment.
withShowDescriptions(bool $show): selfShow or hide descriptions.
withShowIcons(bool $show): selfShow or hide icons.
withReverse(bool $reverse): selfReverse the timeline order.

TimelineEvent final readonly class

An event in a timeline.

MethodSummary
__construct(public string $time, public string $title, public ?string $description = null, public string $type = 'default')

TimelineNode final readonly class

A node in a timeline.

MethodSummary
__construct(public string $label, public ?string $description = null)
static new(string $label, ?string $description = null): selfCreate a new timeline node.
static withMultiLineDescription(string $label, array $descriptionLines): selfCreate a node with a multiline description.

TimelineViz final class

A timeline visualization component for displaying events chronologically.

MethodSummary
__construct(private array $events = [], private bool $showMarkers = true, private bool $showDescriptions = true, private ?Color $lineColor = null, private ?Color $markerColor = null, private ?Color $textColor = null, private string $orientation = 'vertical')
static new(array $events = []): selfCreate a new timeline visualization.
static sample(): selfCreate a sample timeline for demonstration.
setSize(int $width, int $height): \SugarCraft\Dashboard\Foundation\SizerSet the allocated dimensions for this timeline.
render(): stringRender the timeline.
innerSize(): arrayCalculate the natural dimensions of this timeline.
withEvents(array $events): selfSet the events.
withShowMarkers(bool $show): selfShow or hide markers.
withShowDescriptions(bool $show): selfShow or hide descriptions.
withLineColor(?Color $color): selfSet the line color.
withMarkerColor(?Color $color): selfSet the marker color.

TransitionType enum

State machine transition types.

Cases: Normal · Guard · Internal

PHP also provides cases(), from() and tryFrom().

Tree final class

A hierarchical tree view component.

MethodSummary
__construct(private readonly array $nodes, private readonly bool $showLines = true, private readonly ?Color $nodeColor = null, private readonly ?Color $collapsedColor = null, private readonly string $branchChar = '├──', private readonly string $endChar = '└──', private readonly string $verticalChar = '│ ', private readonly string $spaceChar = ' ')
static new(array $nodes): selfCreate a new tree with default styling.
setSize(int $width, int $height): \SugarCraft\Dashboard\Foundation\SizerSet the allocated dimensions for this tree.
render(): stringRender the tree component.
innerSize(): arrayCalculate the natural dimensions of this tree.
withShowLines(bool $show): selfToggle line display.
withNodeColor(?Color $color): selfSet the color for expanded nodes.
withCollapsedColor(?Color $color): selfSet the color for collapsed nodes.
withBranchChars(string $branch, string $end): selfSet custom branch characters.
withNodeCollapsed(string $key, bool $collapsed): selfToggle a node's collapsed state.

TreeNode final class

A node in the tree structure.

MethodSummary
__construct(public readonly string $id = '', public readonly string $label = '', public readonly float $value = 0.0, public readonly bool $collapsed = false, public readonly array $children = [])
static new(string $label): selfCreate a new tree node with just a label.
static withId(string $id, string $label): selfCreate a new tree node with id and label.
static collapsed(string $label): selfCreate a collapsed tree node.
withChildren(array $children): selfCreate a node with children.
withCollapsed(bool $collapsed): selfSet the collapsed state.

TreeProvider interface

Interface for tree data providers.

MethodSummary
roots(): arrayGet the root node(s) of the tree.
children(string $nodeId): arrayGet children of a specific node.
node(string $nodeId): ?TreeNodeGet a node by its ID.
hasChildren(string $nodeId): boolCheck if a node has children.
depth(string $nodeId): intGet the depth of a node in the tree.
totalValue(): floatGet total value of all nodes (for proportional sizing).

TreeViz final class

A tree visualization component for displaying hierarchical data.

MethodSummary
__construct(private readonly array $nodes = [], private readonly bool $showLines = true, private readonly bool $showLabels = true, private readonly ?Color $nodeColor = null, private readonly ?Color $lineColor = null, private readonly ?Color $labelColor = null, private readonly string $orientation = 'top-down')
static new(array $nodes = []): selfCreate a new tree visualization.
static sample(): selfCreate a sample tree for demonstration.
setSize(int $width, int $height): \SugarCraft\Dashboard\Foundation\SizerSet the allocated dimensions for this tree.
render(): stringRender the tree.
innerSize(): arrayCalculate the natural dimensions of this tree.
withNodes(array $nodes): selfSet the nodes.
withShowLines(bool $show): selfShow or hide connection lines.
withShowLabels(bool $show): selfShow or hide labels.
withOrientation(string $orientation): selfSet the orientation.

TreeVizNode final readonly class

A node in a tree visualization.

MethodSummary
__construct(public string $label, public string $type = 'leaf', public array $children = [])
withChildren(array $children): selfCreate a copy with children.

Treemap final class

A treemap visualization component.

MethodSummary
__construct(private ?Color $borderColor = null, private ?Color $textColor = null, private ?Color $valueColor = null)
static new(array $leaves = []): selfCreate a new treemap with default styling.
static sample(int $count = 8): selfCreate a sample treemap for demonstration.
setSize(int $width, int $height): \SugarCraft\Dashboard\Foundation\SizerSet the allocated dimensions for this treemap.
withLeaves(array $leaves): selfSet all leaves at once.
withLeaf(TreemapLeaf $leaf): selfAdd a leaf to the treemap.
addLeaf(string $id, string $label, float $value, ?Color $color = null): selfAdd a leaf by parameters.
withShowLabels(bool $show): selfShow or hide labels.
withShowValues(bool $show): selfShow or hide values.
withShowBorders(bool $show): selfShow or hide borders.
withBorderStyle(string $style): selfSet the border style.
innerSize(): arrayCalculate the natural dimensions of this treemap.
render(): stringRender the treemap as a string.
withBorderColor(?Color $color): selfSet the border color.
withTextColor(?Color $color): selfSet the text color.
withValueColor(?Color $color): selfSet the value color.

TreemapLeaf final class

MethodSummary
__construct(public readonly string $id, public readonly string $label, public readonly float $value, public readonly ?Color $color = null, public readonly array $children = [])
withColor(?Color $color): self
withChildren(array $children): self

UMLClass final class

A UML class in a class diagram.

MethodSummary
__construct(public readonly string $id, public readonly string $name, public readonly ?string $package = null, public readonly bool $isAbstract = false, public readonly bool $isInterface = false, public readonly ?Color $color = null)
withAttribute(ClassMember $attribute): selfAdd an attribute.
withMethod(ClassMember $method): selfAdd a method.
withTemplateParam(string $param): selfAdd a template parameter.
attributes(): arrayGet all attributes.
getAttributes(): arrayBC forwarder for the pre-rename accessor name.
methods(): arrayGet all methods.
getMethods(): arrayBC forwarder for the pre-rename accessor name.
templateParams(): arrayGet all template parameters.
getTemplateParams(): arrayBC forwarder for the pre-rename accessor name.

Visibility enum

Visibility modifier for class members.

Cases: Public · Private · Protected · Package

PHP also provides cases(), from() and tryFrom().

SugarCraft\Dashboard\Foundation

Buffer final class

Sugar-dash immutable ANSI renderer Buffer (Sizer/Drawable pattern). Intentionally distinct from \SugarCraft\Vterm\Buffer\Buffer, which is a mutable VT-output grid (resize/cell/put/each). Different role: this composes layout output for inline-termui; the VT version stores terminal state during emulation.

MethodSummary
__construct(int $width, int $height)
static new(int $width, int $height): selfCreate a new buffer with the given dimensions.
cell(int $x, int $y): CellGet the Cell at the given coordinates.
getCell(int $x, int $y): CellBC forwarder for the pre-rename accessor name.
setCell(int $x, int $y, Cell $cell): selfSet a cell at the given coordinates (wither).
fill(Rect $rect, Cell $cell): selfFill a rectangular region with a cell (wither).
setString(int $x, int $y, string $str, ?Style $style = null): selfSet a string starting at the given coordinates (wither).
setRect(Rect $rect): selfSet the rectangle this buffer should fill (from Drawable).
rect(): RectGet the rectangle this buffer occupies (from Drawable).
draw(Buffer $buffer): voidDraw this buffer's content into the target buffer (from Drawable).
render(): stringRender the buffer as an ANSI string.
innerSize(): arrayGet the inner dimensions of this buffer.
clear(): selfClear the buffer (wither).
setSize(int $width, int $height): SizerSet the allocated dimensions for this buffer.
withTheme(Theme $theme): selfBuffers are passive drawing surfaces — theme application is a pass-through.

Cell final readonly class

Sugar-dash Cell holds (rune, Style) for the inline-termui renderer. Intentionally distinct from \SugarCraft\Vterm\Cell\Cell, which holds (grapheme, Sgr, continuation, hyperlink) for VT emulation. Both are canonical for their lib.

MethodSummary
__construct(public string $rune, public Style $style)

ColorMode final class

Process-wide color capability for every renderer in this library.

MethodSummary
static use(?ColorProfile $profile): voidPin the capability explicitly; pass null to fall back to the chain.
static profile(): ColorProfile
static resetForTesting(): voidDrop the memo and the override so the next read re-snapshots the environment. Test-only seam.

Drawable interface

Anything that can be drawn into a Buffer at a specific Rect.

MethodSummary
rect(): RectGet the rectangle this drawable occupies.
setRect(Rect $rect): selfSet the rectangle this drawable should fill.
withTheme(Theme $theme): selfApply a theme to this drawable, returning a new instance with the theme's colors. Default implementation returns $this (no-op) so existing drawables continue to work unchanged.
draw(Buffer $buffer): voidDraw the content into the provided buffer.

EdgeStyle enum

Cases: Solid · Dashed · Dotted · Bold

PHP also provides cases(), from() and tryFrom().

EnumCoerce final class

One implementation of the accept-both rule for knobs converging from a stringly vocabulary onto the enum that already models it (D-147).

MethodSummary
static from(\BackedEnum|string $value, string $enumClass, string $knobName): \BackedEnumCoerce a legacy string or pass through the enum case for $knobName.

GradientStore final class

Named 101-entry color ramps (index = percent), the registry a themed system monitor reads on every meter / graph cell — at('cpu', 73) is btop's Theme::g("cpu")[73].

MethodSummary
static new(): self
static fromStops(array $colors): selfBuild from btop-style flat keys: every <name>_start entry yields a gradient <name> using <name>_mid / <name>_end when present. Keys without the _start suffix are ignored, as in generateGradients.
static ramp(Color $start, ?Color $mid = null, ?Color $end = null): arrayExpand start / mid / end into btop's 101-entry ramp (memoized).
withGradient(string $name, Color $start, ?Color $mid = null, ?Color $end = null): selfRegister (or replace) gradient $name. This is also how a consumer injects btop's pseudo-gradients, e.g. proc = main_fg → inactive_fg and proc_color = inactive_fg → process_start.
at(string $name, int $percent): ColorColor at $percent of gradient $name; percent is clamped to 0..100.
gradient(string $name): arrayThe full 101-entry ramp for $name.
has(string $name): bool
names(): array

Item interface

Anything that can be placed in a StackedGrid and rendered as a string.

MethodSummary
render(): stringRender the item to a string.

Measurable interface

A box whose natural (chrome-inclusive) extent can be measured without first being allocated.

MethodSummary
naturalExtent(int $width): arrayChrome-inclusive natural size.

NetAutoScale final class

btop's network-graph auto-scaling: a per-direction ceiling that only moves after a sustained run of samples above it (grow) or far below it (shrink), so a single spike or lull never makes the graph jump.

MethodSummary
static new(bool $sync = false): selfFresh scaler. Like btop's Net::rescale{true}, the first offer always rescales, so the ceilings start at the first sample rather than 0.
withSync(bool $sync): selfToggle btop's net_sync (shared download/upload ceiling).
offer(int $download, int $upload): selfFeed one collect tick (bytes/sec per direction) and return the next state.
forceRescale(?array $downloadHistory = null, ?array $uploadHistory = null): selfArm a rescale for the next offer() — btop's interface-change / loss path (and Net::rescale = true after a config change). Counters reset. Pass the newly selected interface's recent samples (oldest first) to swap the averaging window, since btop averages the NEW interface's bandwidth deque. These are the samples from BEFORE the coming tick: the next offer() appends its own sample, so do not include it here or it is counted twice.
rescaleNow(?array $downloadHistory = null, ?array $uploadHistory = null): selfRescale NOW from the held samples, without offering a new one — btop's Runner::run("net", no_update = true) after b/n/a/y, where Net::collect skips the counter pass but still runs the rescale pass with rescale = true, so the graph is redrawn against the new ceiling in the same frame instead of one tick later.
downloadMax(): intCurrent download ceiling in bytes/sec (0 until the first offer).
uploadMax(): intCurrent upload ceiling in bytes/sec (0 until the first offer).
maxFor(string $direction): intCeiling for one direction.
counters(string $direction): arrayThe [fast, slow] hysteresis counters for one direction.
rescalePending(): boolWhether a rescale is armed for the next offer.

Rect final readonly class

Sugar-dash Rect uses the charmbracelet/rectmath bounds model (minX, minY, maxX, maxY). Intentionally distinct from \SugarCraft\Core\Rect, which uses the ratatui offset+size model (x, y, width, height). Both are canonical for their lib — choose by which upstream semantics the consumer needs.

MethodSummary
__construct(public int $minX, public int $minY, public int $maxX, public int $maxY)
contains(int $x, int $y): boolCheck if a point is inside the rectangle (inclusive).
intersect(self $other): ?selfCompute the intersection of two rectangles, or null if no overlap.
dx(): intWidth of the rectangle (maxX - minX + 1).
dy(): intHeight of the rectangle (maxY - minY + 1).

Segment final class

A 7-segment display component.

MethodSummary
__construct(private readonly string $content, private readonly int $digitWidth = 3, private readonly bool $showColon = true, private readonly ?Color $onColor = null, private readonly ?Color $offColor = null)
static new(string $content): selfCreate a new 7-segment display with default styling.
setSize(int $width, int $height): \SugarCraft\Dashboard\Foundation\SizerSet the allocated dimensions for this display.
render(): stringRender the 7-segment display.
innerSize(): arrayCalculate the natural dimensions of this display.
withDigitWidth(int $width): selfSet the digit width (horizontal size of each digit).
withShowColon(bool $show): selfShow or hide the colon separator.
withOnColor(?Color $color): selfSet the "on" (lit) segment color.
withOffColor(?Color $color): selfSet the "off" (unlit) segment color.
withContent(string $content): selfSet new content.

SizedItem interface

A Sizer that can also report its intrinsic (unconstrained) size.

MethodSummary
innerSize(): arrayIntrinsic size of the item as currently configured: [width, height] in terminal cells. Zeroes mean "measure me by rendering".
setSize(int $width, int $height): SizerSet the allocated dimensions for this item.
render(): stringRender the item to a string.

Sizer interface

An Item that knows its own dimensions.

MethodSummary
setSize(int $width, int $height): SizerSet the allocated dimensions for this item.
render(): stringRender the item to a string.

Style final readonly class

Sugar-dash inline-termui Style. Intentionally distinct from \SugarCraft\Style\Style — this carries the inline-termui layout-engine semantics (toAnsi(ColorProfile), inline foreground/ background slots) while Sprinkles\Style carries the lipgloss padding/margin/borders semantics. Both are canonical for their lib — do NOT alias one to the other.

MethodSummary
__construct(public ?Color $foreground = null, public ?Color $background = null, public bool $bold = false, public bool $dim = false, public bool $italic = false, public bool $underline = false, public bool $reverse = false, public bool $strike = false)
toAnsi(?ColorProfile $profile = null): stringRender this style as ANSI SGR sequences.
withForeground(Color $color): selfApply this style's attributes to a foreground Color.
withBackground(Color $color): selfApply this style's attributes to a background Color.
withBold(bool $value = true): selfAdd bold modifier.

StyleParser final class

Parses termui-style inline style strings into Cell arrays.

MethodSummary
static parse(string $input, Style $defaultStyle): arrayParse a styled string into a list of Cells.

Theme final class

Sugar-dash inline-termui Theme (9 colour slots + name, accessors, color()/fg()/bg() helpers, and one wither per slot). Foundation layer: it depends on nothing in this library above Foundation — widgets that want themed styling are built by their own layers (see Bar::themed()), never by a factory here (finding 138). Intentionally distinct from \SugarCraft\Style\Theme (13 colour slots: adds muted, info, border, separator, cursor; readonly properties only, no helper methods). Both are canonical for their lib.

MethodSummary
__construct(private readonly string $name, private readonly Color $foreground, private readonly Color $background, private readonly Color $primary, private readonly Color $secondary, private readonly Color $accent, private readonly Color $error, private readonly Color $warning, private readonly Color $success, private readonly Color $highlight)
static dark(): selfCreate the default dark theme (Tokyo Night inspired).
static dracula(): selfCreate the Dracula theme.
static oneDark(): selfCreate the One Dark theme.
static githubDark(): selfCreate the GitHub Dark theme.
static light(): selfCreate a light theme.
name(): stringGet the theme name.
getName(): stringBC forwarder for the pre-rename accessor name.
foreground(): ColorGet the foreground color.
background(): ColorGet the background color.
primary(): ColorGet the primary color.
secondary(): ColorGet the secondary color.
accent(): ColorGet the accent color.
error(): ColorGet the error color.
warning(): ColorGet the warning color.
success(): ColorGet the success color.
highlight(): ColorGet the highlight color.
color(string $name): ?ColorGet a color by name.
fg(?ColorProfile $profile = null): stringGet the ANSI escape sequence for the foreground color.
bg(?ColorProfile $profile = null): stringGet the ANSI escape sequence for the background color.
withName(string $name): selfCreate a new theme with a different name.
withForeground(Color $color): selfCreate a new theme with different foreground color.
withBackground(Color $color): selfCreate a new theme with different background color.
withPrimary(Color $color): selfCreate a new theme with different primary color.
withSecondary(Color $color): selfCreate a new theme with different secondary color.
withAccent(Color $color): selfCreate a new theme with different accent color.
withError(Color $color): selfCreate a new theme with different error color.
withWarning(Color $color): selfCreate a new theme with different warning color.
withSuccess(Color $color): selfCreate a new theme with different success color.
withHighlight(Color $color): selfCreate a new theme with different highlight color.

Threshold final class

Maps a numeric value (typically a 0..1 ratio) to a Color via ordered stops — the "green below 60%, yellow below 80%, red above" pattern that gauges, meters, and status indicators reinvent everywhere.

MethodSummary
static of(array $stops): selfBuild from [limit, Color] pairs in any order; they are sorted ascending by limit.
static health(?Color $ok = null, ?Color $warn = null, ?Color $critical = null): selfThe canonical health ramp: green for < 0.6, yellow for < 0.8, red at or above 0.8. Colors are overridable for theming.
colorFor(float $value): ColorResolve the color for a value.
stops(): array

SugarCraft\Dashboard\Keys

Category enum

Category constants for key bindings.

Cases: Navigation · Editing · View · General · Debug

PHP also provides cases(), from() and tryFrom().

MethodSummary
label(): stringGet the display label for this category.

Key final class

Represents a keyboard key combination.

MethodSummary
__construct(public readonly string $key, public readonly bool $ctrl = false, public readonly bool $alt = false, public readonly bool $shift = false)
withCtrl(): selfCreate a key with Ctrl modifier.
withAlt(): selfCreate a key with Alt modifier.
withShift(): selfCreate a key with Shift modifier.
toString(): stringGet the normalized key string representation.
matches(string $key, bool $ctrl = false, bool $alt = false, bool $shift = false): boolCheck if this key matches a given key string and modifiers.

KeyAction final class

Represents an action triggered by a key combination.

MethodSummary
__construct(public readonly string $name, public readonly mixed $execute)
execute(Key $key): \SugarCraft\Dashboard\Foundation\ItemExecute the action with the given key.

KeyIdentifier final class

Unique identifier for a key binding.

MethodSummary
__construct(public readonly string $value)
static of(string $value): selfCreate from a string.
static quit(): selfCreate the standard identifiers.
static help(): self
static refresh(): self
static focusNext(): self
static focusPrev(): self

KeyMap final class

Keyboard shortcut handler.

MethodSummary
__construct(private readonly \SugarCraft\Dashboard\Foundation\Item $content)
static new(\SugarCraft\Dashboard\Foundation\Item $content): selfCreate a new keymap with default styling.
render(): stringRender the content managed by this keymap.
setSize(int $width, int $height): \SugarCraft\Dashboard\Foundation\SizerSet the allocated dimensions for this keymap.
innerSize(): arrayGet the dimensions of the managed content.
on(string $key, callable $action, bool $ctrl = false, bool $alt = false, bool $shift = false): selfRegister an action for a key combination.
onAny(callable $action): selfRegister a global action that fires on any key.
off(string $key, bool $ctrl = false, bool $alt = false, bool $shift = false): selfRemove an action by key combination.
handle(Key $key): arrayHandle a key event and return the new state.
has(string $key, bool $ctrl = false, bool $alt = false, bool $shift = false): boolCheck if a key combination is registered.
registeredKeys(): arrayGet all registered key combinations.
getRegisteredKeys(): arrayBC forwarder for the pre-rename accessor name.
hasGlobalActions(): boolCheck if any global actions are registered.
withContent(\SugarCraft\Dashboard\Foundation\Item $content): selfSet new content.
withAction(string $key, callable $action): selfCreate a new KeyMap with an action registered for a simple key.

KeyMeta final class

Metadata for a key binding.

MethodSummary
__construct(public readonly KeyIdentifier $id, public readonly Key $key, public readonly string $description, public readonly string $category = 'general')
display(): stringGet the display string for this binding.
fullDescription(): stringGet the full description with category.

KeyRegistry final class

Central registry for key bindings.

MethodSummary
static register(KeyIdentifier $id, Key $key, string $description, string $category = 'general'): voidRegister a key binding.
static get(KeyIdentifier|string $id): ?KeyMetaGet a binding by ID.
static byCategory(string $category): arrayGet all bindings for a category.
static categories(): arrayGet all registered categories.
static match(Key $key): ?KeyMetaCheck if a key matches any registered binding.
static reset(): voidReset the registry (useful for testing).

SugarCraft\Dashboard\Layout

AlignItems enum

Align items enum for FlexLayout.

Cases: Start · End · FlexStart · FlexEnd · Center · Stretch · Baseline

PHP also provides cases(), from() and tryFrom().

Breakpoint final class

Static helpers for responsive layout breakpoints.

MethodSummary
static narrow(int $width, int $threshold = 90): boolTrue when the terminal width is considered narrow.
static medium(int $width, int $narrow = 90, int $wide = 140): boolTrue when the terminal width is in the "medium" range.
static wide(int $width, int $threshold = 140): boolTrue when the terminal width is considered wide.
static pick(int $width, array $thresholds): stringPick a bucket name from a thresholds map based on current width.

Center final class

A centered content layout component.

MethodSummary
__construct(private readonly \SugarCraft\Dashboard\Foundation\Item $content, private readonly int $minWidth = 0, private readonly int $minHeight = 0)
static new(\SugarCraft\Dashboard\Foundation\Item $content): selfCreate a new centered layout with the given content.
static withMin(\SugarCraft\Dashboard\Foundation\Item $content, int $minWidth, int $minHeight): selfCreate a new centered layout with minimum dimensions.
setSize(int $width, int $height): \SugarCraft\Dashboard\Foundation\SizerSet the allocated dimensions for this center layout.
render(): stringRender the centered content.
innerSize(): arrayCalculate the natural dimensions of this layout.
withMinWidth(int $minWidth): selfSet the minimum width.
withMinHeight(int $minHeight): selfSet the minimum height.
withContent(\SugarCraft\Dashboard\Foundation\Item $content): selfSet the content.

FlexDirection enum

Flex direction enum for FlexLayout.

Cases: Row · Column · RowReverse · ColumnReverse

PHP also provides cases(), from() and tryFrom().

FlexLayout final class

A flexbox-style layout component.

MethodSummary
__construct(private readonly array $items = [], private readonly FlexDirection $direction = FlexDirection::Row, private readonly FlexWrap $wrap = FlexWrap::NoWrap, private readonly JustifyContent $justify = JustifyContent::Start, private readonly AlignItems $alignItems = AlignItems::Start, private readonly int $gap = 0)
static row(array $items = []): selfCreate a new flex layout with row direction.
static column(array $items = []): selfCreate a new flex layout with column direction.
setSize(int $width, int $height): \SugarCraft\Dashboard\Foundation\SizerSet the allocated dimensions for this flex layout.
render(): stringRender the flex layout.
innerSize(): arrayCalculate the natural dimensions of this layout.
withItem(\SugarCraft\Dashboard\Foundation\Item $item): selfAdd an item to the flex layout.
withDirection(FlexDirection $direction): selfSet the flex direction.
withWrap(FlexWrap $wrap): selfSet the flex wrap mode.
withJustify(JustifyContent $justify): selfSet the justify content property.
withAlignItems(AlignItems $alignItems): selfSet the align items property.
withGap(int $gap): selfSet the gap between items.
withTheme(Theme $theme): selfApply a theme, fanning it down to any theme-aware children.

FlexWrap enum

Flex wrap enum for FlexLayout.

Cases: NoWrap · Wrap · WrapReverse

PHP also provides cases(), from() and tryFrom().

FocusManager final class

Manages focus state for a layout hierarchy.

MethodSummary
__construct(private readonly string $rootId = 'root')
focus(string|int $id): selfMove focus to a REGISTERED panel.
blur(string $id): selfDrop the focused flag for a REGISTERED panel.
isFocused(string $id): bool
focusedId(): ?string
getFocusedId(): ?stringBC forwarder for the pre-rename accessor name.
focusNext(): self
focusPrevious(): self
register(string|int $id): self
unregister(string|int $id): self
persistState(Persistence $persistence, string $path): voidSave focus state to disk via the persistence layer.
restoreState(Persistence $persistence, string $path): selfRestore focus state from disk.
restoreNotice(): ?stringWhy the last restoreState() skipped or repaired something, or null if the last restore was clean. The reason is surfaced, not swallowed — the chrome or log line that shows it is the consumer's call.

Frame final class

A bordered frame that wraps any Item.

MethodSummary
__construct(private readonly \SugarCraft\Dashboard\Foundation\Item $content, private readonly ?Border $border = null, private readonly ?Color $borderColor = null, private readonly array $padding = [1, 1, 1, 1], private readonly ?string $title = null, private readonly VAlign $verticalAlign = VAlign::Top)
static new(\SugarCraft\Dashboard\Foundation\Item $content): selfCreate a frame with the default rounded border and purple accent.
setSize(int $width, int $height): \SugarCraft\Dashboard\Foundation\SizerSet the allocated dimensions for this frame.
render(): stringRender the frame with its content.
innerSize(): arrayCalculate the inner area available for content after borders are subtracted (before padding).
naturalExtent(int $width): arrayChrome-inclusive natural extent (Measurable, finding 032): the two border rows/columns plus the padding ring on top of whatever the content wants. Content is measured at its own natural render — allocation-free, so this never bounces off the raw-passthrough legs.
withBorder(Border $border): self
withBorderColor(Color $color): self
withPadding(int $n): self
withPaddingXY(int $vertical, int $horizontal): self
withTitle(string $title): self
withVerticalAlign(VAlign $align): self
withTheme(Theme $theme): selfApply a theme, fanning it down to any theme-aware children.

GridItem final class

Represents an item positioned in a GridLayout.

MethodSummary
__construct(public readonly \SugarCraft\Dashboard\Foundation\Item $content, public readonly int $column = 0, public readonly int $row = 0, public readonly int $columnSpan = 1, public readonly int $rowSpan = 1)

GridLayout final class

A CSS Grid-style layout component.

MethodSummary
__construct(private readonly array $items = [], int $columns = 1, int $rows = 0, int $columnGap = 0, int $rowGap = 0)GridLayout walks the plain array positionally — the GridItem wrapper class is never read here. Every element is used as a bare Item (render(), setSize()/innerSize() behind instanceof guards).
static columns(int $columns, array $items = []): selfCreate a new grid layout with the specified columns.
static rows(int $rows, array $items = []): selfCreate a new grid layout with fixed rows.
setSize(int $width, int $height): \SugarCraft\Dashboard\Foundation\SizerSet the allocated dimensions for this grid layout.
render(): stringRender the grid layout.
innerSize(): arrayCalculate the natural dimensions of this layout.
withItem(\SugarCraft\Dashboard\Foundation\Item $item): selfAdd an item to the grid layout.
withItems(array $items): selfSet the items in this grid layout.
withColumns(int $columns): selfSet the number of columns.
withRows(int $rows): selfSet the number of rows.
withColumnGap(int $gap): selfSet the column gap.
withRowGap(int $gap): selfSet the row gap.
withGap(int $gap): selfSet both column and row gaps.
withTheme(Theme $theme): selfApply a theme, fanning it down to any theme-aware children.

HAlign enum

Horizontal text alignment enum.

Cases: Left · Right · Center

PHP also provides cases(), from() and tryFrom().

HStack final class

A horizontal stack layout component.

MethodSummary
__construct(private readonly array $items = [], private readonly int $spacing = 0, private readonly HAlign $alignment = HAlign::Left)
static new(\SugarCraft\Dashboard\Foundation\Item ...$items): selfCreate a new horizontal stack with default styling.
static spaced(int $spacing, \SugarCraft\Dashboard\Foundation\Item ...$items): selfCreate a horizontal stack with spacing between items.
static centered(\SugarCraft\Dashboard\Foundation\Item ...$items): selfCreate a horizontally centered stack.
setSize(int $width, int $height): \SugarCraft\Dashboard\Foundation\SizerSet the allocated dimensions for this stack.
render(): stringRender the stack as a single line string.
innerSize(): arrayCalculate the natural dimensions of this stack.
withItems(array $items): selfSet the items in this stack.
withAppended(\SugarCraft\Dashboard\Foundation\Item $item): selfAdd an item to the end of the stack.
withPrepended(\SugarCraft\Dashboard\Foundation\Item $item): selfAdd an item to the beginning of the stack.
withSpacing(int $spacing): selfSet the spacing between items.
withAlignment(HAlign $alignment): selfSet the horizontal alignment.
withTheme(Theme $theme): selfApply a theme, fanning it down to any theme-aware children.

JustifyContent enum

Justify content enum for FlexLayout.

Cases: Start · End · FlexStart · FlexEnd · Center · SpaceBetween · SpaceAround · SpaceEvenly

PHP also provides cases(), from() and tryFrom().

Layout final class

Advanced layout algorithm for arranging multiple items.

MethodSummary
__construct(private readonly array $children, private readonly LayoutDirection $direction = LayoutDirection::Horizontal, private readonly int $gap = 0, private readonly HAlign $horizontalAlign = HAlign::Left, private readonly VAlign $verticalAlign = VAlign::Top, private readonly ?int $width = null, private readonly ?int $height = null)
static horizontal(array $children = []): selfCreate a new horizontal layout.
static vertical(array $children = []): selfCreate a new vertical layout.
setSize(int $width, int $height): \SugarCraft\Dashboard\Foundation\SizerSet the allocated dimensions for this layout.
render(): stringRender the layout and all children.
static clipToHeight(string $block, int $height): stringShared height discipline for render exits (finding sugar-dashboard-030): a box that was given a real allocation prints exactly that many rows. Content taller than the frame clips here - once, at the exit - instead of stranding rows past the bottom of the frame (and past the bottom of the terminal, when the box is the screen itself). A zero or unset allocation is a pass-through: unallocated boxes answer with their natural height, never a clipped one.
innerSize(): arrayCalculate the natural dimensions of this layout.
withGap(int $gap): selfSet the gap between children.
withHorizontalAlign(HAlign $align): selfSet the horizontal alignment.
withVerticalAlign(VAlign $align): selfSet the vertical alignment.
withDirection(LayoutDirection $direction): selfSet the direction.
withChildren(array $children): selfSet the children.
withChild(\SugarCraft\Dashboard\Foundation\Item $content, int $flex = 0): selfAdd a child to the layout.

LayoutDirection enum

Direction for layout arrangement.

Cases: Horizontal · Vertical

PHP also provides cases(), from() and tryFrom().

LayoutItem final class

An item within a layout with flex properties.

MethodSummary
__construct(public readonly \SugarCraft\Dashboard\Foundation\Item $content, public readonly int $flex = 0)
static flex(\SugarCraft\Dashboard\Foundation\Item $content, int $flex = 1): selfCreate a LayoutItem with flex grow behavior.
static fixed(\SugarCraft\Dashboard\Foundation\Item $content): selfCreate a LayoutItem that takes its natural size.

Pad final class

A general-purpose boxing/wrapping component that adds padding around content.

MethodSummary
__construct(private readonly \SugarCraft\Dashboard\Foundation\Item $content, private readonly array $padding = [0, 0, 0, 0], private readonly bool $border = false, private readonly VAlign $verticalAlign = VAlign::Top)
static new(\SugarCraft\Dashboard\Foundation\Item $content): selfCreate a pad with default settings (no padding, no border).
setSize(int $width, int $height): \SugarCraft\Dashboard\Foundation\SizerSet the allocated dimensions for this pad.
render(): stringRender the pad with its content.
innerSize(): arrayCalculate the inner area available for content after padding is subtracted (but before any border).
naturalExtent(int $width): arrayChrome-inclusive natural extent (Measurable, finding 032): the padding ring (and the one-cell border ring when border is on) on top of the content's own allocation-free render.
withPadding(int $n): selfSet uniform padding on all sides.
withPaddingXY(int $vertical, int $horizontal): selfSet padding with separate vertical and horizontal values.
withPaddingArray(array $padding): selfSet padding for each side individually.
withBorder(bool $border): selfEnable or disable the border.
withVerticalAlign(VAlign $align): selfSet the vertical alignment.

Panel final class

A panel component with header and footer sections.

MethodSummary
__construct(private readonly \SugarCraft\Dashboard\Foundation\Item|string $content, private readonly ?string $title = null, private readonly \SugarCraft\Dashboard\Foundation\Item|string|null $header = null, private readonly \SugarCraft\Dashboard\Foundation\Item|string|null $footer = null, private readonly ?Color $borderColor = null, private readonly ?Color $titleColor = null, private readonly string $style = 'single')
static new(\SugarCraft\Dashboard\Foundation\Item|string $content): selfCreate a new panel with default styling.
static titled(\SugarCraft\Dashboard\Foundation\Item|string $content, string $title): selfCreate a panel with a title.
setSize(int $width, int $height): \SugarCraft\Dashboard\Foundation\SizerSet the allocated dimensions for this panel.
render(): stringRender the panel as a string.
innerSize(): arrayCalculate the natural dimensions of this panel.
withContent(\SugarCraft\Dashboard\Foundation\Item|string $content): selfSet the panel content.
withTitle(?string $title): selfSet the panel title.
withHeader(\SugarCraft\Dashboard\Foundation\Item|string|null $header): selfSet the panel header content.
withFooter(\SugarCraft\Dashboard\Foundation\Item|string|null $footer): selfSet the panel footer.
withBorderColor(?Color $color): selfSet the border color.
withTitleColor(?Color $color): selfSet the title color.
withStyle(string $style): selfSet the border style.
withTheme(Theme $theme): selfApply a theme, fanning it down to any theme-aware children.

Screen final class

Full screen management for TUI applications.

MethodSummary
__construct(private readonly \SugarCraft\Dashboard\Foundation\Item $content, private readonly bool $alternateScreen = true, private readonly bool $showCursor = false, private readonly bool $enableMouse = false)
static new(\SugarCraft\Dashboard\Foundation\Item $content): selfCreate a new screen with default settings.
setSize(int $width, int $height): \SugarCraft\Dashboard\Foundation\SizerSet the allocated dimensions for this screen.
render(): stringRender one frame: clear, home, content.
setup(): stringSession preamble: enter the alternate screen, hide the cursor, enable mouse tracking. Emit ONCE before the first render().
teardown(): stringSession trailer matching setup(): disable mouse tracking, restore the cursor and leave the alternate screen. Pair with the same configuration the preamble was built from.
innerSize(): arrayCalculate the natural dimensions of this screen.
static clear(): stringClear the entire screen.
static moveCursor(int $x, int $y): stringMove cursor to a specific position.
static hide(): stringHide the cursor.
static show(): stringShow the cursor.
withAlternateScreen(bool $enable): selfEnable or disable alternate screen buffer.
withShowCursor(bool $show): selfEnable or disable cursor visibility.
withEnableMouse(bool $enable): selfEnable or disable mouse tracking.
withContent(\SugarCraft\Dashboard\Foundation\Item $content): selfSet new content.
withAlternateScreenEnabled(): selfEnable alternate screen buffer.
withAlternateScreenDisabled(): selfDisable alternate screen buffer.

Sidebar final class

A vertical sidebar navigation component.

MethodSummary
__construct(private readonly array $items = [], private readonly ?string $title = null, private readonly ?Color $borderColor = null, private readonly ?Color $activeColor = null, private readonly ?Color $inactiveColor = null, private readonly ?Color $bgColor = null, private readonly bool $collapsed = false)
static new(array $items = []): selfCreate a new sidebar with default styling.
static title(string $title, array $items = []): selfCreate a sidebar with a title.
setSize(int $width, int $height): \SugarCraft\Dashboard\Foundation\SizerSet the allocated dimensions for this sidebar.
render(): stringRender the sidebar as a string.
innerSize(): arrayCalculate the natural dimensions of this sidebar.
withItems(array $items): selfSet the sidebar items.
withTitle(?string $title): selfSet the sidebar title.
withBorderColor(?Color $color): selfSet the border color.
withActiveColor(?Color $color): selfSet the active item color.
withInactiveColor(?Color $color): selfSet the inactive item color.
withBgColor(?Color $color): selfSet the background color.
withCollapsed(bool $collapsed): selfSet the collapsed mode.
withActiveItem(int $index): selfMark an item as active by index.

Spacer final class

A spacer component that renders empty space.

MethodSummary
__construct(private readonly int $width = 1, private readonly int $height = 1, private readonly string $fillChar = ' ')
static new(int $width = 1, int $height = 1): selfCreate a new spacer with default styling.
static dotted(int $width = 40): selfCreate a dotted spacer line (useful for visual separation).
static dashed(int $width = 40): selfCreate a dashed spacer line (useful for visual separation).
static vertical(int $width = 1, int $height = 10): selfCreate a vertical spacer (column of fill characters).
setSize(int $width, int $height): \SugarCraft\Dashboard\Foundation\SizerSet the allocated dimensions for this spacer.
render(): stringRender the spacer as a string.
innerSize(): arrayCalculate the natural dimensions of this spacer.
withWidth(int $width): selfSet the width of this spacer.
withHeight(int $height): selfSet the height of this spacer.
withSize(int $width, int $height): selfSet both width and height.
withFillChar(string $char): selfSet the fill character.

Split final class

A container that splits the available space between multiple components.

MethodSummary
__construct(private readonly array $panes, private readonly SplitDirection $direction = SplitDirection::Horizontal, private readonly array $ratios = [], private readonly ?Color $dividerColor = null, private readonly bool $showDividers = true, private readonly int $dividerSize = 1)
static horizontal(array $panes, array $ratios = []): selfCreate a new horizontal split (side-by-side panes).
static vertical(array $panes, array $ratios = []): selfCreate a new vertical split (stacked panes).
setSize(int $width, int $height): \SugarCraft\Dashboard\Foundation\SizerSet the allocated dimensions for this split.
innerSize(): arrayCalculate the natural dimensions of this split.
render(): stringRender the split container.
withDirection(SplitDirection $direction): selfSet the split direction.
withRatios(array $ratios): selfSet the pane ratios.
withShowDividers(bool $show): selfShow or hide dividers between panes.
withDividerColor(?Color $color): selfSet the divider color.
withTheme(Theme $theme): selfApply a theme, fanning it down to any theme-aware children.

SplitDirection enum

Split direction for the Split container.

Cases: Horizontal · Vertical

PHP also provides cases().

Stack final class

A vertical stack layout component.

MethodSummary
__construct(private readonly array $items = [], private readonly int $spacing = 0)
static new(\SugarCraft\Dashboard\Foundation\Item ...$items): selfCreate a new vertical stack with default styling.
static spaced(int $spacing, \SugarCraft\Dashboard\Foundation\Item ...$items): selfCreate a vertical stack with spacing between items.
setSize(int $width, int $height): \SugarCraft\Dashboard\Foundation\SizerSet the allocated dimensions for this stack.
render(): stringRender the stack as a string.
innerSize(): arrayCalculate the natural dimensions of this stack.
withItems(array $items): selfAdd items to the stack.
withAppended(\SugarCraft\Dashboard\Foundation\Item $item): selfAdd an item to the end of the stack.
withPrepended(\SugarCraft\Dashboard\Foundation\Item $item): selfAdd an item to the beginning of the stack.
withSpacing(int $spacing): selfSet the spacing between items.
withTheme(Theme $theme): selfApply a theme, fanning it down to any theme-aware children.

StackLayout final class

A stack layout that arranges items in a stack (vertical by default).

MethodSummary
__construct(private readonly array $items = [], private readonly int $spacing = 0, private readonly LayoutDirection $direction = LayoutDirection::Vertical)
static vertical(Item ...$items): self
static horizontal(Item ...$items): self
setSize(int $width, int $height): Sizer
render(): string
innerSize(): array
withItems(array $items): self
withSpacing(int $spacing): self

VAlign enum

Vertical alignment enum for paragraphs.

Cases: Top · Middle · Bottom

PHP also provides cases(), from() and tryFrom().

VStack final class

A vertical stack layout component with alignment options.

MethodSummary
__construct(private readonly array $items = [], private readonly int $spacing = 0, private readonly HAlign $alignment = HAlign::Left)
static new(\SugarCraft\Dashboard\Foundation\Item ...$items): selfCreate a new vertical stack with default styling (left-aligned).
static spaced(int $spacing, \SugarCraft\Dashboard\Foundation\Item ...$items): selfCreate a vertical stack with spacing between items.
static centered(\SugarCraft\Dashboard\Foundation\Item ...$items): selfCreate a vertically centered stack (items centered horizontally).
static right(\SugarCraft\Dashboard\Foundation\Item ...$items): selfCreate a right-aligned vertical stack.
setSize(int $width, int $height): \SugarCraft\Dashboard\Foundation\SizerSet the allocated dimensions for this stack.
render(): stringRender the stack as a string.
innerSize(): arrayCalculate the natural dimensions of this stack.
withItems(array $items): selfSet the items in this stack.
withAppended(\SugarCraft\Dashboard\Foundation\Item $item): selfAdd an item to the end of the stack.
withPrepended(\SugarCraft\Dashboard\Foundation\Item $item): selfAdd an item to the beginning of the stack.
withSpacing(int $spacing): selfSet the spacing between items.
withAlignment(HAlign $alignment): selfSet the horizontal alignment.
withTheme(Theme $theme): selfApply a theme, fanning it down to any theme-aware children.

Viewport final class

A scrollable viewport for content.

MethodSummary
__construct(private readonly \SugarCraft\Dashboard\Foundation\Item $content, private readonly int $scrollX = 0, private readonly int $scrollY = 0, private readonly ?Color $background = null, private readonly ?int $width = null, private readonly ?int $height = null)
static new(\SugarCraft\Dashboard\Foundation\Item $content): selfCreate a new viewport with default styling.
setSize(int $width, int $height): \SugarCraft\Dashboard\Foundation\SizerSet the allocated dimensions for this viewport.
render(): stringRender the viewport as a string (multi-line).
innerSize(): arrayCalculate the natural dimensions of this viewport.
withScrollX(int $scrollX): selfSet the scroll position (X coordinate).
withScrollY(int $scrollY): selfSet the scroll position (Y coordinate).
withScroll(int $scrollX, int $scrollY): selfSet both scroll coordinates.
withBackground(?Color $color): selfSet the background color.
scrollBy(int $deltaX, int $deltaY): selfScroll the viewport by the given delta.
canScroll(): boolCheck if scrolling is possible in any direction.

Window final class

A window component with a title bar and content area.

MethodSummary
__construct(private readonly \SugarCraft\Dashboard\Foundation\Item $content, private readonly ?string $title = null, private readonly ?Color $titleColor = null, private readonly ?Color $borderColor = null, private readonly array $padding = [1, 1, 1, 1], private readonly string $controls = self::ControlsNone, private readonly bool $showShadow = false, private readonly VAlign $verticalAlign = VAlign::Top)
static new(\SugarCraft\Dashboard\Foundation\Item $content, ?string $title = null): selfCreate a new window with default styling.
setSize(int $width, int $height): \SugarCraft\Dashboard\Foundation\SizerSet the allocated dimensions for this window.
render(): stringRender the window with title bar and content.
innerSize(): arrayCalculate the inner area available for content.
naturalExtent(int $width): arrayChrome-inclusive natural extent (Measurable, finding 032): borders, the title row and the padding ring on top of the content's own allocation-free render.
withTitle(?string $title): selfSet the window title.
withTitleColor(?Color $color): selfSet the title color.
withBorderColor(?Color $color): selfSet the border color.
withPadding(int $n): selfSet uniform padding on all sides.
withPaddingXY(int $vertical, int $horizontal): selfSet padding with separate vertical and horizontal values.
withControls(string $controls): selfSet the window control buttons.
withShadow(bool $show): selfEnable or disable the shadow effect.
withVerticalAlign(VAlign $align): selfSet the vertical alignment.

ZStack final class

A layered stack layout component.

MethodSummary
__construct(private readonly array $items = [], private readonly HAlign $alignment = HAlign::Center, private readonly VAlign $vAlignment = VAlign::Middle)
static new(\SugarCraft\Dashboard\Foundation\Item ...$items): selfCreate a new layered stack with default styling.
static left(\SugarCraft\Dashboard\Foundation\Item ...$items): selfCreate a layered stack with all items left-aligned.
static right(\SugarCraft\Dashboard\Foundation\Item ...$items): selfCreate a layered stack with all items right-aligned.
static top(\SugarCraft\Dashboard\Foundation\Item ...$items): selfCreate a layered stack with all items top-aligned.
static bottom(\SugarCraft\Dashboard\Foundation\Item ...$items): selfCreate a layered stack with all items bottom-aligned.
setSize(int $width, int $height): \SugarCraft\Dashboard\Foundation\SizerSet the allocated dimensions for this stack.
render(): stringRender the layered stack as a string.
innerSize(): arrayCalculate the natural dimensions of this stack.
withItems(array $items): selfSet the items in this stack.
withTop(\SugarCraft\Dashboard\Foundation\Item $item): selfAdd an item to the top of the stack.
withBottom(\SugarCraft\Dashboard\Foundation\Item $item): selfAdd an item to the bottom of the stack.
withAlignment(HAlign $alignment): selfSet the horizontal alignment.
withVAlignment(VAlign $alignment): selfSet the vertical alignment.
withTheme(Theme $theme): selfApply a theme, fanning it down to any theme-aware children.

SugarCraft\Dashboard\Layout\Boxer

Boxer final class

A tree-based layout engine for rendering multiple Items in a hierarchical structure.

MethodSummary
__construct(private readonly Node $root, array $modelMap = [], private readonly int $width = 0, private readonly int $height = 0)
static leaf(string $address, Item $model): selfCreate a new Boxer with a single leaf node.
static tree(Node $root, array $modelMap = []): selfCreate a new Boxer with a tree structure of nodes.
static horizontal(Node ...$children): selfCreate a horizontal layout with children arranged side by side.
static vertical(Node ...$children): selfCreate a vertical layout with children stacked top to bottom.
editLeaf(string $address, callable $editFunc): selfEdit a leaf node's content, returning a new Boxer with the changes.
setSize(int $width, int $height): SizerSet the allocated dimensions and propagate to the tree.
render(): stringRender the boxer layout to a string.
root(): Node
getRoot(): NodeBC forwarder for the pre-rename accessor name.
modelMap(): array
getModelMap(): arrayBC forwarder for the pre-rename accessor name.
width(): int
getWidth(): intBC forwarder for the pre-rename accessor name.
height(): int
getHeight(): intBC forwarder for the pre-rename accessor name.
item(string $address): ?ItemGet the item at a given address.
getItem(string $address): ?ItemBC forwarder for the pre-rename accessor name.
node(string $address): ?NodeGet the node at a given address.
getNode(string $address): ?NodeBC forwarder for the pre-rename accessor name.
withTheme(Theme $theme): selfApply a theme, fanning it down to any theme-aware children.
persistState(Persistence $persistence, string $path, array $collapsedAddresses = []): voidPersist the layout engine's collapsed-panel addresses to disk.
restoreState(Persistence $persistence, string $path): arrayRestore the persisted collapsed-addresses list.

Node final class

A node in the boxer layout tree.

MethodSummary
__construct(private readonly array $children = [], private readonly bool $verticalStacked = false, private readonly ?\Closure $sizeFunc = null, private readonly bool $noBorder = false, private readonly string $address = '', private readonly int $width = 0, private readonly int $height = 0)
static leaf(string $address): selfCreate a leaf node with the given address.
static horizontal(Node ...$children): selfCreate a horizontal branch node (children arranged side by side).
static vertical(Node ...$children): selfCreate a vertical branch node (children stacked top to bottom).
static withSizeFunc(\Closure $sizeFunc, Node ...$children): selfCreate a node with a custom size function.
static noBorder(Node ...$children): selfCreate a node that doesn't draw borders.
children(): array
getChildren(): arrayBC forwarder for the pre-rename accessor name.
isLeaf(): bool
address(): string
getAddress(): stringBC forwarder for the pre-rename accessor name.
width(): int
getWidth(): intBC forwarder for the pre-rename accessor name.
height(): int
getHeight(): intBC forwarder for the pre-rename accessor name.
isVerticalStacked(): bool
hasNoBorder(): bool
setSize(int $width, int $height): selfCreate a new node with updated dimensions.
withChildren(array $children): selfCreate a new node with updated children.
withVerticalStacked(bool $verticalStacked): selfCreate a new node with a different orientation.
withCustomSizeFunc(?\Closure $sizeFunc): selfCreate a new node with a custom size function.
withBorder(bool $border): selfCreate a new node with borders enabled or disabled between children.
updateSizeRecursive(int $totalWidth, int $totalHeight): selfUpdate the size of this node and its children recursively.
renderTree(array $modelMap, int $width, int $height): array|string|\SugarCraft\Dashboard\Layout\Boxer\SizeErrorRender this node and its children to a list of lines.
render(): stringDummy render for Item interface - use render() with modelMap instead.

NotFoundError final class

Error thrown when a leaf address is not found in the model map.

SizeError final class

Error thrown when there is not enough space for nodes in the layout tree.

SugarCraft\Dashboard\Layout\Grid

ItemOptions final readonly class

Per-item placement options within a StackedGrid.

MethodSummary
__construct(public int $column = 0, public bool $expandVertical = false)

Options final readonly class

Grid-level configuration options.

MethodSummary
__construct(public bool $fitScreen = true)

StackedGrid final class

Multi-column stacked grid layout.

MethodSummary
__construct(private readonly Options $options = new Options())
withItem(\SugarCraft\Dashboard\Foundation\Item $item, ItemOptions $options = new ItemOptions()): selfReturn a new grid with the item appended at the given placement.
setSize(int $width, int $height): \SugarCraft\Dashboard\Foundation\SizerPropagate terminal dimensions to the grid, returning a sized clone.
render(): stringRender the entire grid.
withTheme(Theme $theme): selfApply a theme, fanning it down to any theme-aware children.
persistState(Persistence $persistence, string $path, array $collapsedAddresses = []): voidPersist the layout engine's collapsed-panel addresses to disk.
restoreState(Persistence $persistence, string $path): arrayRestore the persisted collapsed-addresses list.

SugarCraft\Dashboard\Layout\RatioGrid

GridItem final class

A grid item with ratio-based sizing.

MethodSummary
__construct(public readonly mixed $content, public readonly float $rowSpan = 1.0, public readonly float $colSpan = 1.0)
static full(mixed $content): self

NewColRow final class

Represents a new column or row in a ratio grid.

MethodSummary
__construct(public readonly float $ratio = 1.0, public readonly ?int $fixed = null)
static ratio(float $ratio): self
static fixed(int $size): self

RatioGrid final class

A grid layout that sizes rows and columns by ratio.

MethodSummary
__construct(private readonly array $grid = [], private readonly array $colDefinitions = [], private readonly array $rowDefinitions = [])
static new(int $columns, int $rows): self
setSize(int $width, int $height): Sizer
render(): string
innerSize(): array
withCell(int $row, int $col, GridItem $item): self

SugarCraft\Dashboard\Layout\Support

PersistState trait

Shared collapsed-address persistence for the layout engines.

MethodSummary
persistState(Persistence $persistence, string $path, array $collapsedAddresses = []): voidPersist the layout engine's collapsed-panel addresses to disk.
restoreState(Persistence $persistence, string $path): arrayRestore the persisted collapsed-addresses list.

SugarCraft\Dashboard\Layout\Tile

BaseTile class

Base tile implementation.

MethodSummary
__construct(protected readonly string $name = '', protected readonly Size $size = new Size())
name(): string
getName(): stringBC forwarder for the pre-rename accessor name.
size(): Size
getSize(): SizeBC forwarder for the pre-rename accessor name.
setSize(int $width, int $height): Sizer
render(): string
withTheme(Theme $theme): staticIdentity by default: the base tile carries no themeable content.
innerSize(): array

Constraint final class

Constraint describes how a child should be sized along a container's axis. Mirrors tealeaves/tealayout_constraint.go constraint struct.

MethodSummary
__construct(public readonly ConstraintKind $kind = ConstraintKind::Fixed, public readonly int $fixedSize = 0, public readonly float $flexWeight = 0.0, public readonly int $minSize = 0, public readonly ?int $maxSize = null, public readonly bool $optional = false, public readonly bool $minSizeFit = false)
static fixed(int $size): self
static flex(float $weight = 1.0): self
static fit(): self
withMinSize(int $min): self
withMaxSize(int $max): selfCap the size at $max. A non-positive cap means no cap: sizing a visible tile to a zero maximum was the silent clamp-to-zero half of finding sugar-dashboard-217, so 0 now reads as honest no-max.
withOptional(bool $optional): self
withMinSizeFit(bool $fit): self

ConstraintKind enum

ConstraintKind identifies which constraint type is active. Mirrors tealeaves tealayout_constraint.go constraintKind.

Cases: Fixed · Flex · Fit

PHP also provides cases(), from() and tryFrom().

Dimension final class

Dimension represents a width/height pair. Mirrors tealeaves SizeHint.Min/SizeHint.Desired type.

MethodSummary
__construct(public readonly int $width = 0, public readonly int $height = 0)

Direction enum

Direction for tile layout arrangement.

Cases: Horizontal · Vertical

PHP also provides cases(), from() and tryFrom().

Resolver final class

Resolver for tile layout dimensions using a 5-phase algorithm. Mirrors tealeaves/tealayout_resolve.go.

MethodSummary
static resolveLinear(int $available, array $constraints, int $gap, ?array $hinters = null, bool $horizontal = true, int $crossBudget = 0): arrayResolve a single axis of layout: given available space, constraints, gap between children, and optional SizeHinters (may be nil or contain nil entries), it returns the assigned size for each child.

Size final class

Size constraints for a tile.

MethodSummary
__construct(public readonly int $width = 0, public readonly int $height = 0, public readonly float $weight = 1.0, public readonly ?int $minWidth = null, public readonly ?int $minHeight = null, public readonly ?int $maxWidth = null, public readonly ?int $maxHeight = null, public readonly ?int $fixedWidth = null, public readonly ?int $fixedHeight = null, public readonly bool $optional = false, public readonly bool $minSizeFit = false)
static fill(): selfCreate a fill Size (flexible, weight 1.0).
static fixed(int $w, int $h): selfCreate a fixed Size with explicit width and height.
static flex(float $weight = 1.0): selfCreate a flex Size with optional weight.
withWidth(int $width): self
withHeight(int $height): self
withOptional(bool $optional): self
withMinSizeFit(bool $minSizeFit): self
withMinWidth(?int $minWidth): self
withMaxWidth(?int $maxWidth): self
withWeight(float $weight): self

SizeHint final class

SizeHint contains minimum and desired size for a widget. Mirrors tealeaves tealayout_sizehinter.go SizeHint struct.

MethodSummary
__construct(public readonly Dimension $min, public readonly Dimension $desired)
static empty(): self

SizeHinter interface

SizeHinter is implemented by widgets that can report their size preferences given available space. The layout engine calls sizeHint during resolution for Fit-constrained and minSizeFit children.

MethodSummary
sizeHint(int $availWidth, int $availHeight): SizeHint

ThemedTile interface

A tile that knows how to re-theme itself, preserving its own type.

MethodSummary
withTheme(Theme $theme): static

Tile final class

A tile in a tile layout.

MethodSummary
__construct(string $name = '', Size $size = new Size(), private readonly ?Item $content = null)
parent(): ?TileLayout
getParent(): ?TileLayoutBC forwarder for the pre-rename accessor name.
setParent(?TileLayout $parent): void
isOptional(): bool
isMinSizeFit(): bool
content(): ?Item
getContent(): ?ItemBC forwarder for the pre-rename accessor name.
withTheme(Theme $theme): staticRebuild this tile with its content themed, keeping name, size and any box already allocated to it.
render(): string
name(): string
getName(): stringBC forwarder for the pre-rename accessor name.
size(): Size
getSize(): SizeBC forwarder for the pre-rename accessor name.
setSize(int $width, int $height): Sizer
innerSize(): array

TileLayout final class

A tile-based layout that arranges tiles horizontally or vertically.

MethodSummary
__construct(private readonly string $name = 'Root', private readonly Direction $direction = Direction::Horizontal, private readonly array $tiles = [], private readonly Size $baseSize = new Size(), private readonly int $gap = 0)
static horizontal(string $name = 'Root'): self
static vertical(string $name = 'Root'): self
setSize(int $width, int $height): Sizer
render(): string
innerSize(): array
withTiles(array $tiles): self
withDirection(Direction $direction): self
withTile(Tile $tile): self
withGap(int $gap): self
withTheme(Theme $theme): selfApply a theme, fanning it down to any theme-aware children.

SugarCraft\Dashboard\Module

BaseModule abstract class

Abstract base class for modules with default behaviour.

MethodSummary
init(): ?\Closure
update(Msg $msg): array
view(): string
minSize(): arrayGet the minimum terminal size required by this module.
subscriptions(): ?SubscriptionsThe module's declared subscriptions, memoised per clone lineage.
state(): arrayGet current module state.
getState(): arrayBC forwarder for the pre-rename accessor name.
name(): stringThe module's instance name. Two modules of the same type coexist by being named apart (the built-ins take a name: ctor knob); hosts key ticks, subscriptions and registry slots on it, so it must be unique among the modules one host runs.

BoundedCommand final class

One bounded child-process run: argv, no shell interpolation, wall-clock deadline, output ceiling, and a guaranteed TERM→KILL reap before return.

MethodSummary
static run(array $argv, float $timeoutSeconds = self::DEFAULT_TIMEOUT_SECONDS, int $maxOutputBytes = self::MAX_OUTPUT_BYTES): arrayRun $argv and report the outcome as output plus, when the run could not complete, ONE specific human-readable cause. The four former blanket 'Command failed' shapes (no command / could not start / interrupted / timed out) are named separately; empty output from a zero-exit child is a SUCCESS with nothing to show (failure === null), not a disguised error.
static runAsync(LoopInterface $loop, array $argv, float $timeoutSeconds = self::DEFAULT_TIMEOUT_SECONDS, int $maxOutputBytes = self::MAX_OUTPUT_BYTES): PromiseInterfaceThe loop-driven run(): the same outcome, delivered on a promise, so a tick can hand its child to the loop instead of blocking the dashboard on it. The deadline and the TERM/KILL ladder are ChildRun's, running on $loop.

ImagePlacement final class

Represents the placement of an image within a module's content.

MethodSummary
__construct(public readonly string $path, public readonly int $x, public readonly int $y, public readonly int $width = 0, public readonly int $height = 0)
static topLeft(string $path, int $x = 0, int $y = 0): selfCreate a placement at the top-left corner.
static topRight(string $path, int $x = 0, int $y = 0): selfCreate a placement at the top-right corner.
static bottomLeft(string $path, int $x = 0, int $y = 0): selfCreate a placement at the bottom-left corner.
static bottomRight(string $path, int $x = 0, int $y = 0): selfCreate a placement at the bottom-right corner.
static center(string $path, int $width = 0, int $height = 0): selfCreate a centered placement.

ImagePlacer interface

Optional interface for modules that can specify image placements.

MethodSummary
imagePlacements(): arrayGet the image placements for this module.

LegacyModule interface

Legacy module contract — superseded by Module.

MethodSummary
name(): stringGet the module name.
init(): arrayInitialize the module.
update(array $state): arrayUpdate the module state.
view(array $state, int $width, int $height): stringRender the module view.
minSize(): arrayGet the minimum size required by this module.

LegacyModuleAdapter final class

Adapter letting a legacy plugin implement the Module contract.

MethodSummary
__construct(private readonly LegacyModule $legacy, private array $state = [])
static from(callable $constructor): selfCreate an adapter from a legacy-module constructor.
name(): string
init(): ?\Closure
update(Msg $msg): array
view(): string
minSize(): array
subscriptions(): ?SubscriptionsSchedule the plugin's advertised refresh interval.

Module interface

Dashboard module contract aligned with \SugarCraft\Core\Model.

MethodSummary
name(): stringThe module's instance name. Two modules of the same type coexist by being named apart (the built-ins take a name: ctor knob); hosts key ticks, subscriptions and registry slots on it, so it must be unique among the modules one host runs.
minSize(): arrayGet the minimum terminal size required by this module.

ModuleConfig final class

Configuration for a module instance.

MethodSummary
__construct(public readonly string $name, public readonly int $interval = 0, public readonly int $minWidth = 30, public readonly int $minHeight = 4, public readonly array $options = [])
static static(string $name, int $minWidth = 30, int $minHeight = 4): selfCreate a config with the minimum interval (no auto-update).
static withInterval(string $name, int $interval, int $minWidth = 30, int $minHeight = 4): selfCreate a config with periodic updates.
static withOptions(string $name, array $options, int $minWidth = 30, int $minHeight = 4): selfCreate a config with custom options.

ProcAvailability final class

Probe-once availability of Linux /proc files — probe-once-and-degrade policy, option (b): probe once, degrade quietly, show a visible 'n/a' sentinel.

MethodSummary
static has(string $path): boolIs $path readable on this host? Probed once per process; afterwards the answer is stable even if the filesystem changes underneath (probe-once, degrade-quietly).
static markForTesting(string $path, bool $available): voidTEST SEAM ONLY — override the availability answer for $path without touching the real filesystem; production code must never call this.
static resetForTesting(): voidTEST SEAM ONLY — drop every memoized door so the next has() re-probes the ambient host. Call from tearDown so a degraded pin can never leak its false into a later readable-branch assertion.

RunLaunch final class

When one run's child was actually launched, as opposed to when its tick asked for it. A host may hold a Cmd for a while before running it, and the settle ceiling a module latches against must count from the launch, or a run that queued for longer than the ceiling is treated as stale while its child is alive.

MethodSummary
markLaunched(): voidCalled by the run's Cmd at the moment its child is launched.
latchedSince(float $tickedAt): floatThe second the latch counts from: the launch once it happened, otherwise the tick that asked for the run, so a Cmd the host never runs still goes stale.

TickEpoch final class

Focus-regain epoch counter for modules.

MethodSummary
__construct(private readonly int $initialEpoch = 0)
static zero(): selfCreate a new TickEpoch with zero initial value.
value(): intGet the current epoch value.
bump(): selfBump the epoch (call when focus is regained).
isStale(int $received): boolCheck if a received epoch value is stale (lower than current).
shouldRefresh(int $received): boolCheck if focus should be refreshed based on epoch comparison.

SugarCraft\Dashboard\Modules\Clock

ClockModule final class

Clock module that displays the current time.

MethodSummary
__construct(private readonly bool $showDate = false, private readonly ?string $timezone = null, private readonly ?string $name = null)
name(): string
init(): ?\Closure
update(Msg $msg): array
view(): string
static timeBuildCountForTesting(): intTest seam (ProcAvailability style): counts createTime() bodies, so the tick-gating law is pinned directly.
static resetTimeBuildCountForTesting(): void
minSize(): array
subscriptions(): ?SubscriptionsThe module's declared subscriptions, memoised per clone lineage.
state(): arrayGet current module state.
getState(): arrayBC forwarder for the pre-rename accessor name.

SugarCraft\Dashboard\Modules\Generic

CommandOutputMsg final readonly class

The settled result of one run of a Generic module's command, delivered back to the module that started it. The command runs on the loop, so a tick never blocks on it; $output is the text view() shows (output, or the named failure). $run names the run that produced it: a hung run can settle after a newer one has started, and only the newest may clear the in-flight latch.

MethodSummary
__construct(public string $source, public string $output, public int $run)

GenericModule final class

Generic module that runs a configured command and displays output.

MethodSummary
__construct(private readonly string|array $command, private readonly int $intervalSeconds = 5, private readonly ?string $name = null, private readonly ?LoopInterface $loop = null)
name(): string
init(): ?\Closure
update(Msg $msg): array
view(): string
minSize(): array
subscriptions(): ?SubscriptionsThe module's declared subscriptions, memoised per clone lineage.
state(): arrayGet current module state.
getState(): arrayBC forwarder for the pre-rename accessor name.

SugarCraft\Dashboard\Modules\System

GpuSampleMsg final readonly class

The settled result of one nvidia-smi sample, delivered back to the System module that asked for it. The sample runs on the loop (SystemModule) so a hung driver cannot freeze a tick; this message carries its outcome home.

MethodSummary
__construct(public string $source, public float $load, public bool $spawnFailed, public int $sample)

SystemModule final class

System module that displays CPU, memory, GPU, and uptime statistics.

MethodSummary
__construct(private readonly float $refreshSeconds = self::TICK_INTERVAL, private readonly ?string $name = null, private readonly ?LoopInterface $loop = null)
name(): string
init(): ?\Closure
update(Msg $msg): array
view(): string
minSize(): array
subscriptions(): ?SubscriptionsThe module's declared subscriptions, memoised per clone lineage.
state(): arrayGet current module state.
getState(): arrayBC forwarder for the pre-rename accessor name.

SugarCraft\Dashboard\Modules\Uptime

UptimeModule final class

Uptime module that displays system uptime.

MethodSummary
__construct(private readonly ?string $name = null)
name(): string
init(): ?\Closure
update(Msg $msg): array
view(): string
static sampleCountForTesting(): intTest seam (ProcAvailability style): counts readUptimeFromProc() bodies entered, so the tick-gating law is pinned directly.
static resetSampleCountForTesting(): void
minSize(): array
subscriptions(): ?SubscriptionsThe module's declared subscriptions, memoised per clone lineage.
state(): arrayGet current module state.
getState(): arrayBC forwarder for the pre-rename accessor name.

SugarCraft\Dashboard\Modules\Weather

HttpClient interface

Abstract HTTP fetch interface for weather data.

MethodSummary
fetch(string $location): WeatherSnapshotFetch the current weather for the given location.

WeatherFailureMsg final class

Carries a failed weather lookup back into update().

MethodSummary
__construct(public readonly \DateTimeImmutable $attemptedAt, public readonly string $reason)

WeatherModule class

Weather module that fetches live data from wttr.in and falls back to cache.

MethodSummary
__construct(private readonly HttpClient $httpClient, private readonly string $location = 'auto', private readonly float $tickSeconds = self::TICK_INTERVAL, private readonly int $ttlSeconds = self::TTL_SECONDS, private readonly ?string $name = null, private readonly ?LoopInterface $loop = null)
name(): string
init(): ?\Closure
update(Msg $msg): array
view(): string
static wallReadCountForTesting(): int
static resetWallReadCountForTesting(): void
minSize(): array
subscriptions(): ?SubscriptionsThe module's declared subscriptions, memoised per clone lineage.
state(): arrayGet current module state.
getState(): arrayBC forwarder for the pre-rename accessor name.

WeatherParseFailure final class

The bytes arrived but are not a wttr.in j1 document: invalid JSON or a shape the parser refuses.

WeatherResultMsg final readonly class

Async result of an off-loop weather fetch.

MethodSummary
__construct(public WeatherSnapshot $snapshot)

WeatherSnapshot final class

Readonly DTO holding a single weather snapshot.

MethodSummary
__construct(public readonly ?float $tempC, public readonly string $condition, public readonly string $location, public readonly \DateTimeImmutable $fetchedAt)
static fromArray(array $data): selfDeserialize from cache JSON array.
toArray(): arraySerialize for cache JSON.

WeatherTransportFailure final class

The network channel itself failed: the stream could not be opened, the reply was aborted, or it exceeded the size cap.

WttrInClient final class

Fetches weather data from wttr.in.

MethodSummary
__construct(private readonly string $urlPattern = self::BASE_URL)
fetch(string $location): WeatherSnapshot

SugarCraft\Dashboard\Msg

AdapterTickMsg final class

Refresh tick scheduled by the legacy-module adapter's subscription.

TickMsg final class

The one tick marker every module's refresh cadence mints.

MethodSummary
__construct(public readonly ?string $source = null)
static for(string $source): selfMint a tick addressed to one module.
isFor(string $module): boolTrue when this tick should drive the named module: addressed to it, or broadcast (source-less).

SugarCraft\Dashboard\Output

RenderBar final class

Helper for rendering progress bars.

MethodSummary
static render(float $percentage, int $width, string $filled = '█', string $empty = '░', ?Color $filledColor = null, ?Color $emptyColor = null, ?ColorProfile $profile = null): stringRender a horizontal progress bar.
static renderSegmented(float $percentage, int $width, ?Color $color = null, ?ColorProfile $profile = null): stringRender a progress bar shaded at eighth-block precision.

Truncate final class

Truncation helper with ANSI awareness — the canonical cut for this library (sugar-dashboard-018's consolidation seat).

MethodSummary
static truncate(string $text, int $width, string $ellipsis = '…'): stringTruncate a string to a maximum width.
static truncateLeft(string $text, int $width, string $fill = ' '): stringTruncate with left alignment (pad right).
static truncateRight(string $text, int $width, string $fill = ' '): stringTruncate with right alignment (pad left).
static truncateCenter(string $text, int $width, string $fill = ' '): stringTruncate with center alignment.

WrapCells final class

Helper for wrapping text into cells/columns.

MethodSummary
static wrap(string $text, int $width, bool $breakWords = false): arrayWrap text to fit within a given width.
static wrapAndPad(string $text, int $width, string $pad = ' '): arrayWrap and pad lines to a consistent width.

SugarCraft\Dashboard\Plot

DistanceFade final class

btop's process-list distance fade: rows dim toward inactive_fg the farther they sit from the selected row, and each metric column (cpu, mem, threads) blends its value color back toward grey by the same distance.

MethodSummary
static ramp(Color $from, Color $to): arraybtop's two-stop ramp (proc: main_fg → inactive_fg, proc_color: inactive_fg → process_start).
static distance(int $selected, int $row): intbtop's calc: |selected − row|, selected 1-based (0 = none), row 0-based.
static fadeIndex(int $calc, int $selectMax): intRamp index for the text fade: clamp(calc * 100 / select_max, 0, 100) with C++ truncating division.
static fadeColor(array $procRamp, int $calc, int $selectMax): ColorRow text color: Theme::g("proc").at(fadeIndex).
static metricPosition(int $value, int $calc, int $selectMax): intThe blend position btop computes before picking a ramp: (min(v, 100) + 100) - calc * 100 / select_max. Below 100 the metric has been pulled into the grey proc_color half; at or above it the remainder indexes process.
static metricColor(array $procColorRamp, array $processRamp, int $value, int $calc, int $selectMax): ColorMetric color with the distance blend (proc_gradient on): position < 100 → proc_color[max(0, position)], else process[clamp(position - 100, 0, 100)].
static flatMetricColor(array $processRamp, int $value): ColorMetric color with the distance blend off: process[clamp(v, 0, 100)].
static metricValues(float $cpuPercent, float $memPercent, int $threads): arrayThe three integers btop feeds the metric law, each with its own C++ coercion: cpu is (int)round(cpu_p); mem is (int)round(mem * 100 / totalMem) over unsigned integers, so the division has already floored before round() sees it; threads are (int)threads / 3, deliberately compressed so a 300-thread process reads as "hot".

Gradient101 final class

btop's 101-entry gradient expansion (index = percent), shared by every Plot widget that colors by percent so the integer law lives in one place.

MethodSummary
static expand(array $stops): arrayExpand ordered low→high stops into a 101-entry lookup.

Plot final class

A line/scatter chart rendered using braille characters for 2x4 resolution.

MethodSummary
__construct(array $data = [], int $width = 80, int $height = 24)
static new(array $data = [], int $width = 80, int $height = 24): self
withMode(string $mode): selfSet the plot mode.
withShowAxes(bool $show): self
withHorizontalScale(int $scale): self
withColor(?Color $color): self
withData(array $data): self
withMinValue(float $min): self
withMaxValue(float $max): self
setSize(int $width, int $height): Sizer
innerSize(): array
rect(): Rect
setRect(Rect $rect): self
draw(Buffer $buffer): void
render(): stringRender the plot as a string.
withTheme(Theme $theme): selfApply a theme to this plot, using the theme's primary color.

RingBuffer final class

Indexed ring buffer for time-series data.

MethodSummary
__construct(int $size = 60)
push(float $value): voidPush a value onto the ring buffer.
isEmpty(): boolCheck if the buffer is empty.
isFull(): boolCheck if the buffer is full.
count(): intGet the current number of values in the buffer.
capacity(): intGet the maximum capacity of the buffer.
toArray(): arrayGet all values in chronological order (oldest first).
latest(): ?floatGet the most recent value (newest).
oldest(): ?floatGet the oldest value in the buffer.
clear(): voidClear all values from the buffer.

SugarCraft\Dashboard\Plot\Braille

BrailleCanvas final class

A canvas that renders to braille characters (2x4 dots per cell).

MethodSummary
__construct(int $pixelWidth, int $pixelHeight)
static new(int $pixelWidth, int $pixelHeight): self
withGradient(array $stops, ?\Closure $scale = null): selfAttach a value→color ramp. Once attached, setPoint()/setLine() with a null color paint the dot from the ramp at the canvas' current value (see withValue()); an explicit color still wins.
withoutGradient(): selfDetach the ramp: null-color points go back to keeping the cell's current color. The current value is kept for a later withGradient().
withValue(int|float $value): selfSet the sample value that subsequent null-color points are painted with when a gradient is attached. Ignored for coloring otherwise.
gradient(): ?arrayThe expanded 101-entry ramp (index = percent), or null when no gradient is attached.
value(): int|float
setPoint(int $x, int $y, ?\SugarCraft\Core\Util\Color $color = null): selfSet a single dot at pixel coordinates (x, y).
setLine(int $x1, int $y1, int $x2, int $y2, ?\SugarCraft\Core\Util\Color $color = null): selfDraw a line from (x1,y1) to (x2,y2) using Bresenham's algorithm.
clear(): selfClear all dots from the canvas.
cell(int $cellX, int $cellY): intGet accumulated bits for a cell.
getCell(int $cellX, int $cellY): intBC forwarder for the pre-rename accessor name.
cells(): \GeneratorIterate over all cells that have dots set.
render(?ColorProfile $profile = null): stringRender the canvas as a string of braille characters.
setSize(int $width, int $height): SizerResize the canvas. UNIT CONTRACT (finding sugar-dashboard-186): the dimensions are PIXELS - Braille cells are 2 wide by 4 tall, so feeding innerSize() (which answers in CELLS) back in here grows the canvas 2x/4x per lap. The round-trip bridge is pixelSize().
innerSize(): array
pixelSize(): array
getPixelSize(): arrayBC forwarder for the pre-rename accessor name.

BrailleMatrix final class

Braille dot matrix constants and utilities.

MethodSummary
static cellX(int $pixelX): intGet the braille cell column index from a pixel X coordinate.
static cellY(int $pixelY): intGet the braille cell row index from a pixel Y coordinate.
static dotBit(int $pixelX, int $pixelY): intGet the dot bit for a pixel position within its braille cell.
static rune(int $bits): stringBuild a braille rune from accumulated bits.
static cellWidth(int $pixelWidth): intGet the character width in braille cells. A braille cell is 2 pixels wide; at least 1 cell is needed for any pixels.
static cellHeight(int $pixelHeight): intGet the character height in braille cells. A braille cell is 4 pixels tall; at least 1 cell is needed for any pixels.

Bresenham final class

Bresenham line algorithm implementation for precise line drawing.

MethodSummary
static line(int $x1, int $y1, int $x2, int $y2): arrayGenerate all points on a line from (x1,y1) to (x2,y2).
static circleArc(int $cx, int $cy, int $radius, int $octant = 0): arrayGenerate all points on a circle arc (octant).
static isOnLine(int $x, int $y, int $x1, int $y1, int $x2, int $y2): boolCheck if a point is on the line segment.

DualSampleGraph final class

btop's history graph: two adjacent samples quantized into one cell glyph.

MethodSummary
static new(int $width, int $height, string $family = self::FAMILY_BRAILLE, bool $invert = false, bool $noZero = false, int $maxValue = 0, int $offset = 0): selfArgument order follows btop's Graph constructor (max_value before offset). A positive offset with no max_value implies max_value 100, as in btop, so the stored maxValue() is the effective one.
push(int|float ...$values): selfAppend samples (oldest first); the frame scrolls left by half a cell per sample (a whole cell in the tty family).
withData(int|float ...$values): selfReplace the whole history, like handing btop's constructor a deque.
withGradient(array $stops): selfColor through a 101-stop ramp (Gradient101::expand()). Height 1 colors each drawn cell by max(prev, cur); taller graphs color each row by its vertical position. Named withGradient() rather than the plan's setGradient() to keep the immutable with*() convention.
withoutGradient(): self
withUnderlay(Color $inactiveFg): selfShow the family's graph_bg glyph, in $inactiveFg, wherever btop's graph is transparent. Only height-1 graphs have transparent cells (btop prints taller graphs' blanks as opaque spaces), matching every btop call site, which underlays only one-row graphs.
withoutUnderlay(): self
underlayGlyph(): stringThe family's graph_bg glyph: ⣀ braille, ▄ block, 🬭 block2, ░ tty.
static underlay(string $family, int $cells, Color $inactiveFg, ?ColorProfile $profile = null): stringbtop's standalone underlay strip, Theme::c("inactive_fg") + graph_bg * n, for callers that compose the overdraw themselves.
render(?ColorProfile $profile = null): string
setSize(int $width, int $height): Sizer
innerSize(): array
width(): int
height(): int
family(): string
inverted(): bool
noZero(): bool
maxValue(): int
offset(): int
samples(): array
gradient(): ?array
underlayColor(): ?Color

SugarCraft\Dashboard\Plot\Canvas

Canvas final class

A 2D pixel drawing canvas.

MethodSummary
__construct(private readonly int $widthConstraint = 40, private readonly int $heightConstraint = 20, private readonly ?Color $defaultFg = null, private readonly ?Color $defaultBg = null)
static new(int $width = 40, int $height = 20): selfCreate a new canvas with default settings.
setSize(int $width, int $height): SizerSet the allocated dimensions for this canvas.
setPixel(int $x, int $y, string $char = '█', ?Color $fg = null, ?Color $bg = null): selfSet a single pixel.
pixel(int $x, int $y): ?stringGet a pixel character at the given coordinates.
getPixel(int $x, int $y): ?stringBC forwarder for the pre-rename accessor name.
drawLine(int $x1, int $y, int $x2, string $char = '█', ?Color $fg = null, ?Color $bg = null): selfDraw a horizontal line.
drawVLine(int $x, int $y1, int $y2, string $char = '█', ?Color $fg = null, ?Color $bg = null): selfDraw a vertical line.
drawRect(int $x, int $y, int $w, int $h, string $char = '█', ?Color $fg = null, ?Color $bg = null): selfDraw a rectangle outline.
fillRect(int $x, int $y, int $w, int $h, string $char = '█', ?Color $fg = null, ?Color $bg = null): selfFill a rectangle.
drawCircle(int $cx, int $cy, int $radius, string $char = '█', ?Color $fg = null, ?Color $bg = null): selfDraw a circle outline using the midpoint circle algorithm.
fillCircle(int $cx, int $cy, int $radius, string $char = '█', ?Color $fg = null, ?Color $bg = null): selfFill a circle.
drawText(int $x, int $y, string $text, ?Color $fg = null, ?Color $bg = null): selfDraw ASCII text at the given position.
clear(): selfClear the canvas.
render(): stringRender the canvas as a string.
innerSize(): arrayCalculate the dimensions this canvas paints.
withWidth(int $width): selfSet a new width.
withHeight(int $height): selfSet a new height.
withDefaultFg(?Color $color): selfSet the default foreground color.
withDefaultBg(?Color $color): selfSet the default background color.

CanvasPoint final readonly class

Point in 2D space.

MethodSummary
__construct(public int $x, public int $y)

DrawingOps final class

Drawing operations helper class with static methods for common drawing operations.

MethodSummary
static drawHLine(int $x1, int $y, int $x2, string $char, ?Color $fg, ?Color $bg, Canvas $canvas, int $widthConstraint, int $heightConstraint): CanvasDraw a horizontal line.
static drawVLine(int $x, int $y1, int $y2, string $char, ?Color $fg, ?Color $bg, Canvas $canvas, int $widthConstraint, int $heightConstraint): CanvasDraw a vertical line.
static drawRect(int $x, int $y, int $w, int $h, string $char, ?Color $fg, ?Color $bg, Canvas $canvas, int $widthConstraint, int $heightConstraint): CanvasDraw a rectangle outline.
static fillRect(int $x, int $y, int $w, int $h, string $char, ?Color $fg, ?Color $bg, Canvas $canvas, int $widthConstraint, int $heightConstraint): CanvasFill a rectangle.
static drawCircle(int $cx, int $cy, int $radius, string $char, ?Color $fg, ?Color $bg, Canvas $canvas, int $widthConstraint, int $heightConstraint): CanvasDraw a circle outline using the midpoint circle algorithm.
static fillCircle(int $cx, int $cy, int $radius, string $char, ?Color $fg, ?Color $bg, Canvas $canvas, int $widthConstraint, int $heightConstraint): CanvasFill a circle.
static drawText(int $x, int $y, string $text, ?Color $fg, ?Color $bg, Canvas $canvas, int $widthConstraint, int $heightConstraint): CanvasDraw ASCII text at the given position.

SugarCraft\Dashboard\Plot\Chart

Area final class

An area chart component with stacked layers.

MethodSummary
__construct(private ?Color $color = null, private ?Color $fillColor = null, private ?Color $gridColor = null, private ?Color $labelColor = null)
static new(array $dataPoints = []): selfCreate a new area chart with default styling.
static sample(int $points = 10): selfCreate a sample area chart for demonstration.
setSize(int $width, int $height): \SugarCraft\Dashboard\Foundation\SizerSet the allocated dimensions for this area chart.
withDataPoints(array $dataPoints): selfSet the data points.
withPoint(AreaPoint $point): selfAdd a data point.
addPoint(string $label, float $value, ?float $y0 = null): selfAdd a data point by parameters.
withLayerColors(array $colors): selfSet layer colors for stacked charts.
withShowGrid(bool $show): selfShow or hide grid lines.
withShowLabels(bool $show): selfShow or hide labels.
withShowValues(bool $show): selfShow or hide values.
withStacked(bool $stacked): selfEnable or disable stacked mode.
withShowLegend(bool $show): selfShow or hide legend.
render(): stringRender the area chart as a string.
innerSize(): arrayCalculate the natural dimensions of this area chart.
withColor(?Color $color): selfSet the line color.
withFillColor(?Color $color): selfSet the fill color.
withGridColor(?Color $color): selfSet the grid color.
withLabelColor(?Color $color): selfSet the label color.
withHeight(int $height): selfSet the height constraint.

AreaChart final class

An area chart component for displaying time series data.

MethodSummary
__construct(private readonly array $series, private readonly int $chartHeight = 10, private readonly int $chartWidth = 40, private readonly bool $showGrid = true, private readonly bool $showLabels = true, private readonly bool $showLegend = false, private readonly float $maxValue = 100.0, private readonly bool $stacked = false)
static new(array $series): selfCreate a new area chart.
setSize(int $width, int $height): \SugarCraft\Dashboard\Foundation\SizerSet the allocated dimensions for this chart.
innerSize(): arrayCalculate the natural dimensions of this area chart.
render(): stringRender the area chart.
withDimensions(int $width, int $height): selfSet the chart dimensions.
withShowGrid(bool $show): selfShow or hide grid lines.
withShowLegend(bool $show): selfShow or hide legend.
withMaxValue(float $max): selfSet the maximum value.
withStacked(bool $stacked): selfEnable stacked mode.

AreaPoint final readonly class

MethodSummary
__construct(public string $label, public float $value, public ?float $y0 = null)

AxisLabelFormatter trait

Human-readable axis-label formatting (M / K / integer / one-decimal).

Bar final class

A horizontal status bar component.

MethodSummary
__construct(private readonly string $content = '', private readonly ?Color $foreground = null, private readonly ?Color $background = null, private readonly HAlign $align = HAlign::Left, private readonly string $leftBorder = '', private readonly string $rightBorder = '')
static new(string $content = ''): selfCreate a new bar with default styling.
static themed(string $content, \SugarCraft\Dashboard\Foundation\Theme $theme, ?HAlign $align = null): selfCreate a bar styled from a Theme's foreground/background pair.
setSize(int $width, int $height): \SugarCraft\Dashboard\Foundation\SizerSet the allocated dimensions for this bar.
render(): stringRender the bar as a string.
innerSize(): arrayCalculate the natural dimensions of this bar.
withContent(string $content): selfSet the bar content text.
withForeground(?Color $color): selfSet the foreground color.
withBackground(?Color $color): self
withAlign(HAlign $align): self
withBorders(string $left, string $right): self

Bubble final class

A bubble chart component.

MethodSummary
__construct(private ?Color $color = null, private ?Color $gridColor = null, private ?Color $labelColor = null, private ?Color $bgColor = null)
static new(array $points = []): selfCreate a new bubble chart with default styling.
static sample(int $count = 6): selfCreate a sample bubble chart for demonstration.
setSize(int $width, int $height): \SugarCraft\Dashboard\Foundation\SizerSet the allocated dimensions for this bubble chart.
withPoints(array $points): selfSet all data points at once.
withPoint(BubblePoint $point): selfAdd a data point.
addPoint(string $label, float $x, float $y, float $size, ?Color $color = null): selfAdd a point by parameters.
withXRange(float $min, float $max): selfSet explicit bounds.
withYRange(float $min, float $max): selfSet explicit Y range.
withSizeRange(float $min, float $max): selfSet size range.
withShowGrid(bool $show): selfShow or hide grid.
withShowLabels(bool $show): selfShow or hide labels.
withShowLegend(bool $show): selfShow or hide legend.
withShowSizes(bool $show): selfShow or hide bubble sizes.
render(): stringRender the bubble chart as a string.
innerSize(): arrayCalculate the natural dimensions of this bubble chart.
withColor(?Color $color): selfSet the default color.
withGridColor(?Color $color): selfSet the grid color.
withLabelColor(?Color $color): selfSet the label color.
withBgColor(?Color $color): selfSet the background color.

BubblePoint final class

MethodSummary
__construct(public readonly string $label, public readonly float $x, public readonly float $y, public readonly float $size, public readonly ?Color $color = null, public readonly ?string $category = null)
withColor(?Color $color): selfCreate a copy with a different color.

Candlestick final class

MethodSummary
__construct(public readonly string $label, public readonly float $open, public readonly float $high, public readonly float $low, public readonly float $close, public readonly ?Color $color = null)
static bullish(string $label, float $open, float $high, float $low, float $close): self
static bearish(string $label, float $open, float $high, float $low, float $close): self
isBullish(): bool

CandlestickChart final class

A candlestick chart component for financial data visualization.

MethodSummary
__construct(private ?int $maxCandles = null, private ?Color $bullishColor = null, private ?Color $bearishColor = null, private ?Color $wickColor = null, private ?Color $gridColor = null, private ?Color $textColor = null, private ?Color $backgroundColor = null, private string $style = 'rounded')
static new(): selfCreate a new candlestick chart with default styling.
setSize(int $width, int $height): \SugarCraft\Dashboard\Foundation\SizerSet the allocated dimensions for this candlestick chart.
withCandle(Candlestick $candle): selfAdd a candlestick to the chart.
addCandle(string $label, float $open, float $high, float $low, float $close): selfAdd a candlestick by parameters.
withCandles(array $candles): selfSet all candles at once.
withShowGrid(bool $show): selfShow or hide grid.
withShowVolume(bool $show): selfShow or hide volume bars.
withShowLabels(bool $show): selfShow or hide labels.
withPriceRange(float $min, float $max): selfSet fixed price range.
render(): stringRender the candlestick chart as a string.
innerSize(): arrayCalculate the natural dimensions of this candlestick chart.
withBullishColor(?Color $color): selfSet the bullish color.
withBearishColor(?Color $color): selfSet the bearish color.
withWickColor(?Color $color): selfSet the wick color.
withGridColor(?Color $color): selfSet the grid color.
withTextColor(?Color $color): selfSet the text color.
withBackgroundColor(?Color $color): selfSet the background color.
withStyle(string $style): selfSet the border style.

Chart final class

A bar/line chart component with axes, labels, and grid.

MethodSummary
__construct(array $dataPoints = [], private readonly ChartType $type = ChartType::Bar, private readonly ?int $widthConstraint = null, private readonly int $heightConstraint = 10, private readonly bool $showGrid = true, private readonly bool $showValues = false, private readonly bool $showLabels = true, private readonly ?string $xAxisLabel = null, private readonly ?string $yAxisLabel = null, private readonly ?Color $color = null, private readonly ?Color $gridColor = null, private readonly ?Color $labelColor = null)
static new(array $dataPoints = [], ChartType $type = ChartType::Bar): selfCreate a new chart with default styling.
setSize(int $width, int $height): \SugarCraft\Dashboard\Foundation\SizerSet the allocated dimensions for this chart.
render(): stringRenders the chart as a string - PURE (finding sugar-dashboard-192, D-98): every call emits the full frame and the instance never carries frame history, so repeated renders of one chart are byte-identical. Streaming hosts that want delta emission thread a ChartRenderContext through renderDeltaFrame() themselves (DualSampleGraph::frame() is the model: per-call state object, not hidden instance mutation).
innerSize(): arrayCalculate the natural dimensions of this chart.
withDataPoints(array $dataPoints): selfSet the data points.
withType(ChartType $type): selfSet the chart type.
withWidth(int $width): selfSet the width constraint.
withHeight(int $height): selfSet the height constraint.
withGrid(bool $show): selfShow or hide grid lines.
withShowValues(bool $show): selfShow or hide value labels.
withShowLabels(bool $show): selfShow or hide X-axis labels.
withXAxisLabel(?string $label): selfSet the X-axis label.
withYAxisLabel(?string $label): selfSet the Y-axis label.
withColor(?Color $color): selfSet the chart color.
withGridColor(?Color $color): selfSet the grid color.
withLabelColor(?Color $color): selfSet the label color.
with(array $overrides): selfCanonical wither accepting an overrides array.
resetPreviousFrame(): void

ChartBorderStyle trait

Box-drawing border characters for bordered chart components.

ChartDataPoint final readonly class

Data point for charts.

MethodSummary
__construct(public string $label, public float $value)

ChartGridGeometry trait

Shared Y-axis grid math for chart components.

ChartRenderContext final class

Render context for diff-based chart rendering.

MethodSummary
__construct(public ?Buffer $previousFrame = null, public ?int $prevWidth = null, public ?int $prevHeight = null)
static fresh(): selfCreate a fresh context (no previous frame).
withNext(Buffer $frame, int $width, int $height): selfCreate a new context with updated values after render.

ChartType enum

Chart types.

Cases: Bar · Line

PHP also provides cases(), from() and tryFrom().

Donut final class

A donut chart component for displaying proportional data.

MethodSummary
__construct(private readonly array $segments, private readonly int $size = 20, private readonly ?string $centerLabel = null, private readonly ?string $centerValue = null, private readonly ?Color $backgroundColor = null, private readonly bool $showPercentage = false, private readonly float $startAngle = 0.0, private readonly bool $clockwise = true, private readonly ?float $aspect = null, private readonly bool $smoothRim = false, private readonly string $fillStyle = self::FILL_FOREGROUND, private readonly string $renderMode = self::RENDER_FILLED)
static new(array $data): selfCreate a new donut chart with the given data.
static mocha(array $data): selfCreate a donut chart with default Catppuccin Mocha theme colors.
setSize(int $width, int $height): \SugarCraft\Dashboard\Foundation\SizerSet the allocated dimensions for this chart.
innerSize(): arrayCalculate the natural dimensions of this donut chart.
render(): stringRender the donut chart using Unicode block characters.
withSize(int $size): selfSet the chart size.
withCenterLabel(?string $label): selfSet the center label text.
withCenterValue(?string $value): selfSet the center value text.
withShowPercentage(bool $show): selfShow percentage in center.
withStartAngle(float $angle): selfSet the start angle in degrees.
withAspect(float $ratio = self::DEFAULT_ASPECT): selfSet the aspect-ratio correction applied to the vertical cell axis.
withSmoothRim(bool $on = true): selfSupersample the annulus boundary with quadrant-block runes.
withFillStyle(string $style = self::FILL_FOREGROUND): selfChoose how filled ring cells are painted.
withRenderMode(string $mode = self::RENDER_FILLED): selfChoose the chart's render mode.

DotMatrix final class

A dot matrix display component.

MethodSummary
__construct(string $content, private readonly int $cellSize = 1, private readonly bool $showFrame = false, private readonly ?Color $onColor = null, private readonly ?Color $offColor = null)
static new(string $content): selfCreate a new dot matrix display with default styling.
setSize(int $width, int $height): \SugarCraft\Dashboard\Foundation\SizerSet the allocated dimensions for this display.
render(): stringRender the dot matrix display.
innerSize(): arrayCalculate the natural dimensions of this display.
withCellSize(int $size): selfSet the cell size (scale factor for each dot).
withShowFrame(bool $show): selfShow or hide the frame.
withOnColor(?Color $color): selfSet the "on" (lit) dot color.
withOffColor(?Color $color): selfSet the "off" (unlit) dot color.
withContent(string $content): selfSet new content.

Funnel final class

A funnel chart component.

MethodSummary
__construct(private ?Color $color = null, private ?Color $borderColor = null, private ?Color $labelColor = null, private ?Color $valueColor = null)
static new(array $stages = []): selfCreate a new funnel chart with default styling.
static sample(int $stages = 5): selfCreate a sample funnel chart for demonstration.
setSize(int $width, int $height): \SugarCraft\Dashboard\Foundation\SizerSet the allocated dimensions for this funnel chart.
withStages(array $stages): selfSet all stages at once.
withStage(FunnelStage $stage): selfAdd a stage.
addStage(string $label, float $value, ?Color $color = null): selfAdd a stage by parameters.
withShowLabels(bool $show): selfShow or hide labels.
withShowValues(bool $show): selfShow or hide values.
withShowPercentages(bool $show): selfShow or hide percentages.
withCentered(bool $centered): selfCenter align the funnel.
withStyle(string $style): selfSet the border style.
render(): stringRender the funnel chart as a string.
innerSize(): arrayCalculate the natural dimensions of this funnel chart.
withColor(?Color $color): selfSet the default color.
withBorderColor(?Color $color): selfSet the border color.
withLabelColor(?Color $color): selfSet the label color.
withValueColor(?Color $color): selfSet the value color.

FunnelChart final class

A funnel chart component for displaying conversion flows.

MethodSummary
__construct(private readonly array $stages, private readonly bool $horizontal = false, private readonly bool $showValues = true, private readonly bool $showPercentages = true, private readonly ?Color $defaultColor = null)
static new(array $stages): selfCreate a new funnel chart.
setSize(int $width, int $height): \SugarCraft\Dashboard\Foundation\SizerSet the allocated dimensions for this chart.
innerSize(): arrayCalculate the natural dimensions of this funnel chart.
render(): stringRender the funnel chart.
withHorizontal(bool $horizontal): selfSet horizontal orientation.
withShowValues(bool $show): selfShow or hide values.
withShowPercentages(bool $show): selfShow or hide percentages.

FunnelStage final readonly class

A stage in a funnel chart.

MethodSummary
__construct(public string $label, public float $value, public ?Color $color = null)
withColor(?Color $color): selfCreate a copy with a different color.

Gauge final class

A horizontal progress bar / gauge component.

MethodSummary
__construct(float $ratio, private readonly ?int $widthConstraint = null, private readonly bool $showPercentage = true, private readonly ?Color $filledColor = null, private readonly ?Color $emptyColor = null, private readonly string $filledChar = '█', private readonly string $emptyChar = '░')
static new(float $ratio): selfCreate a new gauge with default styling.
setSize(int $width, int $height): \SugarCraft\Dashboard\Foundation\SizerSet the allocated dimensions for this gauge.
render(): stringRender the gauge as a string.
innerSize(): arrayCalculate the natural dimensions of this gauge.
withWidth(int $width): selfSet the width constraint (number of bar characters).
withPercentage(bool $show): selfShow or hide the percentage label.
withFilledColor(?Color $color): selfSet the color for the filled portion.
withEmptyColor(?Color $color): selfSet the color for the empty portion.
withChars(string $filled, string $empty): selfSet custom characters for filled and empty portions.
withRatio(float $ratio): selfSet a new ratio value.

GaugeChart final class

A gauge chart component for displaying a single value within a range.

MethodSummary
__construct(private readonly float $value = 0.0, private readonly float $min = 0.0, private readonly float $max = 100.0, private readonly ?Color $color = null, private readonly bool $showValue = true, private readonly bool $showLabel = false, private readonly ?string $label = null, private readonly string $format = 'value')
static new(float $value = 0.0, float $min = 0.0, float $max = 100.0): selfCreate a new gauge chart.
static percent(float $value): selfCreate a percentage gauge (0-100%).
static cpu(float $usage): selfCreate a CPU-style gauge.
setSize(int $width, int $height): \SugarCraft\Dashboard\Foundation\SizerSet the allocated dimensions for this gauge.
render(): stringRender the gauge.
innerSize(): arrayCalculate the natural dimensions of this gauge.
withValue(float $value): selfSet the value.
withRange(float $min, float $max): selfSet the min/max range.
withColor(?Color $color): selfSet the color.
withFormat(string $format): selfSet the format.
withLabel(?string $label): selfSet the label.

GaugeCircle final class

A circular gauge component (speedometer style).

MethodSummary
__construct(float $ratio, private readonly int $radius = 6, private readonly bool $showNeedle = true, private readonly bool $showTicks = true, private readonly bool $showLabel = true, private readonly ?Color $arcColor = null, private readonly ?Color $needleColor = null, private readonly ?Color $labelColor = null, private readonly ?float $aspect = null, private readonly bool $smoothRim = false)
static new(float $ratio): selfCreate a new circular gauge with default styling.
setSize(int $width, int $height): \SugarCraft\Dashboard\Foundation\SizerSet the allocated dimensions for this gauge.
render(): stringRender the circular gauge.
innerSize(): arrayCalculate the natural dimensions of this gauge.
withRadius(int $radius): selfSet the radius of the gauge (the no-allocation fallback size).
withShowNeedle(bool $show): selfShow or hide the needle.
withShowTicks(bool $show): selfShow or hide tick marks.
withShowLabel(bool $show): selfShow or hide the percentage label.
withPercentage(bool $show): selfShow or hide the percentage label (alias for withShowLabel).
withRatio(float $ratio): selfSet the ratio value.
withArcColor(?Color $color): selfSet the arc color.
withNeedleColor(?Color $color): selfSet the needle color.
withLabelColor(?Color $color): selfSet the label color.
withAspect(float $ratio = self::DEFAULT_ASPECT): selfCorrect the 2:1 terminal-cell squash so the dial reads visually round.
withSmoothRim(bool $on = true): selfSupersample the arc rim with quadrant-block runes.

GaugeWithDetail final class

A horizontal gauge bar with detail text overlaid in the center.

MethodSummary
__construct(string $label = '', private readonly float $value = 0, private readonly float $max = 100, string $detail = '', private readonly int $widthConstraint = 40)
static new(string $label = '', float $value = 0, float $max = 100, string $detail = '', int $width = 40): selfCreate a new gauge with detail overlay.
setSize(int $width, int $height): \SugarCraft\Dashboard\Foundation\SizerSet the allocated dimensions for this gauge.
render(): stringRender the gauge with detail overlay as a string.
innerSize(): arrayCalculate the natural dimensions of this gauge.
withValue(float $value): selfSet the current value.
withMax(float $max): selfSet the maximum value.
withDetail(string $detail): selfSet the detail text.
withWidth(int $width): selfSet the width constraint.
withLabel(string $label): selfSet the label text.

HeatMapChart final class

A heatmap component for displaying data intensity in a grid format.

MethodSummary
__construct(private readonly array $data, private readonly ?array $rowLabels = null, private readonly ?array $columnLabels = null, private readonly ?Color $lowColor = null, private readonly ?Color $highColor = null, private readonly string $scale = 'sequential', private readonly bool $showLabels = true, private readonly int $cellWidth = 1, private readonly int $cellHeight = 1)
static new(array $data): selfCreate a new heatmap.
static sample(int $rows = 5, int $cols = 7): selfCreate a sample heatmap for demonstration.
setSize(int $width, int $height): \SugarCraft\Dashboard\Foundation\SizerSet the allocated dimensions for this heatmap.
render(): stringRender the heatmap.
innerSize(): arrayCalculate the natural dimensions of this heatmap.
withRowLabels(?array $labels): selfSet row labels.
withColumnLabels(?array $labels): selfSet column labels.
withScale(string $scale): selfSet the color scale.
withLowColor(?Color $color): selfSet the low color.
withHighColor(?Color $color): selfSet the high color.
withShowLabels(bool $show): selfShow or hide labels.

Heatmap final class

A heat map visualization component.

MethodSummary
__construct(private readonly array $data, private readonly bool $showLegend = true, private readonly bool $showValues = false, private readonly ?Color $lowColor = null, private readonly ?Color $highColor = null, private readonly string $rowLabelFormat = '', private readonly string $colLabelFormat = '')
static new(array $data): selfCreate a new heat map with default styling.
static sample(int $rows = 5, int $cols = 7): selfCreate a sample heat map for demonstration.
setSize(int $width, int $height): \SugarCraft\Dashboard\Foundation\SizerSet the allocated dimensions for this heat map.
render(): stringRender the heat map.
innerSize(): arrayCalculate the natural dimensions of this heat map.
dataDimensions(): arrayGet the dimensions of the data grid.
getDataDimensions(): arrayBC forwarder for the pre-rename accessor name.
minValue(): floatGet the minimum value in the data.
getMinValue(): floatBC forwarder for the pre-rename accessor name.
maxValue(): floatGet the maximum value in the data.
getMaxValue(): floatBC forwarder for the pre-rename accessor name.
withLegend(bool $show): selfShow or hide the legend.
withValues(bool $show): selfShow or hide cell values.
withLowColor(?Color $color): selfSet the low (cold) color.
withHighColor(?Color $color): selfSet the high (hot) color.
withRowLabelFormat(string $format): selfSet the row label format.
withColLabelFormat(string $format): selfSet the column label format.

HeatmapColorScale trait

Value clamping and low→high color ramp for heatmap renderers.

Meter final class

An analog-style meter/gauge component.

MethodSummary
__construct(float $ratio, private readonly int $meterHeight = 12, private readonly int $meterWidth = 5, private readonly bool $showNeedle = true, private readonly bool $showScale = true, private readonly bool $showLabel = true, private readonly ?Color $meterColor = null, private readonly ?Color $needleColor = null, private readonly ?Color $scaleColor = null)
static new(float $ratio): selfCreate a new analog meter with default styling.
setSize(int $width, int $height): \SugarCraft\Dashboard\Foundation\SizerSet the allocated dimensions for this meter.
render(): stringRender the analog meter.
innerSize(): arrayCalculate the natural dimensions of this meter.
withHeight(int $height): selfSet the meter height.
withWidth(int $width): selfSet the meter width. The analog face keeps its 3-column minimum; the position-mode bar honours the request down to 1 cell, since btop sizes meters to whatever columns remain (a 1-2 cell bar is legal there).
withShowNeedle(bool $show): selfShow or hide the needle.
withShowScale(bool $show): selfShow or hide the scale marks.
withShowLabel(bool $show): selfShow or hide the percentage label.
withRatio(float $ratio): selfSet the ratio value.
withMeterColor(?Color $color): selfSet the meter body color.
withNeedleColor(?Color $color): selfSet the needle color.
withScaleColor(?Color $color): selfSet the scale color.
withGradient(array $stops, bool $positionWise = false): selfAttach a value→color ramp, expanded once into btop's 101-entry memo by Gradient101::expand() (truncating integer law).
withoutGradient(): selfDetach the ramp; the meter returns to its flat analog face.
withGlyph(string $glyph = '■'): selfGlyph for every position-mode bar cell (filled and tail alike, as in btop where both are Symbols::meter). Defaults to ■ (U+25A0).
withInvert(bool $invert = true): selfFlip the ramp direction in position mode (btop's invert): the leftmost cell takes the ramp's high end — e.g. a discharging battery.
withMeterBg(?Color $color): selfColor of the unfilled tail in position mode. Null restores btop's default theme meter_bg (#40 → #404040).
gradient(): ?array
positionWise(): bool
glyph(): string
invert(): bool
meterBg(): Color
static cacheKey(array $stops, int $width, bool $invert, string $glyph = '■', ?Color $meterBg = null): stringMemo key for one position-mode bar shape. Two meters with equal keys render byte-identical strings for every value, so they share one 101-slot memo row.
static memoStats(): arrayMemo diagnostics: distinct bar shapes held, rendered rows across them, and lookup hits/misses since the last resetMemo().
static resetMemo(): voidDrop every memoized bar and zero the hit/miss counters.

OHLC final class

An OHLC (Open-High-Low-Close) chart component for financial data.

MethodSummary
__construct(private ?Color $bullishColor = null, private ?Color $bearishColor = null, private ?Color $gridColor = null, private ?Color $textColor = null, private ?Color $backgroundColor = null)
static new(): selfCreate a new OHLC chart with default styling.
setSize(int $width, int $height): \SugarCraft\Dashboard\Foundation\SizerSet the allocated dimensions for this OHLC chart.
withPoint(OHLCPoint $point): selfAdd an OHLC point.
addPoint(string $label, float $open, float $high, float $low, float $close): selfAdd an OHLC point by parameters.
withPoints(array $points): selfSet all points at once.
withShowGrid(bool $show): selfShow or hide grid.
withShowLabels(bool $show): selfShow or hide labels.
withPriceRange(float $min, float $max): selfSet fixed price range.
withStyle(string $style): selfSet the border style.
render(): stringRender the OHLC chart as a string.
innerSize(): arrayCalculate the natural dimensions of this OHLC chart.
withBullishColor(?Color $color): selfSet the bullish color.
withBearishColor(?Color $color): selfSet the bearish color.
withGridColor(?Color $color): selfSet the grid color.
withTextColor(?Color $color): selfSet the text color.
withBackgroundColor(?Color $color): selfSet the background color.

OHLCPoint final readonly class

MethodSummary
__construct(public string $label, public float $open, public float $high, public float $low, public float $close, public ?Color $color = null)
static bullish(string $label, float $open, float $high, float $low, float $close): self
static bearish(string $label, float $open, float $high, float $low, float $close): self
isBullish(): bool
range(): float
getRange(): floatBC forwarder for the pre-rename accessor name.
bodySize(): float
getBodySize(): floatBC forwarder for the pre-rename accessor name.

Partition final class

A Partition chart component for hierarchical proportional visualization.

MethodSummary
__construct(private ?Color $segmentColor = null, private ?Color $borderColor = null, private ?Color $textColor = null)
static new(): selfCreate a new partition chart with default styling.
static sample(): selfCreate a sample partition chart for demonstration.
setSize(int $width, int $height): \SugarCraft\Dashboard\Foundation\SizerSet the allocated dimensions for this partition chart.
withRoot(PartitionSegment $root): selfSet the root segment.
withShowLabels(bool $show): selfShow or hide labels.
withShowValues(bool $show): selfShow or hide values.
withHorizontal(bool $horizontal): selfUse horizontal layout (icicle top-down).
withStyle(string $style): selfSet the border style.
render(): stringRender the partition chart as a string.
innerSize(): arrayCalculate the natural dimensions of this partition chart.
withSegmentColor(?Color $color): selfSet the default segment color.
withBorderColor(?Color $color): selfSet the border color.
withTextColor(?Color $color): selfSet the text color.

PartitionSegment final class

MethodSummary
__construct(public readonly string $id, public readonly string $label, public readonly float $value, public readonly ?Color $color = null)
withChildren(array $children): self
withColor(?Color $color): self
totalValue(): float
getTotalValue(): floatBC forwarder for the pre-rename accessor name.
depth(): int
getDepth(): intBC forwarder for the pre-rename accessor name.

PriceAxisProjection trait

Maps a price onto a chart row for the financial chart pair.

Progress final class

A multi-segment progress bar component.

MethodSummary
__construct(array $segments, private readonly bool $showLabels = true, private readonly bool $showPercentages = true, private readonly string $segmentSeparator = '')
static new(float $ratio): selfCreate a new progress bar with default styling.
static segmented(array $segments): selfCreate a multi-segment progress bar.
setSize(int $width, int $height): \SugarCraft\Dashboard\Foundation\SizerSet the allocated dimensions for this progress bar.
render(): stringRender the progress bar as a string.
innerSize(): arrayCalculate the natural dimensions of this progress bar.
withSegments(array $segments): selfSet the segments.
withShowLabels(bool $show): selfShow or hide segment labels.
withShowPercentages(bool $show): selfShow or hide percentages.
withWidth(int $width): selfSet the width.

ProgressRing final class

A circular progress ring component.

MethodSummary
__construct(float $ratio, private readonly int $radius = 4, private readonly bool $showPercentage = true, private readonly ?Color $filledColor = null, private readonly ?Color $emptyColor = null)
static new(float $ratio): selfCreate a new progress ring with default styling.
setSize(int $width, int $height): \SugarCraft\Dashboard\Foundation\SizerSet the allocated dimensions for this ring.
render(): stringRender the progress ring as a string.
innerSize(): arrayCalculate the natural dimensions of this ring.
withRadius(int $radius): selfSet the radius of the ring.
withPercentage(bool $show): selfShow or hide the percentage label.
withRatio(float $ratio): selfSet the ratio value.
withFilledColor(?Color $color): selfSet the color for the filled portion.
withEmptyColor(?Color $color): selfSet the color for the empty portion.

RadarChart final class

A radar/spider chart component for displaying multi-axis data.

MethodSummary
__construct(private readonly array $labels, private readonly array $series, private readonly int $size = 20, private readonly int $gridLines = 4, private readonly float $maxValue = 1.0, private readonly bool $showLabels = true, private readonly bool $showGrid = true, private readonly bool $showDots = true)
static new(array $labels, array $series): selfCreate a new radar chart.
setSize(int $width, int $height): \SugarCraft\Dashboard\Foundation\SizerSet the allocated dimensions for this chart.
innerSize(): arrayCalculate the natural dimensions of this radar chart.
render(): stringRender the radar chart.
withSize(int $size): selfSet the chart size.
withGridLines(int $lines): selfSet the number of grid lines.
withMaxValue(float $max): selfSet the maximum value for the scale.
withShowLabels(bool $show): selfShow or hide axis labels.
withShowGrid(bool $show): selfShow or hide grid lines.
withShowDots(bool $show): selfShow or hide data point dots.

SparkArea final class

A spark area chart - minimal area chart for inline use.

MethodSummary
__construct(private readonly array $values, private readonly int $chartHeight = 3, private readonly ?Color $color = null, private readonly bool $showMinMax = false, private readonly bool $gradient = true)
static new(array $values): selfCreate a new spark area.
setSize(int $width, int $height): \SugarCraft\Dashboard\Foundation\SizerSet the allocated dimensions for this spark area.
innerSize(): arrayCalculate the natural dimensions of this spark area.
render(): stringRender the spark area.
withHeight(int $height): selfSet the chart height.
withColor(?Color $color): selfSet the color.
withShowMinMax(bool $show): selfShow min/max markers.
withGradient(bool $gradient): selfEnable gradient fill.

Sparkline final class

An inline sparkline chart component using 8-block Unicode scaling.

MethodSummary
__construct(private int $widthConstraint = 40, private int $height = 1, private bool $showDataPoints = false, private bool $fill = false, private bool $dimEdge = false)
static new(int $width = 40): selfCreate a new sparkline with default styling.
push(float $value): selfPush a value onto the sparkline buffer.
pushAll(array $values): selfPush multiple values onto the sparkline buffer.
setSize(int $width, int $height): \SugarCraft\Dashboard\Foundation\SizerSet the allocated dimensions for this sparkline.
render(): stringRender the sparkline as a string.
innerSize(): arrayCalculate the natural dimensions of this sparkline.
withWidth(int $width): selfSet the width constraint.
withHeight(int $height): selfSet the height.
withDataPoints(bool $show): selfShow or hide data point markers.
withFill(bool $fill): selfEnable or disable area fill.
withDimEdge(bool $dim): selfEnable or disable dim-edge padding.

SparklineArea final class

An area-style sparkline chart component.

MethodSummary
__construct(array $data = [], private readonly ?int $widthConstraint = null, private readonly int $height = 3, private readonly bool $showLine = true, private readonly bool $showFill = true, private readonly ?Color $lineColor = null, private readonly ?Color $fillColor = null, private readonly ?Color $maxColor = null, private readonly ?Color $minColor = null)
static new(array $data = []): selfCreate a new area sparkline with default styling.
setSize(int $width, int $height): \SugarCraft\Dashboard\Foundation\SizerSet the allocated dimensions for this sparkline.
render(): stringRender the area sparkline as a string.
innerSize(): arrayCalculate the natural dimensions of this sparkline.
withData(array $data): selfSet the data points.
withWidth(int $width): selfSet the width constraint.
withHeight(int $height): selfSet the height.
withShowLine(bool $show): selfShow or hide the line.
withShowFill(bool $show): selfShow or hide the fill.
withLineColor(?Color $color): selfSet the line color.
withFillColor(?Color $color): selfSet the fill color.
withMaxColor(?Color $color): selfSet the maximum value color.
withMinColor(?Color $color): selfSet the minimum value color.

SparklineBar final class

A bar-style sparkline chart component.

MethodSummary
__construct(array $data = [], private readonly ?int $widthConstraint = null, private readonly int $height = 8, private readonly bool $showValues = false, private readonly ?Color $color = null, private readonly ?Color $maxColor = null, private readonly ?Color $minColor = null, private readonly bool $showBarGaps = true, private readonly string $separator = ' ')
static new(array $data = []): selfCreate a new bar sparkline with default styling.
setSize(int $width, int $height): \SugarCraft\Dashboard\Foundation\SizerSet the allocated dimensions for this sparkline.
render(): stringRender the bar sparkline as a string.
innerSize(): arrayCalculate the natural dimensions of this sparkline.
withData(array $data): selfSet the data points.
withWidth(int $width): selfSet the width constraint.
withHeight(int $height): selfSet the height.
withShowValues(bool $show): selfShow or hide numeric values below bars.
withColor(?Color $color): selfSet the main color.
withMaxColor(?Color $color): selfSet the maximum value color.
withMinColor(?Color $color): selfSet the minimum value color.
withBarGaps(bool $show): selfShow or hide gaps between bars.
withSeparator(string $separator): selfSet the separator between bars.

SparklineScaling trait

Width resolution and data resampling for sparkline renderers.

Waterfall final class

A waterfall chart component for visualizing cumulative changes.

MethodSummary
__construct(private ?int $maxItems = null, private ?Color $positiveColor = null, private ?Color $negativeColor = null, private ?Color $totalColor = null, private ?Color $subtotalColor = null, private ?Color $gridColor = null, private ?Color $textColor = null, private ?Color $backgroundColor = null, private string $style = 'rounded')
static new(): selfCreate a new waterfall chart with default styling.
setSize(int $width, int $height): \SugarCraft\Dashboard\Foundation\SizerSet the allocated dimensions for this waterfall chart.
withItem(WaterfallItem $item): selfAdd an item to the chart.
addItem(string $label, float $value, WaterfallBarType $type = WaterfallBarType::Positive): selfAdd an item by parameters.
withItems(array $items): selfSet all items at once.
withShowConnectors(bool $show): selfShow or hide connector lines.
withShowGrid(bool $show): selfShow or hide grid.
withValueRange(float $min, float $max): selfSet fixed min/max values.
render(): stringRender the waterfall chart as a string.
innerSize(): arrayCalculate the natural dimensions of this waterfall chart.
withPositiveColor(?Color $color): selfSet the positive color.
withNegativeColor(?Color $color): selfSet the negative color.
withTotalColor(?Color $color): selfSet the total color.
withSubtotalColor(?Color $color): selfSet the subtotal color.
withGridColor(?Color $color): selfSet the grid color.
withTextColor(?Color $color): selfSet the text color.
withBackgroundColor(?Color $color): selfSet the background color.
withStyle(string $style): selfSet the border style.

WaterfallBarType enum

Cases: Positive · Negative · Total · Subtotal

PHP also provides cases(), from() and tryFrom().

WaterfallItem final class

MethodSummary
__construct(public readonly string $label, public readonly float $value, public readonly WaterfallBarType $type = WaterfallBarType::Positive, public readonly ?Color $color = null)
static positive(string $label, float $value): self
static negative(string $label, float $value): self
static total(string $label, float $value): self
static subtotal(string $label, float $value): self

WordCloud final class

A word cloud component for displaying text frequency.

MethodSummary
__construct(private readonly array $words, private readonly int $maxWords = 20, private readonly bool $shuffle = true, private readonly bool $showWeights = false, private readonly array $colors = [])
static new(array $words): selfCreate a new word cloud.
setSize(int $width, int $height): \SugarCraft\Dashboard\Foundation\SizerSet the allocated dimensions for this word cloud.
innerSize(): arrayCalculate the natural dimensions of this word cloud.
render(): stringRender the word cloud.
withMaxWords(int $max): selfSet max words to display.
withShuffle(bool $shuffle): selfSet shuffle behavior.
withShowWeights(bool $show): selfShow weight values.
withColors(array $colors): selfSet colors.

SugarCraft\Dashboard\Plot\Graph

AxisPosition enum

Graph axis labels position.

Cases: Left · Right · Both

PHP also provides cases(), from() and tryFrom().

Graph final class

A graph/chart component for displaying data visualizations.

MethodSummary
__construct(private readonly ?int $maxDataPoints = null, private GraphType $graphType = GraphType::Line, private ?Color $lineColor = null, private ?Color $gridColor = null, private ?Color $textColor = null, private ?Color $backgroundColor = null, private string $style = 'rounded')
static new(): selfCreate a new graph with default styling.
setSize(int $width, int $height): \SugarCraft\Dashboard\Foundation\SizerSet the allocated dimensions for this graph.
withData(array $data): selfSet the data for a single series.
withSeries(string $label, array $data, ?Color $color = null): selfAdd a data series.
withLabels(array $labels): selfSet axis labels.
withValueRange(float $min, float $max): selfSet fixed min/max values.
withShowGrid(bool $show): selfShow or hide grid.
withShowLegend(bool $show): selfShow or hide legend.
render(): stringRender the graph as a string.
innerSize(): arrayCalculate the natural dimensions of this graph.
withGraphType(GraphType $type): selfSet the graph type.
withLineColor(?Color $color): selfSet the line color.
withGridColor(?Color $color): selfSet the grid color.
withTextColor(?Color $color): selfSet the text color.
withBackgroundColor(?Color $color): selfSet the background color.
withStyle(string $style): selfSet the border style.

GraphType enum

Graph types.

Cases: Line · Bar · Area · Scatter

PHP also provides cases(), from() and tryFrom().

SugarCraft\Dashboard\Plot\ProcRow

ProcColumns final class

Column widths of a btop process row:

MethodSummary
static new(int $prog, int $cmd, int $threads, int $user, bool $cpuGraphs = true): self
static btop(int $boxWidth, bool $cpuGraphs = true): selfbtop's widths for a proc box $boxWidth cells wide (borders included). The rows then fill $boxWidth - 2 cells, except below 56 columns where btop's own arithmetic leaves one cell unwritten — the composer pads that slack.
width(): intCells one row occupies, separators included.

ProcGraphTracker final class

Per-pid lifecycle of the 5×1 cpu mini-graphs in a process list.

MethodSummary
static new(int $width = ProcColumns::GRAPH, string $family = DualSampleGraph::FAMILY_BRAILLE): self
static sample(float $cpu): intbtop's sample law for the mini-graph: anything in [0.1, 5) is lifted to 5 so a barely-busy process still shows the lowest band (band 1 starts at 5 on a one-row graph); everything else is round(cpu).
observe(int $pid, float $cpu): selfRecord one fresh cpu reading for a drawn row.
retain(iterable $livePids): selfKeep only the listed pids (btop's periodic dead-process sweep).
has(int $pid): bool
graph(int $pid): ?DualSampleGraph
idleCount(int $pid): ?intConsecutive idle samples so far, or null when the pid has no graph.
pids(): array
count(): int
width(): int
family(): string

ProcRow final class

One process as the proc-list row composer sees it — only the fields btop's normal (non-tree) row prints or colors by.

MethodSummary
static new(int $pid, string $name, string $cmd = '', int $threads = 1, string $user = '', float $cpu = 0.0, float $memPercent = 0.0, ?string $memLabel = null): self

ProcRowComposer final class

Composes one btop process-list row (normal, non-tree view):

MethodSummary
static new(int $width): self
withWidth(int $width, bool $cpuGraphs = true): selfRe-derive btop's widths for a new inner width.
withColumns(ProcColumns $columns): selfCaller-owned layout; slack right of the cpu column is padded.
withPalette(ProcRowPalette $palette): self
withProcColors(bool $on): selfbtop proc_colors: value-colored cpu/name, mem and threads.
withProcGradient(bool $on): selfbtop proc_gradient: distance fade of text and metric colors.
withFamily(string $family): selfGraph family whose graph_bg glyph underlays rows without a graph (a row with a graph uses that graph's own family).
width(): int
columns(): ProcColumns
palette(): ProcRowPalette
procColors(): bool
procGradient(): bool
family(): string
row(ProcRow $proc, int $row, int $selected, int $selectMax, ?DualSampleGraph $graph = null, bool $followed = false, ?ColorProfile $profile = null): stringRender one row.
static cpuLabel(float $cpu): stringbtop's cpu% text before right-justifying: {:.2f} cut to 3 chars below 10 and in [100, 1000) ("5.6", "100"), kept whole in between ("12.34", which the 4-wide column then cuts to "12.3"), and above 10 000 scaled to thousands with a "k" ("12k"). The cut is a truncation, not a rounding, as btop's string resize is.
static memLabel(float $percent): stringbtop's mem% text: "0%" under 0.01, else {:.1f} cut to 3 chars, trailing "." dropped.
static threadsLabel(int $threads): stringbtop shortens five-digit thread counts to thousands: 12345 → "12K".
static userLabel(string $user, int $width): stringbtop marks a cut user name with a trailing "+" inside the column.

ProcRowPalette final class

The theme slots a process row reads: three flat colors for text and underlay, two highlight pairs (selected / followed), and the three 101-entry ramps of the distance fade.

MethodSummary
static new(Color $mainFg, Color $inactiveFg, array $processStops, Color $selectedBg, Color $selectedFg, ?Color $followedBg = null, ?Color $followedFg = null): self
static btop(): selfbtop's built-in Default theme.
withRamps(array $proc, array $procColor, array $process): selfReplace the three ramps with pre-expanded ones.
withSelected(Color $bg, Color $fg): self
withFollowed(Color $bg, Color $fg): self

SugarCraft\Dashboard\Plugin

Discovery final class

Discovers plugins in the plugin directory.

MethodSummary
static scan(string $directory): arrayDiscover plugins in a directory.
static defaultDirectory(): ?stringGet the default plugin directory.
static scanDefault(): arrayDiscover plugins in the default directory.

ExternalModule final class

Wraps an external binary as a Module.

MethodSummary
__construct(private readonly string $name, private readonly string $command, private readonly array $args = [])
name(): stringGet the module name.
init(): arrayInitialize the module.
update(array $state): arrayUpdate the module state.
view(array $state, int $width, int $height): stringRender the module view.
minSize(): arrayGet the minimum size required by this module.
__destruct()Destructor to clean up the process.

PluginSdk abstract class

Plugin SDK for authoring plugins in PHP.

MethodSummary
static final run(?callable $handler = null): neverRun the plugin as the main loop of its own process.

Request final class

Request DTO for plugin communication.

MethodSummary
__construct(public readonly string $type, public readonly array $data = [])
static init(): selfCreate an init request.
static update(array $state): selfCreate an update request.
static view(int $width, int $height, array $state): selfCreate a view request.
static fromJson(string $json): selfCreate from JSON string.
toJson(): stringConvert to JSON string.
verb(): ?VerbThe parsed verb at the boundary: null for foreign/unknown labels (which still travel as strings so the host can quote them).

Response final class

Response DTO for plugin communication.

MethodSummary
__construct(public readonly string $type, public readonly array $data = [])
static init(string $name, array $minSize, int $interval = 0): selfCreate an init response.
static update(array $state): selfCreate an update response.
static view(string $content): selfCreate a view response.
static error(string $message): selfCreate an error response.
static fromJson(string $json): selfCreate from JSON string.
toJson(): stringConvert to JSON string.
verb(): ?VerbThe parsed verb at the boundary; null for foreign/unknown labels, which still travel as strings so either side can quote them.

Verb enum

The plugin wire vocabulary (sugar-dashboard-103).

Cases: Init · Update · View · Error

PHP also provides cases(), from() and tryFrom().

Wire final class

Shared doctrine of the plugin wire: the printable-preview budget and the minSize validation/clamp ladder (sugar-dashboard-199 dedup).

MethodSummary
static preview(string $raw): stringPrintable, length-clipped rendering of an unparsable wire line.
static clampMinSize(mixed $minSize): arrayValidate and clamp a plugin-supplied minSize to a safe default. Must be a two-element array of positive integers; otherwise the fallback placeholder.

SugarCraft\Dashboard\Position

Center final class

ANSI-aware centering calculations.

MethodSummary
static calculateOffsetX(string $content, int $width): intCalculate the horizontal offset to center content.
static calculateOffsetY(int $contentHeight, int $height): intCalculate the vertical offset to center content.
static measureRenderedView(string $content): arrayMeasure the rendered view dimensions.
static center(string $content, int $width, int $height): stringCenter content within given dimensions.

Overlay final class

Auto-positioning helper for overlays.

MethodSummary
static calculate(int $overlayWidth, int $overlayHeight, int $anchorX, int $anchorY, int $containerWidth, int $containerHeight): arrayPosition an overlay relative to an anchor.
static fitsBelow(int $overlayHeight, int $anchorY, int $containerHeight): boolCheck if overlay would fit below anchor.
static fitsAbove(int $overlayHeight, int $anchorY): boolCheck if overlay would fit above anchor.

SugarCraft\Dashboard\Registry

Constructor interface

Type alias for module constructors.

Registry final class

Instance registry for module constructors.

MethodSummary
register(string $name, callable $constructor): voidRegister a module constructor.
get(string $name): callableGet a module factory by name.
has(string $name): boolCheck if a module is registered.
list(): arrayList all registered module names.
reset(): voidEmpty this registry (host teardown; scratch registries in tests).

SugarCraft\Dashboard\State

Persistence final class

Atomic persistence for dashboard panel/tab state.

MethodSummary
save(string $path, array $data): voidSave state atomically: write to temp file then rename to target.
load(string $path): ?arrayLoad persisted state from disk.

SugarCraft\Dashboard\Support

DurationFormat final class

The one clock-face renderer for non-negative durations.

MethodSummary
static hms(int $totalSeconds, ?int $hundredths = null): stringPaint $totalSeconds (>= 0) as H:MM:SS, or MM:SS below an hour.

ListWindow final class

Scroll-window arithmetic for vertically listed items.

MethodSummary
static scrollTop(int $selected, int $height, int $total): intFirst visible index for the given active row, visible height, and total item count.

Troubleshooting

render() returns Loading... instead of the grid

A grid draws nothing until setSize() has been called with a non-zero width and height. setSize() returns a sized copy and leaves the receiver alone, so keep the result. Call it again whenever the terminal is resized.

$grid = $grid->setSize($cols, $rows);
echo $grid->render();

Items added to a grid never appear

withItem() clones the grid and returns the clone, so the receiver never gains the item. A call whose return value is discarded adds nothing. Assign each result, or chain the calls, as the Quickstart does.

A multi-column grid shows one column

StackedGrid stacks every item into a single column when the width is under 90 cells. That threshold is the default of Breakpoint::narrow(), and the grid does not pass another value. Widen the terminal, or show fewer items when the width is narrow.

A meter reads full for a value such as 62

Meter::new() takes a ratio from 0 to 1, not a percentage, and its constructor clamps the ratio into that range. Meter::new(62) is therefore a full bar. Pass the fraction instead.

use SugarCraft\Dashboard\Plot\Chart\Meter;

echo Meter::new(0.62)->withWidth(20)->render(), "\n";

Upstream mapping

Most of the btop-derived code cites its source in the class docblock, as Mirrors aristocratos/btop, and the rest name the project they were adapted from.

  • Plot\Braille\DualSampleGraph: btop Draw::Graph
  • Plot\Chart\Meter: btop Draw::Meter
  • Plot\Gradient101, Foundation\GradientStore: btop Theme::generateGradients and Theme::g
  • Foundation\NetAutoScale: btop network-graph ceiling
  • Plot\DistanceFade, Plot\ProcRow\ProcRowComposer: btop process-list distance fade and row layout
  • Keys\KeyRegistry: teautils KeyRegistry
  • Keys\KeyMap: the keymap handling in bubble-keymap, adapted to PHP

Changelog and versioning

The package has no separate changelog file and no release tag yet, so it publishes only dev-master. Its history is the commit log of the sugar-dashboard/ directory in the monorepo, at github.com/detain/sugarcraft/commits/master/sugar-dashboard. Most of the deprecated symbols in src/ carry a REMOVED-IN: 2.0.0 marker in their docblock, so they go in 2.0.0. The exceptions are Module\LegacyModule, which names only v0.x, and the ALIGN_* string constants on Components\Card\Footer, which name no version. Do not plan the removal of either for 2.0.0 until a release says so.

Demos.

VHS-recorded GIFs for the library's examples. Regenerated automatically on every push that touches the source.

Layout & Structure

StackedGrid

StackedGrid

Multi-column stacked grid layout.
GridLayout

GridLayout

CSS Grid-style layout.
FlexLayout

FlexLayout

Flexbox-style layout.
VStack

VStack

Vertical stack with alignment.
HStack

HStack

Horizontal stack with spacing.
ZStack

ZStack

Layered stack.
Stack

Stack

Basic vertical stack.
Frame

Frame

Bordered frame with title.
Panel

Panel

Panel with header/footer.
Card

Card

Card container component.
Divider

Divider

Horizontal or vertical divider.
BoxDrawing

BoxDrawing

Unicode box-drawing frame.
BorderText

BorderText

Text with ASCII border.
Spacer

Spacer

Empty space filler.
Split

Split

Split layout.
Center

Center

Centered content.
Cover

Cover

Cover layout.
Header Page header.
Footer Page footer.
Window

Window

Window frame.
Drawer

Drawer

Drawer panel.

Charts

Chart

Chart

Bar/line chart with axes.
AreaChart

AreaChart

Area chart for time series.
Bar

Bar

Horizontal status bar.
Donut

Donut

Donut chart.
Gauge

Gauge

Horizontal gauge.
GaugeChart

GaugeChart

Circular gauge chart.
GaugeCircle

GaugeCircle

Circular gauge visualization.
Heatmap

Heatmap

Heat map visualization.
RadarChart

RadarChart

Radar/spider chart.
Bubble

Bubble

Bubble chart.
Bullet

Bullet

Bullet chart.
Sparkline

Sparkline

Inline sparkline chart.
SparklineBar

SparklineBar

Bar-style sparkline.
SparklineArea

SparklineArea

Area-style sparkline.
SparkArea

SparkArea

Spark area chart.
FunnelChart

FunnelChart

Funnel chart.

Form & Input

Input

Input

Text input field.
Textarea

Textarea

Multi-line text area.
Select

Select

Dropdown select.
Checkbox

Checkbox

Checkbox group.
Radio

Radio

Radio button.
Slider

Slider

Slider control.
Toggle

Toggle

Toggle switch.
Switch

Switch

Switch component.
Chip

Chip

Chip/tag component.
ChipGroup

ChipGroup

Group of chips.
Label

Label

Form label.
ComboBox

ComboBox

Combo box.
DatePicker

DatePicker

Date picker.
Tabs

Tabs

Tabbed interface.
TabsVertical

TabsVertical

Vertical tab navigation.
Navbar Navigation bar.
Sidebar Sidebar navigation.
Breadcrumb Breadcrumb navigation.
Menu Menu component.

Feedback

Alert

Alert

Alert/message box.
Toast

Toast

Toast message.
Notification

Notification

Toast notification.
Spinner

Spinner

Loading spinner.
Progress

Progress

Progress indicator.
ProgressBar

ProgressBar

Progress bar.
ProgressRing

ProgressRing

Circular progress indicator.
NProgress

NProgress

npm-style progress bar.
LoadingText

LoadingText

Animated loading text.

Data Display

TableBordered

TableBordered

Bordered table.
TableZebra

TableZebra

Zebra-striped table.
List

List

List renderer.
Tree

Tree

Tree structure.
Metric

Metric

Metric display.
Stat

Stat

Single stat display.
Stats

Stats

Statistics display.
MetricsGrid

MetricsGrid

Grid of metrics.

Media

Image

Image

Image display.
Picture

Picture

Picture frame.
Avatar

Avatar

User avatar.
AvatarGroup

AvatarGroup

Group of avatars.
Icon

Icon

Icon display.
QRCode

QRCode

QR code.
Barcode

Barcode

Barcode.
Video

Video

Video player.
Audio

Audio

Audio player.

Text

Text

Text

Word-wrapped text.
Paragraph

Paragraph

Paragraph text.
Code

Code

Code block.
Kbd

Kbd

Keyboard key display.
Emoji

Emoji

Emoji display.
FigletText

FigletText

ASCII art text.
ASCIIBanner

ASCIIBanner

ASCII banner text.
Highlight

Highlight

Syntax highlighted code.
HexDump

HexDump

Hex dump viewer.
DotMatrix

DotMatrix

Dot matrix display.
Pictogram

Pictogram

Pictogram display.
Boxer

Boxer

Tree-based layout splitting — a region subdivided by ratio down to content leaves.

Status

Clock

Clock

Digital clock.
Timer

Timer

Countdown timer.
Stopwatch

Stopwatch

Stopwatch.
Calendar

Calendar

Calendar view.
Terminal

Terminal

Terminal emulator.
LogViewer

LogViewer

Log file viewer.
Log

Log

Log entry.
Console

Console

Terminal console.
State

State

Application state.
Focus

Focus

Focus state management.

Advanced

Accordion

Accordion

Accordion/collapsible.
ActivityFeed

ActivityFeed

Activity feed.
Badge

Badge

Badge/tag component.
Testimonial

Testimonial

Testimonial quote.
Profile

Profile

User profile card.
CTA

CTA

Call-to-action.
Jumbotron

Jumbotron

Jumbotron hero section.
EmptyState

EmptyState

Empty state placeholder.
Skeleton

Skeleton

Loading skeleton.
Marquee

Marquee

Scrolling marquee text.
Scrollbar

Scrollbar

Custom scrollbar.
Tooltip

Tooltip

Tooltip popup.
Popover

Popover

Popover content.
Hint

Hint

Hint component.
Tag

Tag

Tag component.
Rating

Rating

Star rating display.
Leaderboard

Leaderboard

Leaderboard display.
Diff

Diff

Diff view.
Editor

Editor

Text editor.
CommandPalette

CommandPalette

Command palette.
Modal Modal dialog.
WordCloud

WordCloud

Word cloud visualization.

Dashboard Examples

Dashboard Layout

Dashboard Layout

Layout containers demo.
Dashboard Charts

Dashboard Charts

Charts demo.
Dashboard Form

Dashboard Form

Form demo.
Dashboard Nav

Dashboard Nav

Navigation demo.
Dashboard Status

Dashboard Status

Status indicators demo.
Dashboard Text

Dashboard Text

Text components demo.
Dashboard Time

Dashboard Time

Time components demo.
Dashboard UI

Dashboard UI

UI components demo.
Dashboard Complex

Dashboard Complex

Complex layout demo.
Dashboard Data

Dashboard Data

Data display demo.
Dashboard Devtools

Dashboard Devtools

Devtools demo.
Dashboard Accordion Timeline

Dashboard Accordion Timeline

Accordion and timeline components.
Dashboard Media

Dashboard Media

Media components demo.
Dashboard Metrics

Dashboard Metrics

Metrics display demo.