0

I have a lightning-input with type file so I can upload files. I don't want the little box that says "Or drop files" that shows up beside the upload button to show. Is there a way to hide it? upload screenshot

I've already seen the solution at Lightning:input type="file" change the "Upload Files" text, but it isn't working for me in LWC.

.html

<lightning-input
     type="file"
     onchange={handleFileUpload}
     accept="*"
     multiple></lightning-input>

.css

.THIS .slds-file-selector__dropzone .slds-file-selector__text{
    display: none !important;
}

.THIS .slds-file-selector__text .slds-medium-show {
    display: none !important;
}

rendered .html

<span lightning-input_input="" class="slds-file-selector__text slds-medium-show">Or drop files</span>
0

I don't think you can access this because of the shadow dom limiting your access to it. may have to build one from scratch : /

2
  • I was afraid of that, thanks – aaron Sep 24 '20 at 13:55
  • I would recommend using one of the workarounds from that thread, such as loadStyle or <style>. They're kind of hacky but you're going to have a really hard time recreating the standard upload component – Benjamin Vogler Sep 30 '20 at 0:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.