rednode API - v0.1.0
    Preparing search index...

    Variable uiConst

    ui: {
        button(
            label: string,
            onClick?: () => void,
            options?: Omit<ButtonProps, "label">,
        ): UiNode<ButtonProps>;
        column(
            ...children: UiNode<Record<string, unknown>>[],
        ): UiNode<Record<string, never>>;
        heading(text: string, options?: Omit<TextProps, "text">): UiNode<TextProps>;
        input(
            options?: InputProps & {
                onChange?: (value: string) => void;
                onSubmit?: (value: string) => void;
            },
        ): UiNode<InputProps>;
        progress(
            value: number,
            options?: Omit<ProgressProps, "value">,
        ): UiNode<ProgressProps>;
        row(
            ...children: UiNode<Record<string, unknown>>[],
        ): UiNode<Record<string, never>>;
        slider(
            label: string,
            onChange?: (value: number) => void,
            options?: Omit<SliderProps, "label">,
        ): UiNode<SliderProps>;
        text(text: string, options?: Omit<TextProps, "text">): UiNode<TextProps>;
        toggle(
            label: string,
            onChange?: (checked: boolean) => void,
            options?: Omit<ToggleProps, "label">,
        ): UiNode<ToggleProps>;
        window(options: WindowOptions): UiWindow;
    } = ...

    Builds overlay windows from a Node mod.

    Type Declaration

    • button: function
      • A button. onClick runs in the mod when the player presses it.

        Parameters

        • label: string
        • OptionalonClick: () => void
        • options: Omit<ButtonProps, "label"> = {}

        Returns UiNode<ButtonProps>

    • column: function
      • Puts nodes under each other. A window's content is already a column.

        Parameters

        • ...children: UiNode<Record<string, unknown>>[]

        Returns UiNode<Record<string, never>>

    • heading: function
    • input: function
      • A text field. onSubmit runs on Enter; onChange when the field loses focus.

        Parameters

        • options: InputProps & {
              onChange?: (value: string) => void;
              onSubmit?: (value: string) => void;
          } = {}

        Returns UiNode<InputProps>

    • progress: function
    • row: function
      • Puts nodes side by side.

        Parameters

        • ...children: UiNode<Record<string, unknown>>[]

        Returns UiNode<Record<string, never>>

    • slider: function
      • A slider. onChange gets the value when the player lets go.

        Parameters

        • label: string
        • OptionalonChange: (value: number) => void
        • options: Omit<SliderProps, "label"> = {}

        Returns UiNode<SliderProps>

    • text: function
    • toggle: function
      • An on and off switch. onChange gets the new state.

        Parameters

        • label: string
        • OptionalonChange: (checked: boolean) => void
        • options: Omit<ToggleProps, "label"> = {}

        Returns UiNode<ToggleProps>

    • window: function
      • Opens a window in the game. It looks like any overlay app window: the player can move it in interactive mode (F10), and its position is saved.

        Parameters

        Returns UiWindow

    import { game, ui } from "rednode";

    const where = ui.text("Waiting for the game");
    ui.window({
    title: "Where am I",
    children: [
    where,
    ui.button("Update", async () => {
    const p = await game.player.position();
    where.set({ text: `${p.x.toFixed(1)}, ${p.y.toFixed(1)}, ${p.z.toFixed(1)}` });
    }),
    ],
    });