A form control that lets the user select one or more files, or a folder.
- Element
-
igc-file-input
- Slots
-
prefix— Renders content before the input. -
suffix— Renders content after the input. -
helper-text— Renders content below the input. -
file-selector-text— Renders content for the browse button. -
file-missing-text— Renders content when no file is chosen. -
value-missing— Renders content when the required validation fails. -
custom-error— Renders content when a custom message is set with `setCustomValidity()`. -
invalid— Renders content when the component is in invalid state (validity.valid = false).
- CSS Parts
-
container— The main wrapper that holds all main input elements. -
input— The native input element. -
label— The native label element. -
file-names— The file names wrapper. -
file-selector-button— The browse button wrapper. -
prefix— The prefix wrapper. -
suffix— The suffix wrapper. -
helper-text— The helper text wrapper. -
prefixed— Added to the container and the input when an element that is not hidden is in the prefix slot. -
suffixed— Added to the container and the input when an element that is not hidden is in the suffix slot. -
filled— Added to the container and the input when the control has a value. -
labelled— Added to the container in the material theme when the control has a label. -
start— The wrapper of the prefix in the material theme. -
notch— The wrapper of the label in the material theme. -
filler— The outline segment between the notch and the end in the material theme. -
end— The wrapper of the suffix in the material theme. -
file-parts— The wrapper of the browse button and the file names.
Properties
Section titled "Properties"accept
Section titled "accept"The file types the control accepts, as a comma-separated list.
accept: string = '' Defined in src/components/file-input/file-input.ts:200
autofocus
Section titled "autofocus"Whether the control receives focus automatically.
autofocus: boolean Defined in src/components/file-input/file-input.ts:207
directory
Section titled "directory"Whether the user selects a folder instead of files. The selection then holds
every file in the folder and its subfolders, and the webkitRelativePath of
each file gives its path from the folder.
directory: boolean = false Defined in src/components/file-input/file-input.ts:193
disabled
Section titled "disabled"Inherited from: I18nMixin( EventEmitterMixin< IgcFileInputComponentEventMap, typeof IgcInputBaseComponent >(IgcInputBaseComponent), i18n )
Whether the control is disabled. A disabled control is not validated, and the form does not submit its value.
disabled: boolean Defined in src/internals/mixins/forms/types.ts:35
invalid
Section titled "invalid"Inherited from: I18nMixin( EventEmitterMixin< IgcFileInputComponentEventMap, typeof IgcInputBaseComponent >(IgcInputBaseComponent), i18n )
Whether the control shows the invalid state. It changes only the visual state, not the validity.
invalid: boolean Defined in src/internals/mixins/forms/types.ts:43
label
Section titled "label"Inherited from: I18nMixin( EventEmitterMixin< IgcFileInputComponentEventMap, typeof IgcInputBaseComponent >(IgcInputBaseComponent), i18n )
The label for the control.
label: string Defined in src/components/input/input-base.ts:87
multiple
Section titled "multiple"Whether the control allows the user to select more than one file.
multiple: boolean = false Defined in src/components/file-input/file-input.ts:182
Inherited from: I18nMixin( EventEmitterMixin< IgcFileInputComponentEventMap, typeof IgcInputBaseComponent >(IgcInputBaseComponent), i18n )
The name of the control, submitted with the form data.
name: string Defined in src/internals/mixins/forms/types.ts:49
outlined
Section titled "outlined"Inherited from: I18nMixin( EventEmitterMixin< IgcFileInputComponentEventMap, typeof IgcInputBaseComponent >(IgcInputBaseComponent), i18n )
Whether the control has an outlined appearance.
outlined: boolean = false Defined in src/components/input/input-base.ts:73
placeholder
Section titled "placeholder"Inherited from: I18nMixin( EventEmitterMixin< IgcFileInputComponentEventMap, typeof IgcInputBaseComponent >(IgcInputBaseComponent), i18n )
The placeholder text of the control.
placeholder: string Defined in src/components/input/input-base.ts:80
tagName
Section titled "tagName"The tagName read-only property of the Element interface returns the tag name of the element on which it's called.
tagName: "igc-file-input" = 'igc-file-input' Defined in src/components/file-input/file-input.ts:99
Accessors
Section titled "Accessors"defaultValue
Section titled "defaultValue"Inherited from: I18nMixin( EventEmitterMixin< IgcFileInputComponentEventMap, typeof IgcInputBaseComponent >(IgcInputBaseComponent), i18n )
get defaultValue(): any Defined in src/internals/mixins/forms/types.ts:158
The default value of the control. A form reset restores the value to it.
While the value is unchanged since the start or the last form reset, a new
default also sets the value. The value attribute also sets it.
set defaultValue(value: unknown): void Defined in src/internals/mixins/forms/types.ts:158
Parameters
- value:
unknown
Returns void
files
Section titled "files"The list of selected files.
get files(): FileList Defined in src/components/file-input/file-input.ts:210
Returns FileList
Inherited from: I18nMixin( EventEmitterMixin< IgcFileInputComponentEventMap, typeof IgcInputBaseComponent >(IgcInputBaseComponent), i18n )
The form that the control is associated with, or null.
get form(): HTMLFormElement | null Defined in src/internals/mixins/forms/types.ts:52
Returns HTMLFormElement | null
required
Section titled "required"Inherited from: I18nMixin( EventEmitterMixin< IgcFileInputComponentEventMap, typeof IgcInputBaseComponent >(IgcInputBaseComponent), i18n )
get required(): any Defined in src/internals/mixins/forms/types.ts:188
Whether the control is required. A required control that has no value, or is not checked, fails validation.
set required(value: boolean): void Defined in src/internals/mixins/forms/types.ts:188
Parameters
- value:
boolean
Returns void
validationMessage
Section titled "validationMessage"Inherited from: I18nMixin( EventEmitterMixin< IgcFileInputComponentEventMap, typeof IgcInputBaseComponent >(IgcInputBaseComponent), i18n )
The validation message of the control. It is empty when the control is valid.
get validationMessage(): string Defined in src/internals/mixins/forms/types.ts:61
Returns string
validity
Section titled "validity"Inherited from: I18nMixin( EventEmitterMixin< IgcFileInputComponentEventMap, typeof IgcInputBaseComponent >(IgcInputBaseComponent), i18n )
The validity state of the control.
get validity(): ValidityState Defined in src/internals/mixins/forms/types.ts:55
Returns ValidityState
value
Section titled "value"The value of the control.
get value(): string Defined in src/components/file-input/file-input.ts:171
Returns string
The value of the control: the name of the first selected file, as the native file input gives it. As for the native file input, only an empty string can be set. It clears the selection.
set value(value: string): void Defined in src/components/file-input/file-input.ts:164
Parameters
- value:
string
Returns void
willValidate
Section titled "willValidate"Inherited from: I18nMixin( EventEmitterMixin< IgcFileInputComponentEventMap, typeof IgcInputBaseComponent >(IgcInputBaseComponent), i18n )
Whether the control is a candidate for constraint validation.
get willValidate(): boolean Defined in src/internals/mixins/forms/types.ts:64
Returns boolean
Methods
Section titled "Methods"Inherited from: I18nMixin( EventEmitterMixin< IgcFileInputComponentEventMap, typeof IgcInputBaseComponent >(IgcInputBaseComponent), i18n )
Removes focus from the control.
blur(): void Defined in src/components/input/input-base.ts:107
Returns void
checkValidity
Section titled "checkValidity"Inherited from: I18nMixin( EventEmitterMixin< IgcFileInputComponentEventMap, typeof IgcInputBaseComponent >(IgcInputBaseComponent), i18n )
Checks validity and emits invalid when the control is invalid. Returns
true when the control is valid.
checkValidity(): boolean Defined in src/internals/mixins/forms/types.ts:134
Returns boolean
focus
Section titled "focus"Inherited from: I18nMixin( EventEmitterMixin< IgcFileInputComponentEventMap, typeof IgcInputBaseComponent >(IgcInputBaseComponent), i18n )
Sets focus on the control.
focus(options: FocusOptions): void Defined in src/components/input/input-base.ts:100
Parameters
- options:
FocusOptions
Returns void
reportValidity
Section titled "reportValidity"Inherited from: I18nMixin( EventEmitterMixin< IgcFileInputComponentEventMap, typeof IgcInputBaseComponent >(IgcInputBaseComponent), i18n )
Checks validity. As for a native control, an invalid control emits
invalid and takes the focus. It shows its own validation messages, not
the message of the browser. Returns true when the control is valid.
reportValidity(): boolean Defined in src/internals/mixins/forms/types.ts:141
Returns boolean
select
Section titled "select"Inherited from: I18nMixin( EventEmitterMixin< IgcFileInputComponentEventMap, typeof IgcInputBaseComponent >(IgcInputBaseComponent), i18n )
Selects all the text inside the input.
select(): void Defined in src/components/input/input-base.ts:94
Returns void
setCustomValidity
Section titled "setCustomValidity"Inherited from: I18nMixin( EventEmitterMixin< IgcFileInputComponentEventMap, typeof IgcInputBaseComponent >(IgcInputBaseComponent), i18n )
Sets a custom validation message. The control is invalid while the message is not empty. An empty string removes the custom error.
setCustomValidity(message: string): void Defined in src/internals/mixins/forms/types.ts:147
Parameters
- message:
string