@jsvision/ui / measureButtonGroup
Function: measureButtonGroup()
measureButtonGroup(
buttons,options?):ButtonGroupMetrics
Defined in: ui/src/controls/button-group.ts:99
Measure an equal-width logical group of Buttons in terminal cells.
Natural Button measurement is the single caption-width authority: it removes accelerator markup, counts wide and combining glyphs exactly as the renderer does, and includes face padding and the shadow column. The widest result is then compared with minimumButtonWidth.
Parameters
buttons
readonly Button[]
Buttons that belong to the logical action group.
options?
ButtonGroupOptions = {}
Minimum width, gaps, and optional wrapping column limit.
Returns
The group's smallest unclipped terminal-cell rectangle.
Example
ts
import { Button, measureButtonGroup } from '@jsvision/ui';
const buttons = [new Button('~O~K'), new Button('~C~ancel')];
const metrics = measureButtonGroup(buttons, { minimumButtonWidth: 10, gap: 2 });
// Use metrics.width when choosing the dialog's minimum width.