endstone.form

Classes

NameDescription
ActionForm

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

Button

Represents a button with text and an optional icon.

Divider

Represents a divider.

Dropdown

Represents a dropdown with a set of predefined options.

Header

Represents a header with a label.

Label

Represents a text label.

MessageForm

Represents a form with two buttons.

ModalForm

Represents a modal form with controls.

Slider

Represents a slider with a label.

StepSlider

Represents a step slider with a set of predefined options.

TextInput

Represents a text input field.

Toggle

Represents a toggle button with a label.

classActionForm

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_button

Adds a button to the form.

add_divider

Adds a divider to the form.

add_header

Adds a header to the form.

add_label

Adds a label to the form.

Attributes

NameTypeDescription
contentstr | Translatable

Gets 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 | Translatable

Gets or sets the title of the form.

attrcontentproperty

content: str | Translatable

Gets or sets the content of the form.

attrcontrolsproperty

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

Gets or sets the controls of the action form.

attron_closeproperty

on_close: Callable[[Player], None]

Gets or sets the on close callback.

attron_submitproperty

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

Gets or sets the on submit callback.

attrtitleproperty

title: str | Translatable

Gets or sets the title of the form.

methadd_button

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

Adds a button to the form.

methadd_divider

add_divider() -> ActionForm

Adds a divider to the form.

methadd_header

add_header(text: str | Translatable) -> ActionForm

Adds a header to the form.

methadd_label

add_label(text: str | Translatable) -> ActionForm

Adds a label to the form.

classButton

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 | None

Gets or sets the icon path or URL of the button

on_clickCallable[[Player], None]

Gets or sets the on click callback.

textstr | Translatable

Gets or sets the text of the button

attriconproperty

icon: str | None

Gets or sets the icon path or URL of the button

attron_clickproperty

on_click: Callable[[Player], None]

Gets or sets the on click callback.

attrtextproperty

Gets or sets the text of the button

classDivider

Divider()

Represents a divider.

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_option

Adds a new option to the dropdown.

Attributes

NameTypeDescription
default_indexint | None

Gets or sets the optional default index of the dropdown.

labelstr | Translatable

Gets or sets the label of the dropdown.

optionslist[str]

Gets or sets the options of the dropdown.

default_index: int | None

Gets or sets the optional default index of the dropdown.

label: str | Translatable

Gets or sets the label of the dropdown.

options: list[str]

Gets or sets the options of the dropdown.

add_option(option: str) -> Dropdown

Adds a new option to the dropdown.

Header(label: str | Translatable = '')

Represents a header with a label.

Attributes

NameTypeDescription
labelstr | Translatable

Gets or sets the label of the header.

attrlabelproperty

label: str | Translatable

Gets or sets the label of the header.

classLabel

Label(text: str | Translatable = '')

Represents a text label.

Attributes

NameTypeDescription
textstr | Translatable

Gets or sets the text of the label.

attrtextproperty

Gets or sets the text of the label.

classMessageForm

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 | Translatable

Gets or sets the text of button1.

button2str | Translatable

Gets or sets the text of button2.

contentstr | Translatable

Gets 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 | Translatable

Gets or sets the title of the form.

attrbutton1property

button1: str | Translatable

Gets or sets the text of button1.

attrbutton2property

button2: str | Translatable

Gets or sets the text of button2.

attrcontentproperty

content: str | Translatable

Gets or sets the content of the form.

attron_closeproperty

on_close: Callable[[Player], None]

Gets or sets the on close callback.

attron_submitproperty

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

Gets or sets the on submit callback.

attrtitleproperty

title: str | Translatable

Gets or sets the title of the form.

classModalForm

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_control

Adds 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 | None

Gets 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 | None

Gets or sets the submit button message of the form.

titlestr | Translatable

Gets or sets the title of the form.

attrcontrolsproperty

Gets or sets the controls of the modal form.

attriconproperty

icon: str | None

Gets or sets the icon of the form.

attron_closeproperty

on_close: Callable[[Player], None]

Gets or sets the on close callback.

attron_submitproperty

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

Gets or sets the on submit callback.

attrsubmit_buttonproperty

submit_button: str | Translatable | None

Gets or sets the submit button message of the form.

attrtitleproperty

title: str | Translatable

Gets or sets the title of the form.

methadd_control

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

Adds a control to the form.

classSlider

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 | None

Gets or sets the optional default value of the slider.

labelstr | Translatable

Gets or sets the label of the slider.

maxfloat

Gets or sets the maximum value of the slider.

minfloat

Gets or sets the minimum value of the slider.

stepfloat

Gets or sets the step size of the slider.

attrdefault_valueproperty

default_value: float | None

Gets or sets the optional default value of the slider.

attrlabelproperty

label: str | Translatable

Gets or sets the label of the slider.

attrmaxproperty

max: float

Gets or sets the maximum value of the slider.

attrminproperty

min: float

Gets or sets the minimum value of the slider.

attrstepproperty

step: float

Gets or sets the step size of the slider.

classStepSlider

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_option

Adds a new option to the step slider.

Attributes

NameTypeDescription
default_indexint | None

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

labelstr | Translatable

Gets or sets the label of the step slider.

optionslist[str]

Gets or sets the options of the step slider.

attrdefault_indexproperty

default_index: int | None

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

attrlabelproperty

label: str | Translatable

Gets or sets the label of the step slider.

attroptionsproperty

options: list[str]

Gets or sets the options of the step slider.

methadd_option

add_option(option: str) -> Dropdown

Adds a new option to the step slider.

classTextInput

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

Represents a text input field.

Attributes

NameTypeDescription
default_valuestr | None

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

labelstr | Translatable

Gets or sets the label of the text input field.

placeholderstr | Translatable

Gets or sets the placeholder of the text input field.

attrdefault_valueproperty

default_value: str | None

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

attrlabelproperty

label: str | Translatable

Gets or sets the label of the text input field.

attrplaceholderproperty

placeholder: str | Translatable

Gets or sets the placeholder of the text input field.

classToggle

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

Represents a toggle button with a label.

Attributes

NameTypeDescription
default_valuebool

Gets or sets the value of the toggle.

labelstr | Translatable

Gets or sets the label of the toggle.

attrdefault_valueproperty

default_value: bool

Gets or sets the value of the toggle.

attrlabelproperty

label: str | Translatable

Gets or sets the label of the toggle.

On this page