Boostrap 1 Modal, Pagination, form layout and input component

Even if we include only some modules of bootstrap we use the entire package:

//On the <head> or inside the body
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.2.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-rbsA2VBKQhggwzxH7pPCaAqO46MgnOM80zW1RWuH61DGLwZJEdK2Kadq2F9CUG65" crossorigin="anonymous">
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.2.3/dist/js/bootstrap.bundle.min.js" integrity="sha384-kenU1KFdBIe4zVF0s0G1M5b4hcpxyD9F7jL+jjXkk+Q2h455rYXK/7HAuoJl+0I4" crossorigin="anonymous"></script>

//In React.js we:
npm i bootstrap
import 'bootstrap/dist/css/bootstrap.css';

Boostrap Spacing & Display

We can use classes to add margin and padding:

//so, we can use m_- or p_- for Margin or Padding, from 0-5 and even negative numbers
<div class="ms-3"></div>

//we can use x/y for left/right or top/bottom 
<p class="my-2"></p> 

//or if we want left/rigth/top bottom, s(tart),e(nd), t(op), b(ottom)
<h3 class="pe-4"></h3> 

And for display and media-query breakpoints:

PureCSS and Modal

For modals we have buttons opening extra windows with content, through data-bs-toggle="modal" and data-bs-target:

Clicking on it will

In the modal content, we can add Extra PureCSS pure-g(rid), images, forms, and bootstrap effects:

chevron-rightBootstrap double modal guidehashtag

We create 2 modal inside the other.

data-bs-backdrop="static" disables the click-off from the modal.

modal-dialog-scrollable will overflow: scroll the modal if Y space is smaller.

We can bs-dismiss the current modal and bs-toggle a new one.

modal-dialog-centered centers the modal by X and Y.

modal-fullscreen-sm-down will expand the modal to fullscreen if screen below sm media query.

First modal with grid form and image

Pagination and bootpag

On pagination we create a list of links:

1 is .disabled, 3 is .active

To have a dynamic pagination bar we can use a Jquery Plugin Bootpagarrow-up-right:

With the plug-in we only need an id for the pagination and content:

Everything is done on javascript :

We can change the pagination property by using $(this).bootpag({ }).

Bootstrap collapse buttons and content

The data-bs-toggle="collapse" uses href/data-bs-target to animate the height/width of the collapse element.

When using a non-button we use href="#" to target the collapse Id content,

Vertical collapse trigger

To data-bs-target/href multiple collapse we use classes.

Bootstrap Forms

We design Boostrap forms using form-label/form-input pairs, linked by htmlfor/ID attributes.

Each input occupies 100% of the width unless a row>col is set.

form with Readonly input, switch checkbox and inline form

We can add the disabled or readOnly attribute to remove the interaction with inputs.

We can add multiple inputs to a single form row, like floating-form, Datalist, and <select>.

We add a row container to the form to create col inputs.

Floating label, form text, textarea, datalist, option, radio/reverse-checkbox

We use form-check (or form-check reverse) to add radio form-check-input buttons and form-check-label, in order to display them inline we used col containers for each.

Input-groups can extend a form-control and include labels and buttons.

We use required to validate the input before the form submits.

chevron-rightInput-groups form and basic validation.hashtag

Input-groups need a container class and an input-group-text span.

We can chain multiple span/input in the same form row, and implement form-control functions like datalist.

It works with textarea rows, and the span text self-aligns.

It works for <select> input and buttons.

Input-groups with option,uttons and textarea

Bootstrap validation is implemented with the has-validation container class.

chevron-rightImplementing validation using is-valid/invalid and valid/invalid-feedbackhashtag

We can use is-valid/invalid to style input, checkboxes, options, and input-groups.

The valid/invalid-feedback will appear depending on the is-valid/invalid input container.

valid/invalid-feedback HTML and is-valid/invalid style

The bootstrap form button, on adaptive columns, needs a set width input and an auto width in button.

chevron-rightAdaptive input button and floating-formhashtag

The input button needs both widths not overflow into the button.

adaptive form input on bootstrap column

We use the form-range bootstrap for the range input type.

We can set its min-max value (by default 0-100) and steps for the value of each range snap.

form-range input

We use the form-control-color Bootstrap for the input type color.

input type color

We use form-control for the type="file" input.

Input type file

Last updated