Form

File input

Published on

Description Link to section description

The file input allows users to select files from their device. It provides a browser-native file picker.

Example Link to section example

Open in new tab(opens in new tab)
View HTML markup
<form method="POST" novalidate="">
  <div><label for="file"> File w/ dropzone</label> <span id="file-hint">Choose file with .csv</span> <input id="file" name="file" is="ds-input-file" accept=".csv,text/csv" type="file" aria-describedby="file-hint" /> </div> <button type="button">Submit</button>
  <p>Need help? <a href="/form/input-file" target="_top">View our guidance</a></p>
</form>

Accessibility Link to section accessibility

  • Use explicit <label for="id"> association.
  • The file input has limited styling options. Avoid hiding the native control and replacing it with a custom button — this breaks keyboard and assistive technology support.
  • Communicate accepted file types and size limits via hint text using aria-describedby.

References Link to section references

Variables Link to section variables

None for input