Floating labels

bs-floating-label wraps a single form control plus a <label>, animating the label into the field when the control is empty and lifting it on focus or when a value is present. The wrapper expects exactly one input-like control next to its label.

Basic usage

  
    
      
        <bs-form>
        
    
      
          <bs-floating-label class="d-block">
        
    
      
            <input type="email" placeholder="name@example.com">
        
    
      
            <label>Email address</label>
        
    
      
          </bs-floating-label>
        
    
      
        </bs-form>
        
    
  
    
      
        import { Component } from '@angular/core';
        
    
      
        import { BsFloatingLabelComponent } from '@mintplayer/ng-bootstrap/floating-labels';
        
    
      
        import { BsFormComponent, BsFormControlDirective } from '@mintplayer/ng-bootstrap/form';
        
    
      
        
        
    
      
        @Component({
        
    
      
          selector: 'my-floating-labels-demo',
        
    
      
          templateUrl: './my-floating-labels-demo.component.html',
        
    
      
          imports: [BsFormComponent, BsFormControlDirective, BsFloatingLabelComponent],
        
    
      
        })
        
    
      
        export class MyFloatingLabelsDemoComponent {}