diff options
| author | Julien Déramond <[email protected]> | 2022-10-30 02:30:59 +0200 |
|---|---|---|
| committer | GitHub <[email protected]> | 2022-10-29 20:30:59 -0400 |
| commit | 06bed9b45af290b05fed9ec003a89af1d3baf6a4 (patch) | |
| tree | 2e21571b014357439b8c41cee058c1a0f607c178 | |
| parent | 678dde8f984a00cc56724721252a0e5f49cca3fb (diff) | |
| download | bootstrap-06bed9b45af290b05fed9ec003a89af1d3baf6a4.tar.xz bootstrap-06bed9b45af290b05fed9ec003a89af1d3baf6a4.zip | |
Fix disabled floating labels and add some examples of it in the docs (#37299)
* Fix disabled floating labels and add some examples of it in the docs
* Add disabled custom height textarea
| -rw-r--r-- | scss/forms/_floating-labels.scss | 2 | ||||
| -rw-r--r-- | site/content/docs/5.2/forms/floating-labels.md | 28 |
2 files changed, 29 insertions, 1 deletions
diff --git a/scss/forms/_floating-labels.scss b/scss/forms/_floating-labels.scss index 93c1c2205..e5e35d326 100644 --- a/scss/forms/_floating-labels.scss +++ b/scss/forms/_floating-labels.scss @@ -1,7 +1,7 @@ .form-floating { position: relative; - &::before { + &::before:not(.form-control:disabled) { position: absolute; top: $input-border-width; left: $input-border-width; diff --git a/site/content/docs/5.2/forms/floating-labels.md b/site/content/docs/5.2/forms/floating-labels.md index 9ec4fcd2f..6b33fb67b 100644 --- a/site/content/docs/5.2/forms/floating-labels.md +++ b/site/content/docs/5.2/forms/floating-labels.md @@ -75,6 +75,34 @@ Other than `.form-control`, floating labels are only available on `.form-select` </div> {{< /example >}} +## Disabled + +Add the `disabled` boolean attribute on an input, a textarea or a select to give it a grayed out appearance, remove pointer events, and prevent focusing. + +{{< example >}} +<div class="form-floating mb-3"> + <input type="email" class="form-control" id="floatingInputDisabled" placeholder="[email protected]" disabled> + <label for="floatingInputDisabled">Email address</label> +</div> +<div class="form-floating mb-3"> + <textarea class="form-control" placeholder="Leave a comment here" id="floatingTextareaDisabled" disabled></textarea> + <label for="floatingTextareaDisabled">Comments</label> +</div> +<div class="form-floating mb-3"> + <textarea class="form-control" placeholder="Leave a comment here" id="floatingTextarea2Disabled" style="height: 100px" disabled></textarea> + <label for="floatingTextarea2Disabled">Comments</label> +</div> +<div class="form-floating"> + <select class="form-select" id="floatingSelectDisabled" aria-label="Floating label disabled select example" disabled> + <option selected>Open this select menu</option> + <option value="1">One</option> + <option value="2">Two</option> + <option value="3">Three</option> + </select> + <label for="floatingSelectDisabled">Works with selects</label> +</div> +{{< /example >}} + ## Readonly plaintext Floating labels also support `.form-control-plaintext`, which can be helpful for toggling from an editable `<input>` to a plaintext value without affecting the page layout. |
