Top

Forms


Looks good!
Looks good!
@
Please choose a username.
Please provide a valid city.
Please select a valid state.
Please provide a valid zip.
You must agree before submitting.

<div class="card height-equal">
    <div class="card-header pb-0">
        <h4>Validation form</h4>
        <p class="f-m-light mt-1">Custom feedback styles apply custom colors, borders, focus styles, and background
            icons to better communicate feedback.Background icons for <code>&lt;select&gt;</code>s are only available
            with <code>.form-select</code> and not <code>.form-control.</code></p>
    </div>
    <div class="card-body">
        <form class="row g-3 needs-validation custom-input" novalidate="" [ngClass]="{'was-validated': validate}">
            <div class="col-12">
                <label class="form-label" for="validationCustom01">First name</label>
                <input class="form-control" id="validationCustom01" type="text" placeholder="Mark" required="">
                <div class="invalid-feedback">Please enter your valid </div>
                <div class="valid-feedback">Looks's Good!</div>
            </div>
            <div class="col-12">
                <label class="col-sm-12 col-form-label" for="inputPassword1">Password</label>
                <input class="form-control" id="inputPassword1" type="password" required="">
                <div class="invalid-feedback">Please enter your valid password </div>
            </div>
            <div class="col-12">
                <label class="form-label" for="validationCustom04">State</label>
                <select class="form-select" id="validationCustom04" required="">
                    <option selected="" disabled="" value="">Choose...</option>
                    <option>U.K </option>
                    <option>India </option>
                    <option>Thailand</option>
                    <option>Newyork</option>
                </select>
                <div class="invalid-feedback">Please select a valid state.</div>
                <div class="valid-feedback">Looks's Good! </div>
            </div>
            <div class="col-md-6">
                <label class="form-label" for="validationCustom03">City</label>
                <input class="form-control" id="validationCustom03" type="text" required="">
                <div class="invalid-feedback">Please provide a valid city.</div>
                <div class="valid-feedback">
                    Looks's Good!</div>
            </div>
            <div class="col-md-6">
                <label class="form-label" for="validationCustom05">Zip</label>
                <input class="form-control" id="validationCustom05" type="text" required="">
                <div class="invalid-feedback">Please provide a valid zip.</div>
                <div class="valid-feedback">
                    Looks's Good!</div>
            </div>
            <div class="col-12">
                <div class="card-wrapper border rounded-3 checkbox-checked">
                    <h6 class="sub-title">Select your payment method</h6>
                    <div class="radio-form">
                        <div class="form-check">
                            <input class="form-check-input" id="validationFormCheck25" type="radio" name="radio-stacked"
                                required="">
                            <label class="form-check-label" for="validationFormCheck25">MaterCard</label>
                        </div>
                        <div class="form-check">
                            <input class="form-check-input" id="validationFormCheck23" type="radio" name="radio-stacked"
                                required="">
                            <label class="form-check-label" for="validationFormCheck23">VISA</label>
                        </div>
                    </div>
                </div>
            </div>
            <div class="col-12">
                <select class="form-select" required="" aria-label="select example">
                    <option value="">Select Your Favorite Pixelstrap theme</option>
                    <option value="1">oliva</option>
                    <option value="2">Tivo</option>
                    <option value="3">Wingo</option>
                </select>
                <div class="invalid-feedback">Invalid select feedback</div>
            </div>
            <div class="col-12">
                <label class="form-label" for="formFile1">Choose File</label>
                <input class="form-control" id="formFile1" type="file" aria-label="file example" required="">
                <div class="invalid-feedback">Invalid form file selected</div>
            </div>
            <div class="col-12">
                <label class="form-label" for="validationTextarea">Description</label>
                <textarea class="form-control" id="validationTextarea" placeholder="Enter your comment"
                    required=""></textarea>
                <div class="invalid-feedback">Please enter a message in the textarea.</div>
            </div>
            <div class="col-12">
                <div class="form-check">
                    <input class="form-check-input" id="invalidCheck" type="checkbox" value="" required="">
                    <label class="form-check-label" for="invalidCheck">Agree to terms and conditions</label>
                    <div class="invalid-feedback">You must agree before submitting.</div>
                </div>
            </div>
            <div class="col-12">
                <button class="btn btn-primary" type="submit" (click)="submit()">Submit form</button>
            </div>
        </form>
    </div>
</div>

ts file

import { Component } from '@angular/core';
import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms';

@Component({
    selector: 'app-forms-validation',
    templateUrl: './forms-validation.html',
    styleUrls: ['./forms-validation.scss'],
    imports: [FormsModule, CommonModule]
})
export class FormsValidation {

  public validate = false;

  public submit() {
    this.validate = !this.validate;
  }

}

<form class="form theme-form">
 <div class="card-body p-0">
  <div class="row">
   <div class="col">
    <div class="mb-3">
      <label class="form-label" for="exampleFormControlInput1">Email address</label>
      <input class="form-control" id="exampleFormControlInput1" type="email" placeholder="name@example.com" data-bs-original-title="" title="">
    </div>
   </div>
  </div>
 </div>
</form>
<div class="row">
 <div class="custom-radio-ml col-lg-3 col-md-6">
  <div class="form-check radio radio-primary">
   <input class="form-check-input" id="radio1" type="radio" name="radio1" value="option1" data-bs-original-title="" title="">
   <label class="form-check-label" for="radio1">Option<span class="digits"> 1</span></label>
  </div>
  <div class="form-check radio radio-primary">
   <input class="form-check-input" id="radio3" type="radio" name="radio1" value="option1" disabled="" data-bs-original-title="" title="">
   <label class="form-check-label" for="radio3">Disabled</label>
  </div>
  <div class="form-check radio radio-primary">
   <input class="form-check-input" id="radio4" type="radio" name="radio1" value="option1" checked="" data-bs-original-title="" title="">
   <label class="form-check-label" for="radio4">Checked</label>
  </div>
</div>
<div class="col-md-6 col-lg-3">
 <div class="form-check checkbox mb-0">
  <input class="form-check-input" id="checkbox1" type="checkbox" data-bs-original-title="" title="">
  <label class="form-check-label my-0" for="checkbox1">Default</label>
 </div>
 <div class="form-check checkbox mb-0">
  <input class="form-check-input" id="checkbox2" type="checkbox" disabled="" data-bs-original-title="" title="">
  <label class="form-check-label my-0" for="checkbox2">Disabled</label>
 </div>
 <div class="form-check checkbox mb-0">
  <input class="form-check-input" id="checkbox3" type="checkbox" checked="" data-bs-original-title="" title="">
  <label class="form-check-label my-0" for="checkbox3">Checked</label>
 </div>
</div>
</div>
Left Addon
@
<form>
<div class="mb-3 m-form__group">
 <div class="form-label">Left Addon</div>
  <div class="input-group">
   <span class="input-group-text">@</span>
   <input class="form-control" type="text" placeholder="Email" data-bs-original-title="" title="">
  </div>
 </div>
</form>
<div class="date-picker">
<input class="datepicker-here form-control digits" placeholder="yyyy-mm-dd" name="dp" [(ngModel)]="model" ngbDatepicker #d="ngbDatepicker" (click)="d.toggle()">

import { Component } from '@angular/core';
import { NgbCalendar, NgbDate, NgbDateParserFormatter, NgbDateStruct, NgbInputDatepicker } from '@ng-bootstrap/ng-bootstrap';
import { FeatherIconsComponent } from '../../../../shared/component/feather-icons/feather-icons';
import { FormsModule } from '@angular/forms';

@Component({
    selector: 'app-datepicker',
    templateUrl: './datepicker.html',
    styleUrls: ['./datepicker.scss'],
    imports: [FormsModule, NgbInputDatepicker, FeatherIconsComponent]
})

export class Datepicker {

  model: NgbDateStruct;

}

<label class="switch">
 <input type="checkbox" checked="" data-bs-original-title="" title="">
 <span class="switch-state"></span>
</label>
<label class="switch">
 <input type="checkbox" data-bs-original-title="" title="">
 <span class="switch-state"></span>
</label>
<fieldset>
@for(data of touchSpinData; track data){
        <div class="touchspin-wrapper">
            <button class="decrement-touchspin btn-touchspin touchspin-{{data.class}}" (click)="decrement(data.id)">
                <i class="fa fa-minus"></i>
            </button>
            <input class="input-touchspin spin-outline-{{data.class}}" type="number" value="{{data.value}}">
            <button class="increment-touchspin btn-touchspin touchspin-{{data.class}}" (click)="increment(data.id)">
                <i class="fa fa-plus"></i>
            </button>
        </div>
        }
To use touchspin you have to add the following script files

import { Component } from '@angular/core';

@Component({
    selector: 'app-default-touch-spin',
    templateUrl: './default-touch-spin.html',
    styleUrls: ['./default-touch-spin.scss'],
})

export class DefaultTouchSpin {

public touchSpinData [
  {
      id: 0,
      class: 'primary',
      value: 0
  },
  {
      id: 1,
      class: 'secondary',
      value: 2
  },
  {
      id: 2,
      class: 'success',
      value: 1
  },
  {
      id: 3,
      class: 'danger',
      value: 8
  },
  {
      id: 4,
      class: 'warning',
      value: 3
  },
  {
      id: 5,
      class: 'info',
      value: 9
  },
  {
      id: 6,
      class: 'dark',
      value: 4
  },
];

  decrement(i: number) {
    if (this.touchSpinData[i].value > 0) {
      this.touchSpinData[i].value -= 1;
    }
  }
  increment(i: number) {
    this.touchSpinData[i].value += 1;
  }

}

Default Placeholder

<ng-select [items]="Placeholder" bindLabel="name" bindValue="id" [multiple]="true"
   placeholder="Select cities" [(ngModel)]="selectedCityIds">
</ng-select>
ts file

import { Component } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { NgSelectModule } from '@ng-select/ng-select';

@Component({
    selector: 'app-default-select',
    templateUrl: './default-select.html',
    styleUrls: ['./default-select.scss'],
    imports: [NgSelectModule, FormsModule]
})
export class DefaultSelect {

  selectedCityIds: string[] = [];
  Placeholder = [
    { id: 1, name: 'Alabama' },
    { id: 2, name: 'Wyoming' },
    { id: 3, name: 'Coming' },
    { id: 4, name: 'Hanry Die' },
    { id: 4, name: 'John Deo' },
  ];
}
You have to add the following style css file for the select2 design
<!-- Select 2 scss -->
@import "../../../node_modules/@ng-select/ng-select/scss/default.theme.scss";

<label for="typeahead-basic">Search for a state:</label>
<input id="typeahead-basic" type="text" class="form-control" [(ngModel)]="model" [ngbTypeahead]="search" />
<hr />
<pre>Model: {{ model | json }}</pre>
ts file

import { Component } from '@angular/core';
import { NgbTypeaheadModule } from '@ng-bootstrap/ng-bootstrap';
import { Observable, OperatorFunction } from 'rxjs';
import { debounceTime, distinctUntilChanged, map } from 'rxjs/operators';
import { FormsModule } from '@angular/forms';
import { JsonPipe } from '@angular/common';

const states = [
	'Alabama',
	'Alaska',
	'American Samoa',
	'Arizona',
	'Arkansas',
	'California',
	'Colorado',
	'Connecticut',
	'Delaware',
	'District Of Columbia',
	'Federated States Of Micronesia',
	'Florida',
	'Georgia',
	'Guam',
	'Hawaii',
	'Idaho',
	'Illinois',
	'Indiana',
	'Iowa',
	'Kansas',
	'Kentucky',
	'Louisiana',
	'Maine',
	'Marshall Islands',
	'Maryland',
	'Massachusetts',
	'Michigan',
	'Minnesota',
	'Mississippi',
	'Missouri',
	'Montana',
	'Nebraska',
	'Nevada',
	'New Hampshire',
	'New Jersey',
	'New Mexico',
	'New York',
	'North Carolina',
	'North Dakota',
	'Northern Mariana Islands',
	'Ohio',
	'Oklahoma',
	'Oregon',
	'Palau',
	'Pennsylvania',
	'Puerto Rico',
	'Rhode Island',
	'South Carolina',
	'South Dakota',
	'Tennessee',
	'Texas',
	'Utah',
	'Vermont',
	'Virgin Islands',
	'Virginia',
	'Washington',
	'West Virginia',
	'Wisconsin',
	'Wyoming',
];

@Component({
	selector: 'ngbd-typeahead-basic'
	imports: [NgbTypeaheadModule, FormsModule, JsonPipe],
	templateUrl: './typeahead-basic.html',
	styles: `.form-control { width: 300px; }`,
})
export class NgbdTypeaheadBasic {
  public model: string;

	search: OperatorFunction = (text$: Observable) =>
		text$.pipe(
			debounceTime(200),
			distinctUntilChanged(),
			map((term) =>
				term.length < 2 ? [] : states.filter((v) => v.toLowerCase().indexOf(term.toLowerCase()) > -1).slice(0, 10),
			),
		);
}