Quantcast
Channel: Active questions tagged blazor - Stack Overflow
Viewing all articles
Browse latest Browse all 4839

How to Style Blazor InputFile Component

$
0
0

I have a Blazor Web Assembly app on dotnet 5. I've added a Microsoft.AspNetCore.Components.Forms.InputFile control to a component. This causes a "Choose Files" button to be rendered.

How can I apply a style to the button?

I'd like the style to be the same as for a bootstrap btn-primary class.

Here's what I tried:

Copied the style from bootstrap.min.css and created a new style in app.css as follows:

input {    color: #fff;    background-color: #007bff;    border-color: #007bff}

The html is:

<button class="btn btn-primary" @onclick="LoadSamples">Load Samples</button><InputFile multiple OnChange="HandleFileSelected" />

The result was not what I'd hoped for:

enter image description here


Viewing all articles
Browse latest Browse all 4839

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>