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. |
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:
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. |
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:
Name | Type | Description |
---|---|---|
icon | str | None | Gets or sets the icon path or URL of the button |
on_click | Callable[[Player], None] | Gets or sets the on click callback. |
text | str | Translatable | Gets 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:
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. |
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:
Name | Type | Description |
---|---|---|
label | str | Translatable | Gets 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:
Name | Type | Description |
---|---|---|
text | str | Translatable | Gets 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:
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. |
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:
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. |
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:
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. |
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:
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. |
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:
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. |
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:
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. |
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.