Skip to content

TextField can't work with <Input type='file' /> #10063

@jim-king-2000

Description

@jim-king-2000

Provide a general summary of the feature here

<TextField> does not appear to work correctly with <Input type="file" webkitdirectory />.

When a directory is selected, the native file input works correctly by itself. However, once wrapped inside <TextField>, the control still displays “No files selected”.

<TextField
  validationBehavior='native'
  variant='secondary'
  isRequired
  name='files'
  aria-label='files'
>
  <NativeLabel>Select a directory</NativeLabel>
  <Input type='file' webkitdirectory='true' />
  <FieldError />
</TextField>

This is particularly important for RSC + Server Action workflows, because this pattern provides several advantages:

  • The selected files are available directly in onSubmit.
  • The dialog can remain a pure RSC implementation.
  • Validation errors can be displayed automatically through <FieldError>.
  • The flow works naturally with uncontrolled components and Server Actions.
  • The dialog remains loosely coupled and can be split into multiple components when needed.

At the moment, the Picker component does not provide these advantages.

🤔 Expected Behavior?

After selecting a directory, the input should behave like a normal native file input and display something like:

12 files selected

😯 Current Behavior

After selecting a directory, the input still shows:

No files selected

even though the files are actually available in the form submission.

💁 Possible Solution

Maybe this requires:

  • proper support for <Input type="file"> inside <TextField>, or
  • a dedicated <FileField> component, or
  • a more generic <Field> wrapper that works with native file inputs.

🔦 Context

Steps to reproduce:

  1. Start the app and open localhost:3000.
  2. Click the “Select a directory” button.
  3. Select a local directory.
  4. Notice that the UI still shows “No files selected”.

💻 Examples

No response

🧢 Your Company/Team

No response

🕷 Tracking Issue

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions