Blockbench Reference Docs
    Preparing search index...

    Interface FormElementOptions

    interface FormElementOptions {
        buttons?: string[];
        click?: (button_index: number) => void;
        color?: string;
        colorpicker?: any;
        condition?: any;
        default?: any;
        description?: string;
        dimensions?: number;
        editable_range_label?: boolean;
        extensions?: string[];
        filetype?: string;
        force_step?: boolean;
        full_width?: boolean;
        getInterval?: (event: Event) => number;
        height?: number;
        interval_type?: "position" | "rotation";
        label?: string;
        linked_ratio?: boolean;
        list?: string[];
        max?: number;
        min?: number;
        options?:
            | Record<string, string | { name: string }>
            | (() => Record<string, string | { name: string }>);
        placeholder?: string;
        readonly?: boolean;
        readtype?: ReadType | ((file: string) => ReadType);
        resource_id?: string;
        return_as?: "file";
        share_text?: boolean;
        step?: number;
        style?: "checkbox" | "toggle_switch";
        text?: string;
        toggle_default?: boolean;
        toggle_enabled?: boolean;
        type?:
            | "number"
            | "select"
            | "color"
            | "text"
            | "textarea"
            | FormInputType
            | "password"
            | "range"
            | "checkbox"
            | "radio"
            | "vector"
            | "file"
            | "folder"
            | "save"
            | "inline_select"
            | "inline_multi_select"
            | "info"
            | "num_slider"
            | "buttons";
        value?: any;
    }
    Index

    Properties

    buttons?: string[]

    List of buttons for the button type

    click?: (button_index: number) => void

    Runs when any of the buttons is pressed

    Type Declaration

      • (button_index: number): void
      • Parameters

        • button_index: number

          Index of the clicked button in the buttons list

        Returns void

    color?: string

    On num slider inputs, The color of the slider

    colorpicker?: any
    condition?: any
    default?: any

    The default selected option for 'select', 'inline_select' and 'radio' types. Alias for 'value'

    description?: string

    Detailed description of the field, available behind the questionmark icon or on mouse hover

    dimensions?: number

    The number of dimensions when using a vector type

    editable_range_label?: boolean

    When using 'range' type, allow users to modify the numeric input

    extensions?: string[]
    filetype?: string
    force_step?: boolean

    If enabled, the value is forced to multiples of the "step" value. This can be used to create integer-only inputs etc.

    full_width?: boolean

    Stretch the input field across the whole width of the form

    getInterval?: (event: Event) => number

    Function to get the interval value for a num_slider based on the input event

    Type Declaration

      • (event: Event): number
      • Parameters

        Returns number

        Interval value

    height?: number

    The height of the input on textareas, in pixels

    interval_type?: "position" | "rotation"

    For num_sliders, the sliding interval mode

    label?: string
    linked_ratio?: boolean

    Lock the ratio of a vector

    list?: string[]
    max?: number

    On numeric inputs, the maximum possible value

    min?: number

    On numeric inputs, the minimum possible value

    options?:
        | Record<string, string | { name: string }>
        | (() => Record<string, string | { name: string }>)

    Available options on select or inline_select inputs

    placeholder?: string
    readonly?: boolean

    Set the input to read-only

    readtype?: ReadType | ((file: string) => ReadType)
    resource_id?: string
    return_as?: "file"

    Set the return type of files on file inputs

    share_text?: boolean

    Add buttons to allow copying and sharing the text or link

    step?: number

    The step in which the value can be increased / decreased

    style?: "checkbox" | "toggle_switch"

    Visual style of the input. Checkbox inputs support 'checkbox' or 'toggle_switch'

    text?: string

    When using 'text' type, the text to display. Markdown is supported

    toggle_default?: boolean

    Set whether the setting is toggled on or off by default. Requires 'toggle_enabled' field to be set to true

    toggle_enabled?: boolean

    Allow users to toggle the entire option on or off

    type?:
        | "number"
        | "select"
        | "color"
        | "text"
        | "textarea"
        | FormInputType
        | "password"
        | "range"
        | "checkbox"
        | "radio"
        | "vector"
        | "file"
        | "folder"
        | "save"
        | "inline_select"
        | "inline_multi_select"
        | "info"
        | "num_slider"
        | "buttons"

    Type of the input. If unspecified, defaults to text

    value?: any

    The default value