Skip to content

Commit

Permalink
Add truncated example of custom file browser
Browse files Browse the repository at this point in the history
  • Loading branch information
MartijnCuppens authored and XhmikosR committed Apr 30, 2019
1 parent a454ea7 commit f36890d
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions site/content/docs/4.3/components/forms.md
Original file line number Diff line number Diff line change
Expand Up @@ -1303,4 +1303,17 @@ The file input is the most gnarly of the bunch and requires additional JavaScrip
</div>
{{< /example >}}


Longer placeholder text is truncated and an ellipsis is added when there's not enough space.

{{< example >}}
<div class="custom-file">
<input type="file" class="custom-file-input" id="customFileLong">
<label class="custom-file-label" for="customFileLong">
<span class="custom-file-text">Lorem ipsum posuere consectetur est at lobortis nulla vitae elit libero a pharetra augue fusce dapibus tellus ac cursus commodo tortor mauris condimentum nibh ut fermentum massa justo sit amet risus cras mattis consectetur purus sit amet fermentum</span>
<span class="custom-file-button">Browse</span>
</label>
</div>
{{< /example >}}

We hide the default file `<input>` via `opacity` and instead style the `<label>`. The button is generated and positioned with `::after`. Lastly, we declare a `width` and `height` on the `<input>` for proper spacing for surrounding content.

0 comments on commit f36890d

Please sign in to comment.