# FileSelect Templates

The FileSelect component provides templates that allow you to customize the rendering of the select files button and the file list items.

* [SelectFilesButtonTemplate](https://www.telerik.com/blazor-ui/documentation/components/fileselect/templates#selectfilesbuttontemplate)
* [FileTemplate](https://www.telerik.com/blazor-ui/documentation/components/fileselect/templates#filetemplate)
* [FileInfoTemplate](https://www.telerik.com/blazor-ui/documentation/components/fileselect/templates#fileinfotemplate)

## SelectFilesButtonTemplate

The `SelectFilesButtonTemplate` allows you to modify the **Select Files...** button. It lets you change the default text of the button and include custom content like an [icon](https://www.telerik.com/blazor-ui/documentation/common-features/icons) or image.

> caption Using FileSelect SelectFilesButtonTemplate

```CSHTML
<TelerikFileSelect>
    <SelectFilesButtonTemplate>
        <TelerikSvgIcon Icon="@SvgIcon.Upload" />
        Click to Select Files for Upload
    </SelectFilesButtonTemplate>
</TelerikFileSelect>
```

## FileTemplate

The `FileTemplate` allows full customization of the items in the file list. When you use this template, all built-in elements such as the file size, name, icon, and action buttons are replaced by the content you provide within the template.

The `FileTemplate` exposes a `context` of type `FileTemplateContext` that provides access to the file information through the `File` property.

The example below demonstrates how to use the `RemoveFileAsync()` method to remove files programmatically from the collection.

> caption Using FileSelect FileTemplate

<demo metaUrl="client/fileselect/templates/" height="250"></demo>

## FileInfoTemplate

The `FileInfoTemplate` allows you to customize the general file information section while preserving the rest of the built-in features such as the file icon and action buttons.

The `FileInfoTemplate` exposes a `context` of type `FileInfoTemplateContext` that provides access to the file information through the `File` property.

> caption Using FileSelect FileInfoTemplate

```CSHTML
<TelerikFileSelect Files="@InitialFiles">
    <FileInfoTemplate Context="fileContext">
        <strong>File Name:</strong> @fileContext.File.Name <br />
        <strong>Size:</strong> @(fileContext.File.Size / 1024) KB
    </FileInfoTemplate>
</TelerikFileSelect>

@code {
    private List<FileSelectFileInfo> InitialFiles { get; set; } = new List<FileSelectFileInfo>()
    {
        new FileSelectFileInfo(){ Id="1", Name="Report", Extension=".pdf", Size = 1024 * 1024 * 2 }
    };
}
```

## See Also

* [FileSelect API](https://www.telerik.com/blazor-ui/documentation/api/telerik.blazor.components.telerikfileselect)
* [FileSelect Overview](https://www.telerik.com/blazor-ui/documentation/components/fileselect/overview)
* [FileSelect Validation](https://www.telerik.com/blazor-ui/documentation/components/fileselect/validation)
* [FileSelect Events](https://www.telerik.com/blazor-ui/documentation/components/fileselect/events)
