Basic Forms
Dokumentasi Bootstrap Forms
<form>
<div class="mb-3">
<label class="form-label" for="exampleFormControlInput1">Text</label>
<input type="text" id="exampleFormControlInput1" class="form-control" placeholder="John Doe">
</div>
<div class="mb-3">
<label class="form-label" for="exampleFormControlTitleInput2">Text</label>
<input type="text" id="exampleFormControlTitleInput2" class="form-control form-control-title" placeholder="John Doe">
</div>
<div class="mb-3">
<label class="form-label" for="exampleFormControlInput3">Password</label>
<input type="password" id="exampleFormControlInput3" class="form-control" value="********">
</div>
<div class="mb-3">
<label class="form-label">Helper text</label>
<input type="password" class="form-control" value="**********">
<span class="form-text">Your password must be 8-20 characters long, contain letters and numbers, and must not contain spaces, special characters, or emoji.</span>
</div>
<div class="mb-3">
<label class="form-label" for="exampleFormControlInput4">Email</label>
<input type="email" id="exampleFormControlInput4" class="form-control" placeholder="name@example.com">
</div>
<div class="mb-3">
<label class="form-label" for="exampleFormControlSelect1">Select <span class="form-label-secondary">(Optional)</span></label>
<select id="exampleFormControlSelect1" class="form-control">
<option>Choose an option</option>
<option>2</option>
<option>3</option>
<option>4</option>
<option>5</option>
</select>
</div>
<div class="mb-3">
<label class="form-label" for="exampleFormControlSelect2">Multiple select</label>
<select id="exampleFormControlSelect2" class="form-control" size="3" multiple>
<option>1</option>
<option>2</option>
<option>3</option>
<option>4</option>
<option>5</option>
</select>
</div>
<div class="mb-3">
<label class="form-label" for="exampleFormControlTextarea1">Textarea</label>
<textarea id="exampleFormControlTextarea1" class="form-control" placeholder="Textarea field" rows="4"></textarea>
</div>
</form>
Sizing
<input class="form-control form-control-lg" type="text" placeholder=".form-control-lg">
<input class="form-control" type="text" placeholder="Default input">
<input class="form-control form-control-sm" type="text" placeholder=".form-control-sm">
Form select
<!-- Select -->
<select class="form-select">
<option selected="">Open this select menu</option>
<option value="1">One</option>
<option value="2">Two</option>
<option value="3">Three</option>
</select>
<!-- End Select -->
<!-- Select -->
<select class="form-select form-select-lg mb-3">
<option selected="">Open this select menu</option>
<option value="1">One</option>
<option value="2">Two</option>
<option value="3">Three</option>
</select>
<!-- End Select -->
<!-- Select -->
<select class="form-select form-select-sm">
<option selected="">Open this select menu</option>
<option value="1">One</option>
<option value="2">Two</option>
<option value="3">Three</option>
</select>
<!-- End Select -->
Borderless
<!-- Form -->
<div class="mb-3">
<label for="formControlBorderlessFullName" class="form-label">Full name</label>
<input type="text" class="form-control form-control-borderless form-control-flush" id="formControlBorderlessFullName" placeholder="Mark Williams" aria-label="Mark Williams">
</div>
<!-- End Form -->
<!-- Form -->
<div class="mb-3">
<label for="formControlBorderlessEmail" class="form-label">Email</label>
<input type="text" class="form-control form-control-borderless form-control-flush" id="formControlBorderlessEmail" placeholder="mark@example.com" aria-label="mark@example.com">
</div>
<!-- End Form -->
<!-- Form -->
<div class="mb-3">
<label for="formControlBorderlessGenderSelect" class="form-label">Gender</label>
<select id="formControlBorderlessGenderSelect" class="form-select form-select-borderless">
<option>Choose a gender</option>
<option>Male</option>
<option>Female</option>
<option>Other</option>
</select>
</div>
<!-- End Form -->
Light
<!-- Form -->
<div class="mb-3">
<label for="formControlLightFullName" class="form-label">Full name</label>
<input type="text" class="form-control form-control-light" id="formControlLightFullName" placeholder="Mark Williams" aria-label="Mark Williams">
</div>
<!-- End Form -->
<!-- Form -->
<div class="mb-3">
<label for="formControlLightEmail" class="form-label">Email</label>
<input type="text" class="form-control form-control-light" id="formControlLightEmail" placeholder="mark@example.com" aria-label="mark@example.com">
</div>
<!-- End Form -->
<!-- Form -->
<div class="mb-3">
<label for="formControlLightGenderSelect" class="form-label">Gender</label>
<select id="formControlLightGenderSelect" class="form-select form-select-light">
<option>Choose a gender</option>
<option>Male</option>
<option>Female</option>
<option>Other</option>
</select>
</div>
<!-- End Form -->
Hover light
<!-- Form -->
<div class="mb-3">
<label for="formControlHoverLightFullName" class="form-label">Full name</label>
<input type="text" class="form-control form-control-hover-light" id="formControlHoverLightFullName" placeholder="Mark Williams" aria-label="Mark Williams">
</div>
<!-- End Form -->
<!-- Form -->
<div class="mb-3">
<label for="formControlHoverLightEmail" class="form-label">Email</label>
<input type="text" class="form-control form-control-hover-light" id="formControlHoverLightEmail" placeholder="mark@example.com" aria-label="mark@example.com">
</div>
<!-- End Form -->
<!-- Form -->
<div class="mb-3">
<label for="formControlHoverLightGenderSelect" class="form-label">Gender</label>
<select id="formControlHoverLightGenderSelect" class="form-select form-select-hover-light">
<option>Choose a gender</option>
<option>Male</option>
<option>Female</option>
<option>Other</option>
</select>
</div>
<!-- End Form -->
Custom file inputs
Upload file
<input type="file" id="customFileEg1" class="form-control">
<div class="form-attachment-btn btn btn-sm btn-primary">Upload file
<input type="file" class="form-attachment-btn-label" id="fileUploader">
</div>
Range input
Disabled & Readonly Fields
<div class="row mb-3">
<label class="col-sm-3 col-form-label">Readonly plain text</label>
<div class="col-sm-9">
<input type="text" class="form-control-plaintext" value="email@example.com" readonly>
</div>
</div>
<div class="row">
<label class="col-sm-3 col-form-label">Readonly field</label>
<div class="col-sm-9">
<input type="text" class="form-control" value="Read only" readonly>
</div>
</div>
<div class="mb-3">
<label class="form-label">Disabled input</label>
<input type="text" class="form-control" placeholder="Disabled input" disabled>
</div>
<div class="mb-3">
<label class="form-label">Disabled select</label>
<select class="form-select" disabled>
<option>Choose an option</option>
<option>2</option>
<option>3</option>
<option>4</option>
<option>5</option>
</select>
</div>
<div class="mb-3">
<label class="form-label">Disabled textarea</label>
<textarea class="form-control" placeholder="Disabled textarea" disabled></textarea>
</div>
<div class="mb-3">
<label class="form-label">Disabled file input</label>
<input type="file" id="customFileEg2" class="form-control" disabled>
</div>
<div class="mb-3">
<label class="form-label">Disabled range input</label>
<input type="range" class="form-range" value="3" min="0" max="10" disabled>
</div>
Validation states
<form>
<div class="mb-3">
<label for="validationValidInput1">Valid input</label>
<input type="text" class="form-control is-valid" id="validationValidInput1" placeholder="Placeholder">
</div>
<div class="mb-3">
<label for="validationValidSelect1">Valid select</label>
<select class="form-select is-valid" id="validationValidSelect1">
<option>Choose an option</option>
<option>2</option>
<option>3</option>
<option>4</option>
<option>5</option>
</select>
<span class="valid-feedback">Valid feedback</span>
</div>
<div class="mb-3">
<label for="validationValidTextarea1">Valid textarea</label>
<textarea class="form-control is-valid" placeholder="Textarea field" id="validationValidTextarea1" rows="4"></textarea>
</div>
<div class="mb-3">
<label for="validationValidFileInput1">Valid file input</label>
<input type="file" id="validationValidFileInput1" class="form-control is-valid">
</div>
</form>
<form>
<div class="mb-3">
<label for="validationInvalidInput1">Valid input</label>
<input type="text" class="form-control is-invalid" id="validationInvalidInput1" placeholder="Placeholder">
</div>
<div class="mb-3">
<label for="validationInvalidSelect1">Valid select</label>
<select class="form-select is-invalid" id="validationInvalidSelect1">
<option>Choose an option</option>
<option>2</option>
<option>3</option>
<option>4</option>
<option>5</option>
</select>
<span class="invalid-feedback">Valid feedback</span>
</div>
<div class="mb-3">
<label for="validationInvalidTextarea1">Valid textarea</label>
<textarea class="form-control is-invalid" placeholder="Textarea field" id="validationInvalidTextarea1" rows="4"></textarea>
</div>
<div class="mb-3">
<label for="validationInvalidFileInput1">Valid file input</label>
<input type="file" id="validationInvalidFileInput1" class="form-control is-invalid">
</div>
</form>
Validation methods
Parameters | Description |
---|---|
data-nue-validation-equal-field | The validator uses an element selector to compare the values of the current field and the field that was passed in as the selector. |
data-nue-validation-validate-class | Attribute added to parent input element, instead of which validation classes will be added to customize styles. Make sure there is only one input inside the element with data-nue-validation-validate-class |