SerenityJS
    Preparing search index...

    These forms also contain a title and a context area, but developers can add as many buttons as they so desire. These buttons can also have textures that include either a resource path, or a url path.

    Example Usage

    import { ActionForm } from "@serenityjs/server-ui"

    // Create a new ActionForm instance and set the title, content, and add buttons
    const form = new ActionForm()
    form.title = "ActionForm Example"
    form.content = "This is a example of a action form. This is the description of the message form."

    // Button with no additional data
    form.button("Button 1")

    // Button with a texture path
    form.button("Button 2", {
    type: "path",
    data: "textures/items/apple"
    })

    // Buttom with a url path
    form.button("Button 3", {
    type: "url",
    data: "https://raw.githubusercontent.com/SerenityJS/serenity/develop/public/serenityjs-logo.png"
    })

    // Show the form to the player
    form.show(player)
    .then((response) => {})
    .catch((rejected) => {})

    Hierarchy (View Summary)

    • Form<number>
      • ActionForm
    Index

    Constructors

    Properties

    buttons: ActionFormButton[] = []

    The buttons of the form.

    content: string

    The content of the form.

    formId: number = ++Form.formId

    The form id of the form.

    title: string

    The title of the form.

    type: Action = ModalFormType.Action

    The type of form.

    formId: number = 0

    The next form id to use when creating a new form.

    Methods