endstone.form
Classes
| Name | Description |
|---|---|
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
Represents a form with buttons that let the player take action.
Methods
| Name | Description |
|---|---|
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
| Name | Type | Description |
|---|---|---|
content | str | Translatable | Gets or sets the content of the form. |
controls | list[Button | Divider | Header | Label] | Gets or sets the controls of the action form. |
on_close | Callable[[Player], None] | Gets or sets the on close callback. |
on_submit | Callable[[Player, int], None] | Gets or sets the on submit callback. |
title | str | Translatable | Gets or sets the title of the form. |
attrcontentproperty
content: str | TranslatableGets or sets the content of the form.
attrcontrolsproperty
Gets or sets the controls of the action form.
attron_closeproperty
Gets or sets the on close callback.
attron_submitproperty
Gets or sets the on submit callback.
attrtitleproperty
title: str | TranslatableGets or sets the title of the form.
methadd_button
add_button(text: str | Translatable, icon: str | None = None, on_click: Callable[[Player], None] = None) -> ActionFormAdds a button to the form.
methadd_divider
add_divider() -> ActionFormAdds a divider to the form.
methadd_header
add_header(text: str | Translatable) -> ActionFormAdds a header to the form.
methadd_label
add_label(text: str | Translatable) -> ActionFormAdds 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
classDivider
Divider()Represents a divider.
classDropdown
Dropdown(label: str | Translatable = '', options: list[str] | None = None, default_index: int | None = None)Represents a dropdown with a set of predefined options.
Methods
| Name | Description |
|---|---|
add_option | Adds a new option to the dropdown. |
Attributes
| Name | Type | Description |
|---|---|---|
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. |
attrdefault_indexproperty
default_index: int | NoneGets or sets the optional default index of the dropdown.
attrlabelproperty
label: str | TranslatableGets or sets the label of the dropdown.
attroptionsproperty
Gets or sets the options of the dropdown.
methadd_option
Adds a new option to the dropdown.
classHeader
Header(label: str | Translatable = '')Represents a header with a label.
Attributes
| Name | Type | Description |
|---|---|---|
label | str | Translatable | Gets or sets the label of the header. |
attrlabelproperty
label: str | TranslatableGets or sets the label of the header.
classLabel
Label(text: str | Translatable = '')Represents a text label.
Attributes
| Name | Type | Description |
|---|---|---|
text | str | Translatable | Gets or sets the text of the label. |
attrtextproperty
text: str | TranslatableGets 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
| Name | Type | Description |
|---|---|---|
button1 | str | Translatable | Gets or sets the text of button1. |
button2 | str | Translatable | Gets or sets the text of button2. |
content | str | Translatable | Gets or sets the content of the form. |
on_close | Callable[[Player], None] | Gets or sets the on close callback. |
on_submit | Callable[[Player, int], None] | Gets or sets the on submit callback. |
title | str | Translatable | Gets or sets the title of the form. |
attrbutton1property
button1: str | TranslatableGets or sets the text of button1.
attrbutton2property
button2: str | TranslatableGets or sets the text of button2.
attrcontentproperty
content: str | TranslatableGets or sets the content of the form.
attron_closeproperty
Gets or sets the on close callback.
attron_submitproperty
Gets or sets the on submit callback.
attrtitleproperty
title: str | TranslatableGets 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
| Name | Description |
|---|---|
add_control | Adds a control to the form. |
Attributes
| Name | Type | Description |
|---|---|---|
controls | list[Dropdown | Label | Slider | StepSlider | TextInput | Toggle | Divider | Header] | Gets or sets the controls of the modal form. |
icon | str | None | Gets or sets the icon of the form. |
on_close | Callable[[Player], None] | Gets or sets the on close callback. |
on_submit | Callable[[Player, str], None] | Gets or sets the on submit callback. |
submit_button | str | Translatable | None | Gets or sets the submit button message of the form. |
title | str | Translatable | Gets or sets the title of the form. |
attrcontrolsproperty
Gets or sets the controls of the modal form.
attriconproperty
icon: str | NoneGets or sets the icon of the form.
attron_closeproperty
Gets or sets the on close callback.
attron_submitproperty
Gets or sets the on submit callback.
attrsubmit_buttonproperty
submit_button: str | Translatable | NoneGets or sets the submit button message of the form.
attrtitleproperty
title: str | TranslatableGets or sets the title of the form.
methadd_control
Adds a control to the form.
classSlider
Represents a slider with a label.
Attributes
| Name | Type | Description |
|---|---|---|
default_value | float | None | Gets or sets the optional default value of the slider. |
label | str | Translatable | Gets or sets the label of the slider. |
max | float | Gets or sets the maximum value of the slider. |
min | float | Gets or sets the minimum value of the slider. |
step | float | Gets or sets the step size of the slider. |
attrdefault_valueproperty
default_value: float | NoneGets or sets the optional default value of the slider.
attrlabelproperty
label: str | TranslatableGets or sets the label of the slider.
attrmaxproperty
max: floatGets or sets the maximum value of the slider.
attrminproperty
min: floatGets or sets the minimum value of the slider.
attrstepproperty
step: floatGets 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
| Name | Description |
|---|---|
add_option | Adds a new option to the step slider. |
Attributes
| Name | Type | Description |
|---|---|---|
default_index | int | None | Gets or sets the optional default index of the step slider. |
label | str | Translatable | Gets or sets the label of the step slider. |
options | list[str] | Gets or sets the options of the step slider. |
attrdefault_indexproperty
default_index: int | NoneGets or sets the optional default index of the step slider.
attrlabelproperty
label: str | TranslatableGets or sets the label of the step slider.
attroptionsproperty
Gets or sets the options of the step slider.
methadd_option
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
| Name | Type | Description |
|---|---|---|
default_value | str | None | Gets or sets the optional default text of the text input field. |
label | str | Translatable | Gets or sets the label of the text input field. |
placeholder | str | Translatable | Gets or sets the placeholder of the text input field. |
attrdefault_valueproperty
default_value: str | NoneGets or sets the optional default text of the text input field.
attrlabelproperty
label: str | TranslatableGets or sets the label of the text input field.
attrplaceholderproperty
placeholder: str | TranslatableGets 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
| Name | Type | Description |
|---|---|---|
default_value | bool | Gets or sets the value of the toggle. |
label | str | Translatable | Gets or sets the label of the toggle. |
attrdefault_valueproperty
default_value: boolGets or sets the value of the toggle.
attrlabelproperty
label: str | TranslatableGets or sets the label of the toggle.