Font Awesome Build Awesome
Try SSR Server-side rendering (SSR) generates component HTML on the server before the page loads, improving SEO and initial load time. Use the switch to see Web Awesome components render with and without SSR.
Search this website ⌘KCtrl+K Light Dark System Docs Select Color Scheme Default Awesome Shoelace Yoummday Light Yoummday Dark Active Brutalist Glossy Matter Mellow Playful Premium Tailspin Docs Select Theme View Project on GitHub Star Project on GitHub
Start Components Docs Help
Web Awesome Font Awesome Build Awesome
Search this site… /
Try SSR Server-side rendering (SSR) generates component HTML on the server before the page loads, improving SEO and initial load time. Use the switch to see Web Awesome components render with and without SSR.
Light Dark System Docs Select Color Scheme Default Awesome Shoelace Yoummday Light Yoummday Dark Active Brutalist Glossy Matter Mellow Playful Premium Tailspin Docs Select Theme

Getting Started

  • Installation
  • Usage
  • Forms
  • Localization
  • Frameworks
  • Using with AI
  • Figma Design Kit ProThis requires access to Web Awesome Pro
  • Server Rendering

Resources

  • Accessibility
  • Browser Support
  • Contributing
  • Patterns ProPatterns require access to Web Awesome Pro
  • Migrating from Shoelace
  • Visual Tests
  • Component Showcase
  • Changelog
  • Help & Support

Theming & Utilities

  • Overview
  • Built-in Themes
  • Color Palettes
  • Design Tokens
  • Customizing & Theming
  • CSS Utilities

Actions

  • Button
  • Button Group
  • Button Row
  • Copy Button
  • Dropdown
    • Dropdown Item

Forms

  • Checkbox
  • Checkbox Group
  • Color Picker
  • File Upload
  • Input
  • Known Date
  • Number Input
  • OTP Input
  • Radio Group
    • Radio
  • Rating
  • Select
    • Option
  • Slider
  • Switch
  • Textarea
  • Time Input

Layout

  • Accordion
    • Accordion Item
  • Card
  • Content Header
  • Details
  • Dialog
  • Divider
  • Drawer
  • Page
  • Page Header
  • Scroller
  • Split Panel

Navigation

  • Breadcrumb
    • Breadcrumb Item
  • Navigation Entry
  • Pagination
  • Tab Group
    • Tab
    • Tab Panel
  • Tree
    • Tree Item

Feedback

  • Badge
  • Callout
  • Empty State
  • Progress
  • Progress Bar
  • Progress Ring
  • Progress Ring Group
  • Skeleton
  • Spinner
  • Tag
  • Toast
    • Toast Item
  • Tooltip

Media

  • Animated Image
  • Avatar
  • Carousel
    • Carousel Item
  • Comparison
  • Icon
  • Markdown
  • QR Code
  • Zoomable Frame

Data Viz

  • Advanced Usage

Helpers

  • Animation
  • Format Bytes
  • Format Date
  • Format Number
  • Include
  • Intersection Observer
  • Mutation Observer
  • Popover
  • Popup
  • Random Content
  • Relative Time
  • Resize Observer

File Upload

  • Examples
  • Basic usage
  • Restrict accepted file types
  • Hide the preview row
  • Notes
  • API
  • Importing
  • Slots
  • Attributes & Properties
  • Methods
  • Events
  • CSS Custom Properties
  • CSS Parts
  • Dependencies
On This Page...
  • Examples
  • Basic usage
  • Restrict accepted file types
  • Hide the preview row
  • Notes
  • API
  • Importing
  • Slots
  • Attributes & Properties
  • Methods
  • Events
  • CSS Custom Properties
  • CSS Parts
  • Dependencies

File Upload

<wa-file-upload>
Experimental added Forms Since ymmd-0.3

Drop or select a single file with Yoummday's legacy preview-oriented upload UI.

Drop your resume here

or click to browse

<wa-file-upload name="resume" accept=".pdf,.doc,.docx" required>
  <strong>Drop your resume here</strong>
  <p>or click to browse</p>
</wa-file-upload>

Examples

Link to This Section

Basic usage

Link to This Section

Use the default slot to explain what the user can upload.

Select a document

Drag a file here or click to choose one.

<wa-file-upload name="document">
  <strong>Select a document</strong>
  <p>Drag a file here or click to choose one.</p>
</wa-file-upload>

Restrict accepted file types

Link to This Section

The accept attribute supports file extensions and MIME types.

Upload a profile image

PNG, JPG, and WebP are supported.

<wa-file-upload name="avatar" accept=".jpg,.jpeg,.png,image/webp">
  <strong>Upload a profile image</strong>
  <p>PNG, JPG, and WebP are supported.</p>
</wa-file-upload>

Hide the preview row

Link to This Section

Use no-preview when the surrounding UI already shows the selected file.

Replace avatar

Choose a new image to continue.

<wa-file-upload name="avatar" icon="" no-preview>
  <strong>Replace avatar</strong>
  <p>Choose a new image to continue.</p>
</wa-file-upload>

Notes

Link to This Section
  • wa-file-upload submits a single file with native FormData.
  • The component emits native input and change events from the host element.
  • This component is Yoummday-owned and is separate from Web Awesome Pro's wa-file-input.

API

Link to This Section

Importing

Link to This Section

If you're using the autoloader or a hosted project, components load on demand — no manual import needed. To cherry-pick a component manually, use one of the following snippets.

CDN npm Self-Hosted React

Import this component directly from the CDN:

import 'https://cdn.yoummday.com/packages/@yoummday/webawesome/0.5.1/dist/components/file-upload/file-upload.js';

After installing Web Awesome via npm, import this component:

import '@yoummday/webawesome/dist/components/file-upload/file-upload.js';

If you're self-hosting Web Awesome, import this component from your server:

import './webawesome/dist/components/file-upload/file-upload.js';

To import this component for React 18 or below, use the following code:

import WaFileUpload from '@yoummday/webawesome/dist/react/file-upload/index.js';

Slots

Link to This Section

Learn more about using slots.

Name Description
(default) Supportive content rendered inside the drop zone.

Attributes & Properties

Link to This Section

Learn more about attributes and properties.

Name Description Reflects
accept
accept
Comma-separated list of file extensions or MIME types that are allowed.
Type string
Default '.jpg,.jpeg,.png'
disabled
disabled
Disables the form control.
Type boolean
Default false
form
By default, form controls are associated with the nearest containing <form> element. This attribute allows you to place the form control outside of a form and associate it with the form that has this id. The form must be in the same document or shadow root for this to work.
Type HTMLFormElement | null
icon
icon
The icon to display in the drop zone. Set an empty string to hide it.
Type string
Default 'mdi:cloud-arrow-up'
name
name
The name of the input, submitted as a name/value pair with form data.
Type string | null
Default null
noPreview
no-preview
Disables the filename preview row below the drop zone.
Type boolean
Default false
required
required
Makes the file upload a required field.
Type boolean
Default false
validationTarget
Override this to change where constraint validation popups are anchored.
Type undefined | HTMLElement
validators
Validators are static because they have observedAttributes, essentially attributes to "watch" for changes. Whenever these attributes change, we want to be notified and update the validator.
Type Validator[]
Default []

Methods

Link to This Section

Learn more about methods.

Name Description Arguments
formStateRestoreCallback() Called when the browser is trying to restore element’s state to state in which case reason is "restore", or when the browser is trying to fulfill autofill on behalf of user in which case reason is "autocomplete". In the case of "restore", state is a string, File, or FormData object previously set as the second argument to setFormValue. state: string | File | FormData | null, reason: 'autocomplete' | 'restore'
resetValidity() Reset validity is a way of removing manual custom errors and native validation.
setCustomValidity() Do not use this when creating a "Validator". This is intended for end users of components. We track manually defined custom errors so we don't clear them on accident in our validators. message: string

Events

Link to This Section

Learn more about events.

Name Description
change Emitted when the selected file is committed.
input Emitted when the selected file changes.
wa-invalid Emitted when the form control has been checked for validity and its constraints aren't satisfied.

CSS Custom Properties

Link to This Section

Learn more about CSS custom properties.

Name Description
--wa-file-upload-border-color
Border color of the drop zone.
--wa-file-upload-border-style
Border style of the drop zone.
--wa-file-upload-border-width
Border width of the drop zone.
--wa-file-upload-min-height
Minimum height of the drop zone.

CSS Parts

Link to This Section

Learn more about CSS parts.

Name Description CSS selector
clear-button The button that clears the selected file. ::part(clear-button)
dropzone The clickable and droppable surface. ::part(dropzone)
file-upload The component's outer wrapper. ::part(file-upload)
icon The upload icon. ::part(icon)
input The internal native file input. ::part(input)
preview The preview row shown after a file is selected. ::part(preview)
preview-name The selected file name. ::part(preview-name)
slot-container The container for the slotted element. ::part(slot-container)

Dependencies

Link to This Section

This component automatically imports the following elements. Sub-dependencies, if any exist, will also be included in this list.

  • <wa-button>
  • <wa-icon>
  • <wa-spinner>
Need a hand? Report a bug Ask for help
Go Make Something Awesome
Version 0.5.1 © Fonticons, Inc.
  • Terms
  • Privacy
  • Refunds
  • Core License
  • Pro License

Quick Links

  • Components
  • CSS Utilities
  • Theming
  • Using with AI
  • Changelog
  • Help & Support

Recent Searches

    D'oh! No results for “”

    Suggest on GitHub Ask on Discord
    Navigate Select
    Close Esc