ButtonGroupOptions

Optional configuration passed as the second argument to new ButtonGroup(buttons, options). Controls spacing, border styling, alignment, and whether the buttons render inline or in a fixed position.

Type Definition

type ButtonGroupOptions = {
  gap?: number;
  borderStyle?: StyleOptions;
  align?: Align;
  position?: FixedPosition;
}

Properties

  • gap — horizontal spacing between buttons. Defaults to 2.
  • borderStyle — a StyleOptions object applied to the button borders.
  • align — horizontal alignment of the button group. Accepts "left", "center", "right", "start", or "end". Defaults to "left".
  • position — where the buttons appear: "inline" (default), "top", or "bottom". Non-inline positions use scroll regions to pin the buttons.

Usage

import { ButtonGroup } from "ts-better-console";

const buttons = new ButtonGroup(
[
{ label: "Yes", onClick: () => {} },
{ label: "No", onClick: () => {} },
],
{
gap: 4,
align: "center",
position: "bottom",
},
);

buttons.show();

Want to support this project?

If you find ts-better-console useful and want to support its development, consider starring the GitHub repository or buying me a coffee! Your support helps me dedicate more time to improving the library and adding new features.

Want to contribute to this project?

Contributions are welcome! If you're interested in improving the library, fixing bugs, or adding new features, feel free to check out the GitHub repository and submit a pull request. Whether you're a seasoned developer or new to open source, your contributions can make a difference!