Skip to content
GitLab
    • Explore Projects Groups Snippets
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • B bootstrap
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 263
    • Issues 263
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 114
    • Merge requests 114
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Bootstrap
  • bootstrap
  • Merge requests
  • !32840

Support floating labels on `.form-control-plaintext`

  • Review changes

  • Download
  • Email patches
  • Plain diff
Merged Administrator requested to merge github/fork/SPodjasek/floating-labels-plaintext into main 4 years ago
  • Overview 7
  • Commits 3
  • Pipelines 0
  • Changes 2

Created by: SPodjasek

I've made a tiny fix that will allow usage of floating labels with .form-control-plaintext elements.

Before: screenshot-20210119_153457

After: screenshot-20210119_153601

I'm not sure that this requires a dedicated section in the documentation, but as part of PoC, I've made one, so it's included. Feel free to wipe it out.

Preview: https://deploy-preview-32840--twbs-bootstrap.netlify.app/docs/5.0/forms/floating-labels/#readonly-plain-text

Compare
  • main (base)

and
  • latest version
    14ac7cac
    3 commits, 2 years ago

2 files
+ 25
- 3

    Preferences

    File browser
    Compare changes
scss/‎forms‎
_floating-‎labels.scss‎ +10 -3
site/content/‎docs/5.1/forms‎
floating-‎labels.md‎ +15 -0
scss/forms/_floating-labels.scss
+ 10
- 3
  • View file @ 14ac7cac

  • Edit in single-file editor

  • Open in Web IDE


@@ -2,6 +2,7 @@
position: relative;
> .form-control,
> .form-control-plaintext,
> .form-select {
height: $form-floating-height;
line-height: $form-floating-line-height;
@@ -19,8 +20,8 @@
@include transition($form-floating-transition);
}
// stylelint-disable no-duplicate-selectors
> .form-control {
> .form-control,
> .form-control-plaintext {
padding: $form-floating-padding-y $form-floating-padding-x;
&::placeholder {
@@ -46,6 +47,7 @@
> .form-control:focus,
> .form-control:not(:placeholder-shown),
> .form-control-plaintext,
> .form-select {
~ label {
opacity: $form-floating-label-opacity;
@@ -59,5 +61,10 @@
transform: $form-floating-label-transform;
}
}
// stylelint-enable no-duplicate-selectors
> .form-control-plaintext {
~ label {
border-width: $input-border-width 0; // Required to properly position label text - as explained above
}
}
}
site/content/docs/5.1/forms/floating-labels.md
+ 15
- 0
  • View file @ 14ac7cac

  • Edit in single-file editor

  • Open in Web IDE


@@ -75,6 +75,21 @@ Other than `.form-control`, floating labels are only available on `.form-select`
</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.
{{< example >}}
<div class="form-floating mb-3">
<input type="email" readonly class="form-control-plaintext" id="floatingEmptyPlaintextInput" placeholder="name@example.com">
<label for="floatingEmptyPlaintextInput">Empty input</label>
</div>
<div class="form-floating mb-3">
<input type="email" readonly class="form-control-plaintext" id="floatingPlaintextInput" placeholder="name@example.com" value="name@example.com">
<label for="floatingPlaintextInput">Input with value</label>
</div>
{{< /example >}}
## Layout
When working with the Bootstrap grid system, be sure to place form elements within column classes.
0 Assignees
None
Assign to
0 Reviewers
None
Request review from
Labels
0
None
0
None
    Assign labels
  • Manage project labels

Milestone
No milestone
None
None
Time tracking
No estimate or time spent
Lock merge request
Unlocked
0
0 participants
Reference: firstcontributions/first-contributions!65096
Source branch: github/fork/SPodjasek/floating-labels-plaintext

Menu

Explore Projects Groups Snippets