Skip to content
Tim203 edited this page Nov 26, 2020 · 13 revisions

Introduction to Forms

Bedrock has a cool exclusive feature called Forms.
While they're exclusive to Bedrock, using the Floodgate API, you're able to use them.
Bedrock knows three types of Forms:

  • CustomForm
  • ModalForm
  • SimpleForm

We'll discuss them one by one starting with the easiest and ending with the least easy form type.

ModalForm

While this is the easiest form type it's also the least customisable.
You have a title, description (content) and two buttons.

Example of a ModalForm

Code used in the image:

ModalForm.builder()
    .title("Title")
    .content("Content")
    .button1("Button 1")
    .button2("Button 2")

SimpleForm

While this one is less easy then ModalForm is, it also has more customizability.
It's still limited to title, content and buttons, but these buttons can also have images and do not have a minimum and maximum of two.

Example of a SimpleForm

Code used in the image:

SimpleForm.builder()
    .title("Title")
    .content("Content")
    .button("Button without an image")
    .button("Button with URL image", FormImage.Type.URL, "https://github.com/GeyserMC.png?size=200")
    .button("Button with path image", FormImage.Type.PATH, "textures/i/glyph_world_template.png")

CustomForm

While the CustomForm is the last one on our list (and thus the least easy one), it also has the greatest customizability.
This form exists of a title, content and a list of different components e.g. label, slider and input.
See Components for more information about every component you can use and in which form type.

Example of a CustomForm

Code used in the image:

CustomForm.builder()
    .title("Title")
    .dropdown("Text", "Option 1", "Option 2")
    .input("Input", "placeholder")
    .toggle("Toggle")
    .slider("Text", 0, 10, 1, 5)

Components

Forms have different component types, most of them are limited to the CustomForm and some are available to everything but CustomForm.

Button

Dropdown

Input

Label

Slider

Stepslider

Toggle