simple-canvas-library
    Preparing search index...

    Class TopBar

    TopBar is a horizontal bar for UI components, typically placed above the canvas. Use addButton, addSlider, addNumberInput to add controls.

    Hierarchy

    • UIBar
      • TopBar
    Index

    Constructors

    Properties

    components: UIComponent[] = []
    element: HTMLElement
    isEnabled: boolean = true
    isVisible: boolean = true

    Methods

    • Add a button to the bar

      Parameters

      • config: ButtonConfig

      Returns Button

    • Add arbitrary HTML or an HTMLElement to the bar.

      Parameters

      • html: string | HTMLElement

        HTML string or HTMLElement

      Returns HTMLElement

    • Add a number input to the bar

      Parameters

      • config: NumberInputConfig

      Returns NumberInput

    • Add a slider to the bar

      Parameters

      • config: SliderConfig

      Returns Slider

    • Add a title (non-interactive text) to the bar. Inherits bar foreground/background colors.

      Parameters

      • text: string

        Title text

      • Optionaloptions: Partial<CSSStyleDeclaration>

        Optional style overrides

      Returns HTMLElement

    • Remove all components from the bar

      Returns this

    • Disable the component

      Returns this

    • Enable the component

      Returns this

    • Get all components in the bar

      Returns UIComponent[]

    • Get the underlying DOM element

      Returns HTMLElement

    • Check if the component is enabled

      Returns boolean

    • Check if the component is visible

      Returns boolean

    • Hide the component

      Returns this

    • Set alignment of items within the bar.

      Parameters

      • justifyContent: "start" | "center" | "end" | "space-between" | "space-around" | "space-evenly"

        Justify content value (CSS flexbox)

      Returns this

    • Set foreground and background colors for the bar using CSS variables.

      Parameters

      • foreground: string

        Text color

      • background: string

        Background color

      Returns this

    • Show the component

      Returns this