Picture by Andrew Neel | Unsplash

Demo: attachment

The Attachment is a typical component in a front facing form. Think uploading a resume, an avatar etc.

You can test out the component with any file under 1 Mb. Uploaded files will immediately be discarded.

Source

<!-- Livewire and Blade -->
<x-media-library-attachment
   name="media"
   rules="mimes:png,jpeg,pdf|max:1024"
/>
        
/* React */
<MediaLibraryAttachment
    name="media"
    validationRules={{ accept: ['image/png', 'image/jpeg', 'application/pdf'], maxSizeInKB: 1024  }}
    validationErrors={{ errors }}
/>
        
<!-- Vue -->
<media-library-attachment
    name="media"
    :validation-rules="{ accept: ['image/png', 'image/jpeg', 'application/pdf'], maxSizeInKB: 1024  }"
    :validation-errors="{{ $errors }}"
/>