But Ionic ha...">

How to style an Ionic input file as a button

I want to create an ion file select button.

<input type="file" id="myFileInput">

But Ionic has no input file type button. So, how can I get a more convenient button than the standard button with the text "Select file"?

+4
source share
2 answers

, , - for css. , . , , .

<label class="myFakeUploadButton" for="myFileInput">Upload</label>
<input type="file" id="myFileInput">
#myFileInput{
  position: absolute;
  opacity: 0;
}

.myFakeUploadButton{
 /* Whatever you want */
}

, :

<input type="file" accept="image/*" capture="camera" (change)="onFileSelected($event)" id="fileInput"/>
<label for="fileInput" icon-only ion-button>
    <ion-icon name="camera"></ion-icon>
</label>
0

Source: https://habr.com/ru/post/1625027/


All Articles