Skip to content

[feat]: Create <pf-v6-file-upload> element #2693

@markcaron

Description

@markcaron

Summary

Create a <pf-v6-file-upload> web component implementing the PatternFly v6 Simple file upload component.

Single file upload with drag-and-drop support, file type restrictions, and loading states.

Prior Art

Source Element Status
PFE v4 -- --
cem -- --
cockpit -- --
chickadee <chickadee-file-upload> Exists

Design

Notes

Requirements

  • MUST implement PFv6 visual designs
  • MUST provide end-user feature parity with @patternfly/react-core FileUpload
  • MAY adjust element API to leverage web platform strengths
  • SHOULD maintain CSS custom property theming compatibility
  • SHOULD expose useful CSS shadow parts

Element-specific considerations

  • FACE: formAssociated = true, ElementInternals - submits File or file content
  • value (File or string), filename, onChange event
  • accept attr for file type restriction (maps to <input type="file" accept>)
  • isLoading state with spinner during upload
  • isReadOnly / isDisabled states
  • Drag-and-drop zone: dragover, dragleave, drop events; isDragActive state
  • "Browse" button triggers hidden <input type="file">
  • FileUploadField sub-component: text input area for showing filename or pasting text content
  • Text file mode: read file as text (FileReader.readAsText), display in textarea
  • onFileInputChange, onClearClick, onTextChange callbacks
  • Progressive enhancement: functional without JS for basic file input

Checklist

Implementation

  • formAssociated = true
  • ElementInternals for value/validity reporting
  • API per .claude/ADVICE.md
  • CSS uses v6 tokens, logical properties, nesting
  • @summary and JSDoc on element class

Demos

  • Demos match patternfly.org naming/structure
  • CSS custom properties match computed styles from patternfly.org (Chrome MCP)
  • Visual parity verified via Chrome MCP

Tests

  • Public API covered (attributes, properties, events, slots)
  • a11ySnapshot assertions
  • Form submission test

Reviews

  • /review-api passes
  • /review-demos passes
  • /review-a11y passes
  • eslint and stylelint pass

Ship

  • Add changeset
  • PR targets staging/pfv6 (NOT main)

Metadata

Metadata

Assignees

No one assigned

    Labels

    1:1Aligning components with PatternFly v4featureNew feature or requestfor devgood 1st issueGood for newcomers to the project; requires at least an introductory knowledge of the languagenew component requestpriority: mediumSeverity level: 2red hack dayGood issue for Red Hack Day

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions