<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

AttributeValueDescriptionExample
typeinput typeAn input type, changes how the input is displayed and validated.type="number"
placeholderstringPlaceholder text when no input has been given.placeholder="Enter name..."
enabledbooleanWhether the element is disabled or not.
true by default
enabled="false"
promptstringWhen clicked, this prompt is shown to a player to tell them to input textprompt="Type your password"

type Attribute

ValueDescriptionInput example
text (Default)Regular text input, no validation or rendering changes are appliedHello, world!
numberInput must be a valid Double in Java, input is validated before being submitted1.431
passwordInput 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, so
prompt="<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"/>