A custom HTML element responsible for rendering a file input field and associated FilePicker button.

Hierarchy (view full)

Properties

input: HTMLInputElement

The file path selected.

button: HTMLButtonElement

A button to open the file picker interface.

picker: FilePicker

A reference to the FilePicker application instance originated by this element.

_primaryInput: HTMLElement

The primary input (if any). Used to determine what element should receive focus when an associated label is clicked on.

_value: string

The underlying value of the element.

_internals: ElementInternals

Attached ElementInternals which provides form handling functionality.

tagName: string = "file-picker"
formAssociated: boolean = true

Declare that this custom element provides form element functionality.

Accessors

  • get type(): type
  • A type of file which can be selected in this field.

    Returns type

    See

    FilePicker.FILE_TYPES

  • get noupload(): boolean
  • Prevent uploading new files as part of this element's FilePicker dialog.

    Returns boolean

  • get form(): HTMLFormElement
  • The form this element belongs to.

    Returns HTMLFormElement

  • get name(): string
  • The input element name.

    Returns string

  • get disabled(): boolean
  • Is this element disabled?

    Returns boolean

  • get editable(): boolean
  • Is this field editable? The field can be neither disabled nor readonly.

    Returns boolean

Methods

  • Internal

    Apply key attributes on the containing custom HTML element to input elements contained within it.

    Parameters

    • input: any

    Returns void

  • Protected

    Return the value of the input element which should be submitted to the form.

    Returns string

  • Protected

    Translate user-provided input value into the format that should be stored.

    Parameters

    • value: string

      A new value to assign to the element

    Returns void

    Throws

    An error if the provided value is invalid

  • Protected

    Special handling when the custom element is clicked. This should be implemented to transfer focus to an appropriate internal element.

    Parameters

    • event: PointerEvent

    Returns void

  • Handle clicks on the button element to render the FilePicker UI.

    Parameters

    • event: PointerEvent

      The initiating click event

    Returns any

  • Create a HTMLFilePickerElement using provided configuration data.

    Parameters

    • config: any

    Returns HTMLElement