<input/> element
Allows for user input
Input elements take input from players
The displayed item can be set with either the src
attribute or by writing the
item data JSON inside the element.
Attributes
Attribute | Value | Description | Example |
---|---|---|---|
type | input type | An input type, changes how the input is displayed and validated. | type="number" |
placeholder | string | Placeholder text when no input has been given. | placeholder="Enter name..." |
enabled | boolean | Whether the element is disabled or not.true by default | enabled="false" |
prompt | string | When clicked, this prompt is shown to a player to tell them to input text | prompt="Type your password" |
type
Attribute
Value | Description | Input example |
---|---|---|
text (Default) | Regular text input, no validation or rendering changes are applied | Hello, world! |
number | Input must be a valid Double in Java, input is validated before being submitted | 1.431 |
password | Input is not validated but is displayed as asterisks ("*") | my cool password |
placeholder
Attribute
This attribute changes the placeholder text shown to players when no input has been submitted.
If the attribute is not explicitly set, then it defaults to "..."
.
prompt
Attribute
When a player clicks on the input element to input something, they are shown a
prompt in chat that tells them to type something in chat. This attribute
controls the message shown.
Note: The attribute’s value is parsed as a MiniMessage, soprompt="<red>GIVE ME YOUR MONEY"
will show a red prompt.
Default Styling
input {
display: block;
width: 100%;
outline: 0.5px;
outline-color: white;
padding: 0.5px;
background-color: black;
box-sizing: border-box;
&:hover {
color: gray;
outline-color: darkgray;
}
&:disabled {
color: gray;
outline-color: darkgray;
}
&::placeholder {
color: gray;
italic: true;
}
}
Examples
<input type="number"/>
<input enabled="false"/>
<input type="number" placeholder="Enter your height (m)"/>
<input prompt="Enter your password" placeholder="Password..." type="password"/>