MenuItemOptions

The MenuItemOptions type defines the configuration for an individual item within a menu in ts-better-console. It specifies the label text and optional styling for both the default and focused states of the menu item.

Type Definition

The MenuItemOptions type includes the following properties:

  • label: A string representing the text displayed for the menu item.
  • style: An optional StyleOptions object that defines the default styling of the menu item.
  • focusStyle: An optional StyleOptions object that defines the styling applied when the menu item is focused or highlighted.
type MenuItemOptions = {
  label: string;
  style?: StyleOptions;
  focusStyle?: StyleOptions;
}

Usage

You can use MenuItemOptions when defining items for a menu:

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

new Menu([
{
label: "Red",
style: { color: "red" },
focusStyle: { color: "white", backgroundColor: "red" },
},
{
label: "Blue",
style: { color: "blue" },
focusStyle: { color: "white", backgroundColor: "blue" },
},
]).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!