Overriding class/styling of Upload Component buttons

1 Answer 31 Views
Upload
Phillip
Top achievements
Rank 1
Phillip asked on 30 Jan 2024, 05:03 PM
I'm using Upload for Angular in my app. I need to style the Clear and Upload buttons to match the rest of my app. I've tried many things but nothing is working. I'm looking to override all of the class attributes of these buttons and assign 'btn btn-bare' to Clear and 'btn btn-primary' to Upload.

1 Answer, 1 is accepted

Sort by
0
Hetali
Telerik team
answered on 30 Jan 2024, 07:08 PM

Hello Phillip,

In order to override the class of the buttons in the Kendo UI Upload component, use the setTimeout method in the select event to change the class name. For example:

<kendo-upload
  [autoUpload]="false"
  (select)="fileSelected()"
>
</kendo-upload>
public fileSelected() {  
  setTimeout(() => {
    var upload = document.querySelector(".k-upload-selected");
    upload.className = "btn btn-primary";
    var clear = document.querySelector(".k-clear-selected");
    clear.className = "btn btn-bare";
  });
}

In this StackBlitz example, I have changed the class name of the Upload and the Clear button.

I hope this helps. Please let me know if I can further assist you.

Regards,
Hetali
Progress Telerik

Stay tuned by visiting our public roadmap and feedback portal pages! Or perhaps, if you are new to our Kendo family, check out our getting started resources
Phillip
Top achievements
Rank 1
commented on 31 Jan 2024, 01:14 PM

Thank you so much, Hetali. setTimeout was the missing piece.
Tags
Upload
Asked by
Phillip
Top achievements
Rank 1
Answers by
Hetali
Telerik team
Share this question
or