This is a migrated thread and some comments may be shown as answers.

Add FontAwesome Icon to Upload Button

2 Answers 774 Views
Upload
This is a migrated thread and some comments may be shown as answers.
John
Top achievements
Rank 1
John asked on 06 Jun 2019, 02:53 PM

How can I add a FontAwesome Icon to the Upload Button?  I'm using the tag helper for the upload control.

 

<kendo-upload drop-zone="drop-zone1" name="Input.RegulationDocument" multiple="false">
    <async auto-upload="true" />
    <validation allowed-extensions="@Model.AllowedExtensions" />
    <localization select="Upload PDF..." clear-selected-files="Remove PDF" />
</kendo-upload>

2 Answers, 1 is accepted

Sort by
0
Accepted
Dimitar
Telerik team
answered on 11 Jun 2019, 11:10 AM
Hello John,

In general, the web version of the FontAwesome 5 could be integrated along with Telerik UI for ASP.NET Core as follows:

1) Reference the required stylesheet in the application layout:

2) Apply the following styles patch in order to ensure that the FontAwesome icons are correctly displayed when added as part of a Telerik UI widget markup:
<style>
    .far.k-sprite,
    .fas.k-sprite,
    .far.k-sprite::before,
    .fas.k-sprite::before {
        font-size: 1em;
    }
</style>

Integrating a FontAwesome icon in the Upload button currently can be achieved via JS:
<kendo-upload id="upload" drop-zone="drop-zone1" name="Input.RegulationDocument" multiple="false">
    <async auto-upload="true" />   
    <localization select="Upload PDF..." clear-selected-files="Remove PDF" />
</kendo-upload>
 
<script>
    $(document).ready(function () {
        var upload = $("#upload").getKendoUpload();
        upload.wrapper.find(".k-upload-button").prepend("<i class='fas fa-home'></i>")
    });
</script>

Regards,
Dimitar
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
John
Top achievements
Rank 1
answered on 11 Jun 2019, 11:58 AM
Great answer.  Thanks!
Tags
Upload
Asked by
John
Top achievements
Rank 1
Answers by
Dimitar
Telerik team
John
Top achievements
Rank 1
Share this question
or