Class FileUpload

File upload component

Hierarchy (View Summary)

Constructors

Properties

$button: HTMLSpanElement
$label: HTMLElement
$status: HTMLSpanElement
$wrapper: HTMLDivElement
i18n: I18n
defaults: FileUploadConfig = ...

File upload default config

elementType: new () => Element = HTMLElement
moduleName: string = 'govuk-file-upload'

Name for the component used when initialising using data-module attributes.

schema: Readonly<{ properties: { i18n: { type: "object" } } }> = ...

File upload config schema

Accessors

Methods

  • Internal Virtual

    configOverride

    Function which defines configuration overrides to prioritize properties from the root element's dataset.

    It should take a subset of configuration as input and return a new configuration object with properties that should be overridden based on the root element's dataset. A Symbol is used for indexing to prevent conflicts.

    Parameters

    Returns ObjectNested

    return - Configuration object

  • Private

    Looks up the <label> element associated to the field

    Returns HTMLElement

    The <label> element associated to the field

    If the <label> cannot be found

  • When a file is dragged over the container, show a visual indicator that a file can be dropped here.

    Parameters

    • event: DragEvent

      the drag event

    Returns void