]> git.ipfire.org Git - thirdparty/bootstrap.git/commitdiff
File chooser size (#30040)
authorZedicius <david.van.doninck@gmail.com>
Mon, 23 Mar 2020 17:36:54 +0000 (18:36 +0100)
committerGitHub <noreply@github.com>
Mon, 23 Mar 2020 17:36:54 +0000 (18:36 +0100)
Co-authored-by: David Van Doninck <david.vandoninck@intracto.com>
Co-authored-by: XhmikosR <xhmikosr@gmail.com>
Co-authored-by: Martijn Cuppens <martijn.cuppens@gmail.com>
scss/_variables.scss
scss/forms/_form-file.scss
site/content/docs/4.3/forms/file.md

index 8c3c046d410c8e34c8d56b786db07f5a6cd86828..21b497784ee67664c6584ab239b7902ba4942922 100644 (file)
@@ -747,6 +747,16 @@ $form-file-box-shadow:            $input-box-shadow !default;
 $form-file-button-color:          $form-file-color !default;
 $form-file-button-bg:             $input-group-addon-bg !default;
 
+$form-file-padding-y-sm:          $input-padding-y-sm !default;
+$form-file-padding-x-sm:          $input-padding-x-sm !default;
+$form-file-font-size-sm:          $input-font-size-sm !default;
+$form-file-height-sm:             $input-height-sm !default;
+
+$form-file-padding-y-lg:          $input-padding-y-lg !default;
+$form-file-padding-x-lg:          $input-padding-x-lg !default;
+$form-file-font-size-lg:          $input-font-size-lg !default;
+$form-file-height-lg:             $input-height-lg !default;
+
 
 // Form validation
 
index 8e9c6c4438fd3f305a8411e77ad956592e5c1e58..947f77aca69a01c1b1c294ada3d4ab55a3fd9e15 100644 (file)
@@ -7,7 +7,7 @@
   position: relative;
   z-index: 2;
   width: 100%;
-  height: $form-file-height;
+  height: 100%;
   margin: 0;
   opacity: 0;
 
@@ -32,7 +32,7 @@
   left: 0;
   z-index: 1;
   display: flex;
-  height: $form-file-height;
+  height: 100%;
   border-color: $form-file-border-color;
   @include border-radius($form-file-border-radius);
   @include box-shadow($form-file-box-shadow);
   border-width: $form-file-border-width;
   @include border-right-radius(inherit);
 }
+
+.form-file-sm {
+  height: $form-file-height-sm;
+  @include font-size($form-file-font-size-sm);
+
+  .form-file-text,
+  .form-file-button {
+    padding: $form-file-padding-y-sm $form-file-padding-x-sm;
+  }
+}
+
+.form-file-lg {
+  height: $form-file-height-lg;
+  @include font-size($form-file-font-size-lg);
+
+  .form-file-text,
+  .form-file-button {
+    padding: $form-file-padding-y-lg $form-file-padding-x-lg;
+  }
+}
index bbf4afd98672fb22e28980010b29591234f62b5b..466e7b09503668856d3c2f39ac5330cff2cb4388 100644 (file)
@@ -3,13 +3,15 @@ layout: docs
 title: File browser
 description: Use our custom file inputs for consistent cross-browser styling, built-in customization, and lightweight JavaScript.
 group: forms
-toc: false
+toc: true
 ---
 
 {{< callout info >}}
-The recommended plugin to animate custom file input: [bs-custom-file-input](https://www.npmjs.com/package/bs-custom-file-input), that's what we are using currently here in our docs.
+The recommended plugin to animate custom file inputs is [bs-custom-file-input](https://www.npmjs.com/package/bs-custom-file-input); it's what we use here in our docs.
 {{< /callout >}}
 
+## Default
+
 The file input is the most gnarly of the bunch and requires additional JavaScript if you'd like to hook them up with functional *Choose file...* and selected file name text.
 
 {{< example >}}
@@ -47,3 +49,25 @@ Longer placeholder text is truncated and an ellipsis is added when there's not e
 {{< /example >}}
 
 We hide the default file `<input>` via `opacity` and instead style the `<label>`, and declare a `width` and `height` on the `<input>` for proper spacing for surrounding content.
+
+## Sizing
+
+You may also choose from small and large file inputs to match our similarly sized text inputs.
+
+{{< example >}}
+<div class="form-file form-file-lg mb-3">
+  <input type="file" class="form-file-input" id="customFileLg">
+  <label class="form-file-label" for="customFileLg">
+    <span class="form-file-text">Choose file...</span>
+    <span class="form-file-button">Browse</span>
+  </label>
+</div>
+
+<div class="form-file form-file-sm">
+  <input type="file" class="form-file-input" id="customFileSm">
+  <label class="form-file-label" for="customFileSm">
+    <span class="form-file-text">Choose file...</span>
+    <span class="form-file-button">Browse</span>
+  </label>
+</div>
+{{< /example >}}