Skip to content

Support Bootstrap 5 alpha 3 floating labels #573

Closed
@thimo

Description

@thimo

Bootstrap 5 alpha 3 supports floating labels: https://v5.getbootstrap.com/docs/5.0/forms/floating-labels/

It would be nice to enable this in bootstrap_form with an option, something like <%= f.text_field :query, floating: true %>.

To enable this a few things must be done in the rendering:

  1. use form-floating as the control class
  2. revert order of input and label elements
  3. add placeholder to input field, fill with label value by default
<div class="form-floating mb-3">
  <input placeholder="Search" class="form-control" type="text" name="filter[query]" id="filter_query">
  <label for="filter_query">Search</label>
</div>

I would love to pick this up, but if anybody else has the time, please feel free to do so. Would also love feedback on how to enable this functionality, is floating: true the right way to do that?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions