File Input

Native file browsing and drag/drop selection with permitted file types, optional size limits, individual removal and form submission. A rejected proposal preserves the previous selection. Applications own upload transport, progress, cancellation and retry.

Choose or drop files

Browse with the keyboard or drop several files into the card. Removal keeps the remaining selection intact. Uploads are application-owned.

Attachments

Code

<link
  rel="component"
  href="@threadlabs/looma/components/ui-file-input/ui-file-input.html"
>

<ui-file-input
  label="Attachments"
  name="attachments"
  multiple
></ui-file-input>
<script setup>
  import { UiFileInput } from "@threadlabs/looma";
</script>

<template>
  <UiFileInput
    label="Attachments"
    name="attachments"
    :multiple="true"
  />
</template>
import { UiFileInput } from "@threadlabs/looma";

export default function Example() {
  return <UiFileInput
    label="Attachments"
    name="attachments"
    multiple
  />;
}
/** @jsxImportSource preact */
import { UiFileInput } from "@threadlabs/looma";

export default function Example() {
  return <UiFileInput
    label="Attachments"
    name="attachments"
    multiple
  />;
}
<script>
  import { UiFileInput } from "@threadlabs/looma";
</script>

<UiFileInput
  label="Attachments"
  name="attachments"
  multiple
/>
import { Component } from "@angular/core";
import { UiFileInput } from "@threadlabs/looma";

@Component({
  selector: "example-view",
  standalone: true,
  imports: [UiFileInput],
  template: `
    <ng-template
      ui-file-input
      [label]="'Attachments'"
      [name]="'attachments'"
      [multiple]="true"
    ></ng-template>
  `,
})
export default class Example {}

Limit selection

This example accepts PDF files up to five million bytes each. Limits are explicit application choices, not library defaults.

Document

Code

<link
  rel="component"
  href="@threadlabs/looma/components/ui-file-input/ui-file-input.html"
>

<ui-file-input
  label="Document"
  name="document"
  accept=".pdf"
  max-file-size="5000000"
></ui-file-input>
<script setup>
  import { UiFileInput } from "@threadlabs/looma";
</script>

<template>
  <UiFileInput
    label="Document"
    name="document"
    accept=".pdf"
    :max-file-size="5000000"
  />
</template>
import { UiFileInput } from "@threadlabs/looma";

export default function Example() {
  return <UiFileInput
    label="Document"
    name="document"
    accept=".pdf"
    maxFileSize={5000000}
  />;
}
/** @jsxImportSource preact */
import { UiFileInput } from "@threadlabs/looma";

export default function Example() {
  return <UiFileInput
    label="Document"
    name="document"
    accept=".pdf"
    maxFileSize={5000000}
  />;
}
<script>
  import { UiFileInput } from "@threadlabs/looma";
</script>

<UiFileInput
  label="Document"
  name="document"
  accept=".pdf"
  maxFileSize={5000000}
/>
import { Component } from "@angular/core";
import { UiFileInput } from "@threadlabs/looma";

@Component({
  selector: "example-view",
  standalone: true,
  imports: [UiFileInput],
  template: `
    <ng-template
      ui-file-input
      [label]="'Document'"
      [name]="'document'"
      [accept]="'.pdf'"
      [maxFileSize]="5000000"
    ></ng-template>
  `,
})
export default class Example {}

API

Package: @threadlabs/looma · Native root: ui-card

Attributes

NameDescriptionPropertyTypeDefaultAllowed values
acceptComma-separated extensions or MIME types, such as .pdf,image/*. Applies to browsing and dropping after upgrade; servers still validate files.acceptstring—
disabledPrevents browsing, dropping and removal, and omits files from native submission.disabledbooleanfalse—
formOptional ID of a form outside the component's ancestor tree.formstring—
input-idOptional native file input ID for an external label.inputIdstring—
invalidExternal invalid appearance supplied by the application.invalidbooleanfalse—
labelVisible heading and accessible name for the file input and group.labelstringFiles—
localeIntl locale used to display file sizes.localestringen-US—
max-file-sizeOptional per-file byte limit. Omit for no size restriction; an explicit zero permits only empty files.maxFileSizenumber——
multipleAllows several files in one selection. A new browse or drop replaces the selection, matching the native input.multiplebooleanfalse—
nameNative form field name. Selected files submit as File entries; upload transport remains with the application.namestring—
remove-labelAccessible action prefix, followed by the file name.removeLabelstringRemove—
requiredRequires at least one selected file for submission.requiredbooleanfalse—

Framework props

NameTypeDefaultAllowed values
acceptstring—
disabledbooleanfalse—
formstring—
inputIdstring—
invalidbooleanfalse—
labelstringFiles—
localestringen-US—
maxFileSizenumber——
multiplebooleanfalse—
namestring—
removeLabelstringRemove—
requiredbooleanfalse—

Events

NameDetailDescription
changeobject
  • files: list(unknown) (required)
  • trigger: keyword (required)
Emitted when a toggleable control changes checked state.
rejectobject
  • files: list(unknown) (required)
  • message: string (required)
Emitted with the declared detail payload.

Slots

NamePurpose
defaultDefault child content.
footerNamed content for the footer region.

Design tokens

Set shared theme properties on a theme boundary. Component hooks apply only to their owning component.

Component tokens

No component tokens.

Shared tokens

No shared tokens.