Skip to Content
⚠ Under Construction
ReferencePython APIendstone.form

endstone.form

Classes:

NameDescription
ActionFormRepresents a form with buttons that let the player take action.
ButtonRepresents a button with text and an optional icon.
DividerRepresents a divider.
DropdownRepresents a dropdown with a set of predefined options.
HeaderRepresents a header with a label.
LabelRepresents a text label.
MessageFormRepresents a form with two buttons.
ModalFormRepresents a modal form with controls.
SliderRepresents a slider with a label.
StepSliderRepresents a step slider with a set of predefined options.
TextInputRepresents a text input field.
ToggleRepresents a toggle button with a label.

ActionForm

ActionForm( title: str | Translatable = "", content: str | Translatable = "", buttons: list[Button | Divider | Header | Label] | None = None, on_submit: Callable[[Player, int], None] = None, on_close: Callable[[Player], None] = None, )

Represents a form with buttons that let the player take action.

Methods:

NameDescription
add_buttonAdds a button to the form.
add_dividerAdds a divider to the form.
add_headerAdds a header to the form.
add_labelAdds a label to the form.

Attributes:

NameTypeDescription
contentstr | TranslatableGets or sets the content of the form.
controlslist[Button | Divider | Header | Label]Gets or sets the controls of the action form.
on_closeCallable[[Player], None]Gets or sets the on close callback.
on_submitCallable[[Player, int], None]Gets or sets the on submit callback.
titlestr | TranslatableGets or sets the title of the form.

content

content: str | Translatable

Gets or sets the content of the form.

controls

controls: list[Button | Divider | Header | Label]

Gets or sets the controls of the action form.

on_close

on_close: typing.Callable[[Player], None]

Gets or sets the on close callback.

on_submit

on_submit: typing.Callable[[Player, int], None]

Gets or sets the on submit callback.

title

title: str | Translatable

Gets or sets the title of the form.

add_button

add_button( text: str | Translatable, icon: str | None = None, on_click: Callable[[Player], None] = None, ) -> ActionForm

Adds a button to the form.

add_divider

add_divider() -> ActionForm

Adds a divider to the form.

add_header

add_header(text:str | Translatable) -> ActionForm

Adds a header to the form.

add_label

add_label(text:str | Translatable) -> ActionForm

Adds a label to the form.

Button

Button( text: str | Translatable = "", icon: str | None = None, on_click: Callable[[Player], None] = None, )

Represents a button with text and an optional icon.

Attributes:

NameTypeDescription
iconstr | NoneGets or sets the icon path or URL of the button
on_clickCallable[[Player], None]Gets or sets the on click callback.
textstr | TranslatableGets or sets the text of the button

icon

icon: str | None

Gets or sets the icon path or URL of the button

on_click

on_click: typing.Callable[[Player], None]

Gets or sets the on click callback.

text

text: str | Translatable

Gets or sets the text of the button

Divider

Divider()

Represents a divider.

Dropdown

Dropdown( label: str | Translatable = "", options: list[str] | None = None, default_index: int | None = None, )

Represents a dropdown with a set of predefined options.

Methods:

NameDescription
add_optionAdds a new option to the dropdown.

Attributes:

NameTypeDescription
default_indexint | NoneGets or sets the optional default index of the dropdown.
labelstr | TranslatableGets or sets the label of the dropdown.
optionslist[str]Gets or sets the options of the dropdown.

default_index

default_index: int | None

Gets or sets the optional default index of the dropdown.

label

label: str | Translatable

Gets or sets the label of the dropdown.

options

options: list[str]

Gets or sets the options of the dropdown.

add_option

add_option(option:str) -> Dropdown

Adds a new option to the dropdown.

Header

Header(label:str | Translatable = '')

Represents a header with a label.

Attributes:

NameTypeDescription
labelstr | TranslatableGets or sets the label of the header.

label

label: str | Translatable

Gets or sets the label of the header.

Label

Label(text:str | Translatable = '')

Represents a text label.

Attributes:

NameTypeDescription
textstr | TranslatableGets or sets the text of the label.

text

text: str | Translatable

Gets or sets the text of the label.

MessageForm

MessageForm( title: str | Translatable = "", content: str | Translatable = "", button1: str | Translatable = "", button2: str | Translatable = "", on_submit: Callable[[Player, int], None] = None, on_close: Callable[[Player], None] = None, )

Represents a form with two buttons.

Attributes:

NameTypeDescription
button1str | TranslatableGets or sets the text of button1.
button2str | TranslatableGets or sets the text of button2.
contentstr | TranslatableGets or sets the content of the form.
on_closeCallable[[Player], None]Gets or sets the on close callback.
on_submitCallable[[Player, int], None]Gets or sets the on submit callback.
titlestr | TranslatableGets or sets the title of the form.

button1

button1: str | Translatable

Gets or sets the text of button1.

button2

button2: str | Translatable

Gets or sets the text of button2.

content

content: str | Translatable

Gets or sets the content of the form.

on_close

on_close: typing.Callable[[Player], None]

Gets or sets the on close callback.

on_submit

on_submit: typing.Callable[[Player, int], None]

Gets or sets the on submit callback.

title

title: str | Translatable

Gets or sets the title of the form.

ModalForm

ModalForm( title: str | Translatable = "", controls: ( list[ Dropdown | Label | Slider | StepSlider | TextInput | Toggle | Divider | Header ] | None ) = None, submit_button: str | Translatable | None = None, icon: str | None = None, on_submit: Callable[[Player, str], None] = None, on_close: Callable[[Player], None] = None, )

Represents a modal form with controls.

Methods:

NameDescription
add_controlAdds a control to the form.

Attributes:

NameTypeDescription
controlslist[Dropdown | Label | Slider | StepSlider | TextInput | Toggle | Divider | Header]Gets or sets the controls of the modal form.
iconstr | NoneGets or sets the icon of the form.
on_closeCallable[[Player], None]Gets or sets the on close callback.
on_submitCallable[[Player, str], None]Gets or sets the on submit callback.
submit_buttonstr | Translatable | NoneGets or sets the submit button message of the form.
titlestr | TranslatableGets or sets the title of the form.

controls

controls: list[ Dropdown | Label | Slider | StepSlider | TextInput | Toggle | Divider | Header ]

Gets or sets the controls of the modal form.

icon

icon: str | None

Gets or sets the icon of the form.

on_close

on_close: typing.Callable[[Player], None]

Gets or sets the on close callback.

on_submit

on_submit: typing.Callable[[Player, str], None]

Gets or sets the on submit callback.

submit_button

submit_button: str | Translatable | None

Gets or sets the submit button message of the form.

title

title: str | Translatable

Gets or sets the title of the form.

add_control

add_control( control: ( Dropdown | Label | Slider | StepSlider | TextInput | Toggle | Divider | Header ), ) -> ModalForm

Adds a control to the form.

Slider

Slider( label: str | Translatable = "", min: float = 0, max: float = 100, step: float = 20, default_value: float | None = None, )

Represents a slider with a label.

Attributes:

NameTypeDescription
default_valuefloat | NoneGets or sets the optional default value of the slider.
labelstr | TranslatableGets or sets the label of the slider.
maxfloatGets or sets the maximum value of the slider.
minfloatGets or sets the minimum value of the slider.
stepfloatGets or sets the step size of the slider.

default_value

default_value: float | None

Gets or sets the optional default value of the slider.

label

label: str | Translatable

Gets or sets the label of the slider.

max

max: float

Gets or sets the maximum value of the slider.

min

min: float

Gets or sets the minimum value of the slider.

step

step: float

Gets or sets the step size of the slider.

StepSlider

StepSlider( label: str | Translatable = "", options: list[str] | None = None, default_index: int | None = None, )

Represents a step slider with a set of predefined options.

Methods:

NameDescription
add_optionAdds a new option to the step slider.

Attributes:

NameTypeDescription
default_indexint | NoneGets or sets the optional default index of the step slider.
labelstr | TranslatableGets or sets the label of the step slider.
optionslist[str]Gets or sets the options of the step slider.

default_index

default_index: int | None

Gets or sets the optional default index of the step slider.

label

label: str | Translatable

Gets or sets the label of the step slider.

options

options: list[str]

Gets or sets the options of the step slider.

add_option

add_option(option:str) -> Dropdown

Adds a new option to the step slider.

TextInput

TextInput( label: str | Translatable = "", placeholder: str | Translatable = "", default_value: str | None = None, )

Represents a text input field.

Attributes:

NameTypeDescription
default_valuestr | NoneGets or sets the optional default text of the text input field.
labelstr | TranslatableGets or sets the label of the text input field.
placeholderstr | TranslatableGets or sets the placeholder of the text input field.

default_value

default_value: str | None

Gets or sets the optional default text of the text input field.

label

label: str | Translatable

Gets or sets the label of the text input field.

placeholder

placeholder: str | Translatable

Gets or sets the placeholder of the text input field.

Toggle

Toggle(label:str | Translatable = '', default_value:bool = False)

Represents a toggle button with a label.

Attributes:

NameTypeDescription
default_valueboolGets or sets the value of the toggle.
labelstr | TranslatableGets or sets the label of the toggle.

default_value

default_value: bool

Gets or sets the value of the toggle.

label

label: str | Translatable

Gets or sets the label of the toggle.

Last updated on