Source

Formae

Exempla et usus guidelines ad formas moderandas rationes, optiones layout optiones, et consuetudines componentium ad varias formas creandas.

Overview

Forma Bootstrap controllata dilatat formam styli nostri Rebooted cum generibus. His generibus utere ut optiones suas nativus ostensionibus magis constantioribus per navigatores et machinas reddendo optet.

Vide ut aptum typeattributum in omnibus initibus (exempli gratia emailelectronica inscriptio vel numbernumerica notitia) uteretur recentioribus initus moderantibus ut inscriptio verificationis, numerus lectionis et plus.

Hic exemplum velox est ut formas styles demonstraret Bootstrap. Lege documenta in classibus requisitis, forma extensionis, et plura.

Numquam cum quoquam alio communicabimus.
<form>
  <div class="form-group">
    <label for="exampleInputEmail1">Email address</label>
    <input type="email" class="form-control" id="exampleInputEmail1" aria-describedby="emailHelp" placeholder="Enter email">
    <small id="emailHelp" class="form-text text-muted">We'll never share your email with anyone else.</small>
  </div>
  <div class="form-group">
    <label for="exampleInputPassword1">Password</label>
    <input type="password" class="form-control" id="exampleInputPassword1" placeholder="Password">
  </div>
  <div class="form-group form-check">
    <input type="checkbox" class="form-check-input" id="exampleCheck1">
    <label class="form-check-label" for="exampleCheck1">Check me out</label>
  </div>
  <button type="submit" class="btn btn-primary">Submit</button>
</form>

Forma controls

Formae textuales controllatae sicut <input>s, <select>s, <textarea>s cum .form-controlgenere dicuntur. Inclusa sunt styli specie communi, statu umbilico, inspectione, et plura.

Vide explorare consuetudinem nostram formas ulterioris styli <select>s.

<form>
  <div class="form-group">
    <label for="exampleFormControlInput1">Email address</label>
    <input type="email" class="form-control" id="exampleFormControlInput1" placeholder="[email protected]">
  </div>
  <div class="form-group">
    <label for="exampleFormControlSelect1">Example select</label>
    <select class="form-control" id="exampleFormControlSelect1">
      <option>1</option>
      <option>2</option>
      <option>3</option>
      <option>4</option>
      <option>5</option>
    </select>
  </div>
  <div class="form-group">
    <label for="exampleFormControlSelect2">Example multiple select</label>
    <select multiple class="form-control" id="exampleFormControlSelect2">
      <option>1</option>
      <option>2</option>
      <option>3</option>
      <option>4</option>
      <option>5</option>
    </select>
  </div>
  <div class="form-group">
    <label for="exampleFormControlTextarea1">Example textarea</label>
    <textarea class="form-control" id="exampleFormControlTextarea1" rows="3"></textarea>
  </div>
</form>

Pro fasciculi initibus, .form-controlpro permuto .form-control-file.

<form>
  <div class="form-group">
    <label for="exampleFormControlFile1">Example file input</label>
    <input type="file" class="form-control-file" id="exampleFormControlFile1">
  </div>
</form>

inspectionem

Altitudines pone utendo classes sicut .form-control-lget .form-control-sm.

<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">
<select class="form-control form-control-lg">
  <option>Large select</option>
</select>
<select class="form-control">
  <option>Default select</option>
</select>
<select class="form-control form-control-sm">
  <option>Small select</option>
</select>

Tantum legere

Addere readonlyattributum booleanum in initus ad praecavendam modificationem valoris initus. Legere solum inputes leviores apparent (sicut inputs debiles), sed cursorem vexillum retinent.

<input class="form-control" type="text" placeholder="Readonly input here…" readonly>

Readonly patet illud

Si elementa habere vis <input readonly>in forma tua ut patet textus appellata, classibus utere .form-control-plaintextad tollendum formam default styli campi, et serva rectam marginem et Nullam.

<form>
  <div class="form-group row">
    <label for="staticEmail" class="col-sm-2 col-form-label">Email</label>
    <div class="col-sm-10">
      <input type="text" readonly class="form-control-plaintext" id="staticEmail" value="[email protected]">
    </div>
  </div>
  <div class="form-group row">
    <label for="inputPassword" class="col-sm-2 col-form-label">Password</label>
    <div class="col-sm-10">
      <input type="password" class="form-control" id="inputPassword" placeholder="Password">
    </div>
  </div>
</form>
<form class="form-inline">
  <div class="form-group mb-2">
    <label for="staticEmail2" class="sr-only">Email</label>
    <input type="text" readonly class="form-control-plaintext" id="staticEmail2" value="[email protected]">
  </div>
  <div class="form-group mx-sm-3 mb-2">
    <label for="inputPassword2" class="sr-only">Password</label>
    <input type="password" class="form-control" id="inputPassword2" placeholder="Password">
  </div>
  <button type="submit" class="btn btn-primary mb-2">Confirm identity</button>
</form>

Range Inputs

Pone horizontaliter scrollable range inputs utens .form-control-range.

<form>
  <div class="form-group">
    <label for="formControlRange">Example Range input</label>
    <input type="range" class="form-control-range" id="formControlRange">
  </div>
</form>

Checkboxes et radios

Default checkboxes et radios emendantur ope .form-checkunius ordinis utriusque initus specierum quae extensionem morumque suorum HTML elementorum emendant . Checkboxes sunt unum vel plures optiones in indicem seligendi, dum radios unum e multis eligendo sunt.

Debilitatum checkboxes et radios sustinentur, sed not-allowedcursorem in volive parentis praebere, attributum <label>addere necesse est . Proprium debilem adhibebit colorem leviorem ad auxilium indicandum statum initus.disabled.form-check-input

Checkboxes et usus radios aedificantur ad sanationem HTML formam fundatam et ad breves, accessibiles labellas praebent. Quales sunt, elementa nostra <input>s et s sunt si- lia quam intra a <label>opposita . Haec paulo verbosius quam notare debes et attributa referre et .<input><label>idfor<input><label>

Default (reclinant)

Defalta, quilibet numerus checkboxes et radios, qui proximum fratrem sunt, verticaliter reclinant et cum apte disiungentur .form-check.

<div class="form-check">
  <input class="form-check-input" type="checkbox" value="" id="defaultCheck1">
  <label class="form-check-label" for="defaultCheck1">
    Default checkbox
  </label>
</div>
<div class="form-check">
  <input class="form-check-input" type="checkbox" value="" id="defaultCheck2" disabled>
  <label class="form-check-label" for="defaultCheck2">
    Disabled checkbox
  </label>
</div>
<div class="form-check">
  <input class="form-check-input" type="radio" name="exampleRadios" id="exampleRadios1" value="option1" checked>
  <label class="form-check-label" for="exampleRadios1">
    Default radio
  </label>
</div>
<div class="form-check">
  <input class="form-check-input" type="radio" name="exampleRadios" id="exampleRadios2" value="option2">
  <label class="form-check-label" for="exampleRadios2">
    Second default radio
  </label>
</div>
<div class="form-check">
  <input class="form-check-input" type="radio" name="exampleRadios" id="exampleRadios3" value="option3" disabled>
  <label class="form-check-label" for="exampleRadios3">
    Disabled radio
  </label>
</div>

Inline

Group checkboxes vel radios in eodem ordine horizontali addendo .form-check-inlinealicui .form-check.

<div class="form-check form-check-inline">
  <input class="form-check-input" type="checkbox" id="inlineCheckbox1" value="option1">
  <label class="form-check-label" for="inlineCheckbox1">1</label>
</div>
<div class="form-check form-check-inline">
  <input class="form-check-input" type="checkbox" id="inlineCheckbox2" value="option2">
  <label class="form-check-label" for="inlineCheckbox2">2</label>
</div>
<div class="form-check form-check-inline">
  <input class="form-check-input" type="checkbox" id="inlineCheckbox3" value="option3" disabled>
  <label class="form-check-label" for="inlineCheckbox3">3 (disabled)</label>
</div>
<div class="form-check form-check-inline">
  <input class="form-check-input" type="radio" name="inlineRadioOptions" id="inlineRadio1" value="option1">
  <label class="form-check-label" for="inlineRadio1">1</label>
</div>
<div class="form-check form-check-inline">
  <input class="form-check-input" type="radio" name="inlineRadioOptions" id="inlineRadio2" value="option2">
  <label class="form-check-label" for="inlineRadio2">2</label>
</div>
<div class="form-check form-check-inline">
  <input class="form-check-input" type="radio" name="inlineRadioOptions" id="inlineRadio3" value="option3" disabled>
  <label class="form-check-label" for="inlineRadio3">3 (disabled)</label>
</div>

Sine pittacia

Adde .position-staticinputs intus .form-checkqui nullum textum pittacii habent. Memento adhuc praebere aliquam formam pittacii ad technologias adiuvandas (verbi causa utens aria-label).

<div class="form-check">
  <input class="form-check-input position-static" type="checkbox" id="blankCheckbox" value="option1" aria-label="...">
</div>
<div class="form-check">
  <input class="form-check-input position-static" type="radio" name="blankRadio" id="blankRadio1" value="option1" aria-label="...">
</div>

Layout

Cum Bootstrap applicat display: blocket width: 100%ad omnem fere formam nostram moderatur, formae ACERVUS verticaliter deficientes. Classes additae ad hoc propositum variare possunt in forma formativa.

Forma coetus

Classis facillima est .form-groupvia ad structuram aliquam formis addere. Genus flexibile praebet, quod aptationem pittacorum, moderamina, textum ad libitum adiuvandi fovet, ac sanationem nuntiandi format. Defaltam tantum applicat margin-bottom, sed additos stylos in .form-inlinenecessitate colligit. Utere eo cum <fieldset>s, <div>s, vel alio fere elemento.

<form>
  <div class="form-group">
    <label for="formGroupExampleInput">Example label</label>
    <input type="text" class="form-control" id="formGroupExampleInput" placeholder="Example input">
  </div>
  <div class="form-group">
    <label for="formGroupExampleInput2">Another label</label>
    <input type="text" class="form-control" id="formGroupExampleInput2" placeholder="Another input">
  </div>
</form>

Forma malesuada euismod

Formae plures implicatae aedificari possunt utentes classes nostras eget. His utere ad formam propositionum quae multiplices columnas, latitudines varias, additamenta noctis optiones requirunt.

<form>
  <div class="row">
    <div class="col">
      <input type="text" class="form-control" placeholder="First name">
    </div>
    <div class="col">
      <input type="text" class="form-control" placeholder="Last name">
    </div>
  </div>
</form>

Forma row

You may also PERMUTO .rowpro .form-row, variatione craticulae vexillum nostri ordinis , qui defaltam columnam tetigisset , pro arctius et compacto layoutus vincit.

<form>
  <div class="form-row">
    <div class="col">
      <input type="text" class="form-control" placeholder="First name">
    </div>
    <div class="col">
      <input type="text" class="form-control" placeholder="Last name">
    </div>
  </div>
</form>

Plures propositiones implicatae etiam creari possunt cum systemate euismod.

<form>
  <div class="form-row">
    <div class="form-group col-md-6">
      <label for="inputEmail4">Email</label>
      <input type="email" class="form-control" id="inputEmail4" placeholder="Email">
    </div>
    <div class="form-group col-md-6">
      <label for="inputPassword4">Password</label>
      <input type="password" class="form-control" id="inputPassword4" placeholder="Password">
    </div>
  </div>
  <div class="form-group">
    <label for="inputAddress">Address</label>
    <input type="text" class="form-control" id="inputAddress" placeholder="1234 Main St">
  </div>
  <div class="form-group">
    <label for="inputAddress2">Address 2</label>
    <input type="text" class="form-control" id="inputAddress2" placeholder="Apartment, studio, or floor">
  </div>
  <div class="form-row">
    <div class="form-group col-md-6">
      <label for="inputCity">City</label>
      <input type="text" class="form-control" id="inputCity">
    </div>
    <div class="form-group col-md-4">
      <label for="inputState">State</label>
      <select id="inputState" class="form-control">
        <option selected>Choose...</option>
        <option>...</option>
      </select>
    </div>
    <div class="form-group col-md-2">
      <label for="inputZip">Zip</label>
      <input type="text" class="form-control" id="inputZip">
    </div>
  </div>
  <div class="form-group">
    <div class="form-check">
      <input class="form-check-input" type="checkbox" id="gridCheck">
      <label class="form-check-label" for="gridCheck">
        Check me out
      </label>
    </div>
  </div>
  <button type="submit" class="btn btn-primary">Sign in</button>
</form>

Forma horizontalis

Formas horizontales crea cum malesuada euismod addendo .rowgenus ad formandum coetus et .col-*-*classes utendo ad denotandum latitudinem pittacorum ac moderationum tuarum. Fac ut adiiciam .col-form-labeltuam <label>tam bene ut verticaliter conversae sint cum activitate earum adiunctis formarum.

Aliquando, fortasse margine vel Nullam utilitates uti debes ad perficiendam illam noctis perfectam quam debes. padding-topExempli causa, in inputationibus nostris reclinatum radiophonicum pittacium removimus ut baseline textum meliorem emitteremus.

Radios
Checkbox
<form>
  <div class="form-group row">
    <label for="inputEmail3" class="col-sm-2 col-form-label">Email</label>
    <div class="col-sm-10">
      <input type="email" class="form-control" id="inputEmail3" placeholder="Email">
    </div>
  </div>
  <div class="form-group row">
    <label for="inputPassword3" class="col-sm-2 col-form-label">Password</label>
    <div class="col-sm-10">
      <input type="password" class="form-control" id="inputPassword3" placeholder="Password">
    </div>
  </div>
  <fieldset class="form-group">
    <div class="row">
      <legend class="col-form-label col-sm-2 pt-0">Radios</legend>
      <div class="col-sm-10">
        <div class="form-check">
          <input class="form-check-input" type="radio" name="gridRadios" id="gridRadios1" value="option1" checked>
          <label class="form-check-label" for="gridRadios1">
            First radio
          </label>
        </div>
        <div class="form-check">
          <input class="form-check-input" type="radio" name="gridRadios" id="gridRadios2" value="option2">
          <label class="form-check-label" for="gridRadios2">
            Second radio
          </label>
        </div>
        <div class="form-check disabled">
          <input class="form-check-input" type="radio" name="gridRadios" id="gridRadios3" value="option3" disabled>
          <label class="form-check-label" for="gridRadios3">
            Third disabled radio
          </label>
        </div>
      </div>
    </div>
  </fieldset>
  <div class="form-group row">
    <div class="col-sm-2">Checkbox</div>
    <div class="col-sm-10">
      <div class="form-check">
        <input class="form-check-input" type="checkbox" id="gridCheck1">
        <label class="form-check-label" for="gridCheck1">
          Example checkbox
        </label>
      </div>
    </div>
  </div>
  <div class="form-group row">
    <div class="col-sm-10">
      <button type="submit" class="btn btn-primary">Sign in</button>
    </div>
  </div>
</form>
Forma horizontalis titulus inspectionem

Fac uti .col-form-label-smvel s vel s .col-form-label-lgtuo ut recte sequaris magnitudinem et .<label><legend>.form-control-lg.form-control-sm

<form>
  <div class="form-group row">
    <label for="colFormLabelSm" class="col-sm-2 col-form-label col-form-label-sm">Email</label>
    <div class="col-sm-10">
      <input type="email" class="form-control form-control-sm" id="colFormLabelSm" placeholder="col-form-label-sm">
    </div>
  </div>
  <div class="form-group row">
    <label for="colFormLabel" class="col-sm-2 col-form-label">Email</label>
    <div class="col-sm-10">
      <input type="email" class="form-control" id="colFormLabel" placeholder="col-form-label">
    </div>
  </div>
  <div class="form-group row">
    <label for="colFormLabelLg" class="col-sm-2 col-form-label col-form-label-lg">Email</label>
    <div class="col-sm-10">
      <input type="email" class="form-control form-control-lg" id="colFormLabelLg" placeholder="col-form-label-lg">
    </div>
  </div>
</form>

Columna inspectionem

Ut in exemplis praecedentibus demonstratum est, ratio nostra eget te permittit ut quemlibet numerum .cols intra a .rowvel .form-row. In promptu latitudinem aequaliter inter eos divident. Colligere etiam potes partem columnarum tuarum ad spatium plus minusve capiendum, reliquae vero .colaequaliter scindendae, certis columnis similia classia .col-7.

<form>
  <div class="form-row">
    <div class="col-7">
      <input type="text" class="form-control" placeholder="City">
    </div>
    <div class="col">
      <input type="text" class="form-control" placeholder="State">
    </div>
    <div class="col">
      <input type="text" class="form-control" placeholder="Zip">
    </div>
  </div>
</form>

Auto-sizing

Exemplum infra flexo utilitas utitur ad perpendiculum contenta et mutationes .colad centrum, .col-autout columnae tuae tantum capiant spatium quantum opus est. Alio modo pone modum columnae ipsae magnitudinis in illis contentis.

@
<form>
  <div class="form-row align-items-center">
    <div class="col-auto">
      <label class="sr-only" for="inlineFormInput">Name</label>
      <input type="text" class="form-control mb-2" id="inlineFormInput" placeholder="Jane Doe">
    </div>
    <div class="col-auto">
      <label class="sr-only" for="inlineFormInputGroup">Username</label>
      <div class="input-group mb-2">
        <div class="input-group-prepend">
          <div class="input-group-text">@</div>
        </div>
        <input type="text" class="form-control" id="inlineFormInputGroup" placeholder="Username">
      </div>
    </div>
    <div class="col-auto">
      <div class="form-check mb-2">
        <input class="form-check-input" type="checkbox" id="autoSizingCheck">
        <label class="form-check-label" for="autoSizingCheck">
          Remember me
        </label>
      </div>
    </div>
    <div class="col-auto">
      <button type="submit" class="btn btn-primary mb-2">Submit</button>
    </div>
  </div>
</form>

Remisce ergo potes quod iterum cum classibus columnarum specialium magnitudine-specificarum.

@
<form>
  <div class="form-row align-items-center">
    <div class="col-sm-3 my-1">
      <label class="sr-only" for="inlineFormInputName">Name</label>
      <input type="text" class="form-control" id="inlineFormInputName" placeholder="Jane Doe">
    </div>
    <div class="col-sm-3 my-1">
      <label class="sr-only" for="inlineFormInputGroupUsername">Username</label>
      <div class="input-group">
        <div class="input-group-prepend">
          <div class="input-group-text">@</div>
        </div>
        <input type="text" class="form-control" id="inlineFormInputGroupUsername" placeholder="Username">
      </div>
    </div>
    <div class="col-auto my-1">
      <div class="form-check">
        <input class="form-check-input" type="checkbox" id="autoSizingCheck2">
        <label class="form-check-label" for="autoSizingCheck2">
          Remember me
        </label>
      </div>
    </div>
    <div class="col-auto my-1">
      <button type="submit" class="btn btn-primary">Submit</button>
    </div>
  </div>
</form>

Forma moderatur sane consuetudo et fulciuntur.

<form>
  <div class="form-row align-items-center">
    <div class="col-auto my-1">
      <label class="mr-sm-2 sr-only" for="inlineFormCustomSelect">Preference</label>
      <select class="custom-select mr-sm-2" id="inlineFormCustomSelect">
        <option selected>Choose...</option>
        <option value="1">One</option>
        <option value="2">Two</option>
        <option value="3">Three</option>
      </select>
    </div>
    <div class="col-auto my-1">
      <div class="custom-control custom-checkbox mr-sm-2">
        <input type="checkbox" class="custom-control-input" id="customControlAutosizing">
        <label class="custom-control-label" for="customControlAutosizing">Remember my preference</label>
      </div>
    </div>
    <div class="col-auto my-1">
      <button type="submit" class="btn btn-primary">Submit</button>
    </div>
  </div>
</form>

Inline formae

Classe utere .form-inlinead ostentationem pittaculorum seriem, moderamina ac globulis formant in uno ordine horizontali. Formae controllatae intra formas inlineas paulum variant a civitatibus defectibus.

  • Moderationes sunt display: flex, in quovis spatio HTML coloris labentes et permittens ut matrimoniam potestatem cum spatiis et flexbox utilitatibus praebeas .
  • Controls and input groups receive width: autoto override the Bootstrap default width: 100%.
  • Imperium in linea tantum apparent in prospectibus quae saltem 576px lata sunt, ut rationes angustas speculationes de mobilibus cogitationibus reddant.

Opus manuale alloqui licet latitudinem et noctis singularum formarum cum iustae utilitatibus moderandis (ut infra patebit). Demum, scito semper includere <label>cum unaquaque dicione, etiam si opus est eam abscondere a visitatoribus non-screenreadoribus .sr-only.

@
<form class="form-inline">
  <label class="sr-only" for="inlineFormInputName2">Name</label>
  <input type="text" class="form-control mb-2 mr-sm-2" id="inlineFormInputName2" placeholder="Jane Doe">

  <label class="sr-only" for="inlineFormInputGroupUsername2">Username</label>
  <div class="input-group mb-2 mr-sm-2">
    <div class="input-group-prepend">
      <div class="input-group-text">@</div>
    </div>
    <input type="text" class="form-control" id="inlineFormInputGroupUsername2" placeholder="Username">
  </div>

  <div class="form-check mb-2 mr-sm-2">
    <input class="form-check-input" type="checkbox" id="inlineFormCheck">
    <label class="form-check-label" for="inlineFormCheck">
      Remember me
    </label>
  </div>

  <button type="submit" class="btn btn-primary mb-2">Submit</button>
</form>

Consuetudinis forma moderatur et eligit etiam suffragatur.

<form class="form-inline">
  <label class="my-1 mr-2" for="inlineFormCustomSelectPref">Preference</label>
  <select class="custom-select my-1 mr-sm-2" id="inlineFormCustomSelectPref">
    <option selected>Choose...</option>
    <option value="1">One</option>
    <option value="2">Two</option>
    <option value="3">Three</option>
  </select>

  <div class="custom-control custom-checkbox my-1 mr-sm-2">
    <input type="checkbox" class="custom-control-input" id="customControlInline">
    <label class="custom-control-label" for="customControlInline">Remember my preference</label>
  </div>

  <button type="submit" class="btn btn-primary my-1">Submit</button>
</form>
Alternativas ad pittacia occultata

Technologiae adiutrices sicut lectorum tegumentum laborantes cum formis tuis habebunt si pittacium non pro singulis initus includas. .sr-onlyAd has inlineas formas, pittacia classium utentes celare potes . Aliae insuper sunt methodi praebendi pittacium technologiarum adiuvativarum, ut sunt aria-label, aria-labelledbyseu titleattributum. Si nullae ex his adsunt, technologiae adiutrices uti possunt placeholderattributo, si adsint, uti, sed notare usum placeholdersubstitutionis aliis methodis titulatis non admoneri.

Auxilium text

Clausus gradus ope textus in formis creari potest utens .form-text(antea ut .help-blockin v3). Textus ope inline flexibiliter impleri potest utens quolibet inlineo HTML elementi et utilitatis genere similibus .text-muted.

Textus cum forma controls iungens auxilium

Auxilium textus debet explicite coniungi cum forma temperantiae quod pertinet ad usus aria-describedbyattributi. Hoc efficiet ut technologiae adiutrices - sicut lectores tegumentum - hunc textum adiuvent annuntient cum usor tendit vel imperium intrat.

Auxilium textus infra inputs dici potest cum .form-text. Hoc genus includit display: blocket addit aliquam marginem top pro facili spatio ab inputibus supra.

Password notis longis debet esse 8-20, epistolas et numeros continere, nec lacunas, peculiares notas aut emoji continere debet.
<label for="inputPassword5">Password</label>
<input type="password" id="inputPassword5" class="form-control" aria-describedby="passwordHelpBlock">
<small id="passwordHelpBlock" class="form-text text-muted">
  Your password must be 8-20 characters long, contain letters and numbers, and must not contain spaces, special characters, or emoji.
</small>

Inline textus uti potest quodlibet elementum typicum inlineum HTML (sit a <small>, <span>vel aliquid aliud) cum nihil aliud quam genus utilitatis.

Oportet 8-20 characteres tempore.
<form class="form-inline">
  <div class="form-group">
    <label for="inputPassword6">Password</label>
    <input type="password" id="inputPassword6" class="form-control mx-sm-3" aria-describedby="passwordHelpInline">
    <small id="passwordHelpInline" class="text-muted">
      Must be 8-20 characters long.
    </small>
  </div>
</form>

Debilitatum formae

Boolean disabledattributum addere in initus ad impediendum interationes usoris ne leviores appareant.

<input class="form-control" id="disabledInput" type="text" placeholder="Disabled input here..." disabled>

Adde quod omne imperium intus inactivandi disabledattributum est .<fieldset>

<form>
  <fieldset disabled>
    <div class="form-group">
      <label for="disabledTextInput">Disabled input</label>
      <input type="text" id="disabledTextInput" class="form-control" placeholder="Disabled input">
    </div>
    <div class="form-group">
      <label for="disabledSelect">Disabled select menu</label>
      <select id="disabledSelect" class="form-control">
        <option>Disabled select</option>
      </select>
    </div>
    <div class="form-check">
      <input class="form-check-input" type="checkbox" id="disabledFieldsetCheck" disabled>
      <label class="form-check-label" for="disabledFieldsetCheck">
        Can't check this
      </label>
    </div>
    <button type="submit" class="btn btn-primary">Submit</button>
  </fieldset>
</form>
Caveat anchoris

Defalta navigatores omnes formas nativas controllatas ( <input>, <select>et <button>elementa) intra <fieldset disabled>quasi debilem tractabunt, impediendo tam claviaturas quam murem interationes. Attamen si forma tua <a ... class="btn btn-*">elementa etiam includit, haec solum stylus dabuntur pointer-events: none. Sicut notatum est in sectione de statu debilitatum pro globulis (et speciatim in sub-sectione pro elementis anchoris), haec proprietas CSS nondum normatum est nec plene in Penitus Rimor 10 sustinetur, nec claviaturae usores impediunt quominus sint posset ut focus vel eu hos nexus. Ita tutus esse, utere usu JavaScript ad tales nexus disable.

Crucem pasco convenientiam

Dum Bootstrap hos stylos in omnibus navigatoribus adhibebit, Internet Explorer 11 et infra non plene disabledattributum in a <fieldset>. Utere consuetudine JavaScript ad disable campum in his navigatoribus.

Validation

Praebere pretiosos, actuosos opiniones ad tuos usores cum HTML5 forma validation-, available in omnibus navigatoribus nostris suffragantibus . Eligite ex navigatro validationum default feedback, vel nuntia consuetudinem efficiendi cum nostris in classibus constructis et JavaScript starter.

Nos nunc commendamus more validation stylorum usuum, ut nuntia navigatri indigena convalidatio defalta constanter in omnibus navigatoribus technologiae adiutricis ( notissime, Chrome in escritorio et mobili).

Quomodo facitur

Ecce quomodo sanatio forma cum Bootstrap operatur:

  • Forma sanationis HTML applicatur per duas pseudo-classes CSS, :invalidet :valid. Applicat ad <input>, <select>, et <textarea>elementa.
  • Bootstrap ambitus :invalidet :validstilos ad genus parentis .was-validated, ad usitate applicari solet <form>. Alioquin quis campus requiritur sine valore paginae onus in pagina invalidum ostendit. Hoc modo eligat licet eos movere (typice post formam subiectionis tentatur).
  • Ad speciem formae reset (exempli gratia, in casu dynamicae formae submissionibus utens AJAX), .was-validatedclassis ab <form>iterum post submissionem removetur.
  • Pro fallagia, .is-invalidet .is-validclasses loco pseudo-classum adhiberi possunt pro parte sanationis server . Non indigent .was-validatedparentis genere.
  • Ob angustias quomodo opera CSS, non possumus (nunc) stylos applicare ad <label>formam in DOM praecedente sine auxilio consuetudinis JavaScript.
  • Omnes moderni navigatores angustiam validation API sustentant , series JavaScript methodi ad formam moderantis confirmandam.
  • Feedback nuntiis potest uti defaltis navigatri (pro unoquoque navigatro diversum, et per CSS inexplicabile) vel more nostro videre stilos additis HTML et CSS.
  • Mandata consuetudo validitatem praebere potes setCustomValidityin JavaScript.

In hoc animo considera sequentia demos pro more nostro genera sanationis formare, servo libitum classium laterum, defaltis navigare.

More styles

Pro consuetudine Bootstrap epistulae sanationis formant, necesse est tibi novalidateattributum boolean addere tuo <form>. Hoc navigatrum disables defaltam instrumentorum feedback, sed tamen accessum praebet formae sanationis APIs in JavaScript. Formam infra subiicere conantur; nostrum JavaScript intercipiet tesseram submittere et feedback tibi nullam.

Cum subire conanti, videbis formas :invalidet :validgenera admoveri imperiorum.

Looks good!
Looks good!
@
Please choose a username.
Please provide a valid city.
Please provide a valid state.
Please provide a valid zip.
You must agree before submitting.
<form class="needs-validation" novalidate>
  <div class="form-row">
    <div class="col-md-4 mb-3">
      <label for="validationCustom01">First name</label>
      <input type="text" class="form-control" id="validationCustom01" placeholder="First name" value="Mark" required>
      <div class="valid-feedback">
        Looks good!
      </div>
    </div>
    <div class="col-md-4 mb-3">
      <label for="validationCustom02">Last name</label>
      <input type="text" class="form-control" id="validationCustom02" placeholder="Last name" value="Otto" required>
      <div class="valid-feedback">
        Looks good!
      </div>
    </div>
    <div class="col-md-4 mb-3">
      <label for="validationCustomUsername">Username</label>
      <div class="input-group">
        <div class="input-group-prepend">
          <span class="input-group-text" id="inputGroupPrepend">@</span>
        </div>
        <input type="text" class="form-control" id="validationCustomUsername" placeholder="Username" aria-describedby="inputGroupPrepend" required>
        <div class="invalid-feedback">
          Please choose a username.
        </div>
      </div>
    </div>
  </div>
  <div class="form-row">
    <div class="col-md-6 mb-3">
      <label for="validationCustom03">City</label>
      <input type="text" class="form-control" id="validationCustom03" placeholder="City" required>
      <div class="invalid-feedback">
        Please provide a valid city.
      </div>
    </div>
    <div class="col-md-3 mb-3">
      <label for="validationCustom04">State</label>
      <input type="text" class="form-control" id="validationCustom04" placeholder="State" required>
      <div class="invalid-feedback">
        Please provide a valid state.
      </div>
    </div>
    <div class="col-md-3 mb-3">
      <label for="validationCustom05">Zip</label>
      <input type="text" class="form-control" id="validationCustom05" placeholder="Zip" required>
      <div class="invalid-feedback">
        Please provide a valid zip.
      </div>
    </div>
  </div>
  <div class="form-group">
    <div class="form-check">
      <input class="form-check-input" type="checkbox" value="" id="invalidCheck" 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>
  <button class="btn btn-primary" type="submit">Submit form</button>
</form>

<script>
// Example starter JavaScript for disabling form submissions if there are invalid fields
(function() {
  'use strict';
  window.addEventListener('load', function() {
    // Fetch all the forms we want to apply custom Bootstrap validation styles to
    var forms = document.getElementsByClassName('needs-validation');
    // Loop over them and prevent submission
    var validation = Array.prototype.filter.call(forms, function(form) {
      form.addEventListener('submit', function(event) {
        if (form.checkValidity() === false) {
          event.preventDefault();
          event.stopPropagation();
        }
        form.classList.add('was-validated');
      }, false);
    });
  }, false);
})();
</script>

Pasco defaltis

Non quaero in consuetudine convalidationis feedback nuntiis vel JavaScript scribens ad mores formas mutare? Omnia bona, defaltis pasco uti potes. Formam infra exhibenda proba. Pendere in navigatro tuo et OS, paulo alium modum feedback videbis.

Dum haec genera feedback non cum CSS dici possunt, adhuc textus feedback in JavaScript customize potes.

@
<form>
  <div class="form-row">
    <div class="col-md-4 mb-3">
      <label for="validationDefault01">First name</label>
      <input type="text" class="form-control" id="validationDefault01" placeholder="First name" value="Mark" required>
    </div>
    <div class="col-md-4 mb-3">
      <label for="validationDefault02">Last name</label>
      <input type="text" class="form-control" id="validationDefault02" placeholder="Last name" value="Otto" required>
    </div>
    <div class="col-md-4 mb-3">
      <label for="validationDefaultUsername">Username</label>
      <div class="input-group">
        <div class="input-group-prepend">
          <span class="input-group-text" id="inputGroupPrepend2">@</span>
        </div>
        <input type="text" class="form-control" id="validationDefaultUsername" placeholder="Username" aria-describedby="inputGroupPrepend2" required>
      </div>
    </div>
  </div>
  <div class="form-row">
    <div class="col-md-6 mb-3">
      <label for="validationDefault03">City</label>
      <input type="text" class="form-control" id="validationDefault03" placeholder="City" required>
    </div>
    <div class="col-md-3 mb-3">
      <label for="validationDefault04">State</label>
      <input type="text" class="form-control" id="validationDefault04" placeholder="State" required>
    </div>
    <div class="col-md-3 mb-3">
      <label for="validationDefault05">Zip</label>
      <input type="text" class="form-control" id="validationDefault05" placeholder="Zip" required>
    </div>
  </div>
  <div class="form-group">
    <div class="form-check">
      <input class="form-check-input" type="checkbox" value="" id="invalidCheck2" required>
      <label class="form-check-label" for="invalidCheck2">
        Agree to terms and conditions
      </label>
    </div>
  </div>
  <button class="btn btn-primary" type="submit">Submit form</button>
</form>

Servo latus

Commendamus utendo clientelam lateris sanationis, sed in casu servo latus requiris, indicare potes agros validos et invalidos et .is-invalidformare .is-valid. Nota quod .invalid-feedbacketiam his generibus suffragatur.

Bonum videtur!
Bonum videtur!
@
Elige quaeso nomen usoris.
Placet urbem validam praebere.
Quaeso, statum validum praebere.
Quaeso zip validum providere.
Priusquam assentire debes subdendo.
<form>
  <div class="form-row">
    <div class="col-md-4 mb-3">
      <label for="validationServer01">First name</label>
      <input type="text" class="form-control is-valid" id="validationServer01" placeholder="First name" value="Mark" required>
      <div class="valid-feedback">
        Looks good!
      </div>
    </div>
    <div class="col-md-4 mb-3">
      <label for="validationServer02">Last name</label>
      <input type="text" class="form-control is-valid" id="validationServer02" placeholder="Last name" value="Otto" required>
      <div class="valid-feedback">
        Looks good!
      </div>
    </div>
    <div class="col-md-4 mb-3">
      <label for="validationServerUsername">Username</label>
      <div class="input-group">
        <div class="input-group-prepend">
          <span class="input-group-text" id="inputGroupPrepend3">@</span>
        </div>
        <input type="text" class="form-control is-invalid" id="validationServerUsername" placeholder="Username" aria-describedby="inputGroupPrepend3" required>
        <div class="invalid-feedback">
          Please choose a username.
        </div>
      </div>
    </div>
  </div>
  <div class="form-row">
    <div class="col-md-6 mb-3">
      <label for="validationServer03">City</label>
      <input type="text" class="form-control is-invalid" id="validationServer03" placeholder="City" required>
      <div class="invalid-feedback">
        Please provide a valid city.
      </div>
    </div>
    <div class="col-md-3 mb-3">
      <label for="validationServer04">State</label>
      <input type="text" class="form-control is-invalid" id="validationServer04" placeholder="State" required>
      <div class="invalid-feedback">
        Please provide a valid state.
      </div>
    </div>
    <div class="col-md-3 mb-3">
      <label for="validationServer05">Zip</label>
      <input type="text" class="form-control is-invalid" id="validationServer05" placeholder="Zip" required>
      <div class="invalid-feedback">
        Please provide a valid zip.
      </div>
    </div>
  </div>
  <div class="form-group">
    <div class="form-check">
      <input class="form-check-input is-invalid" type="checkbox" value="" id="invalidCheck3" required>
      <label class="form-check-label" for="invalidCheck3">
        Agree to terms and conditions
      </label>
      <div class="invalid-feedback">
        You must agree before submitting.
      </div>
    </div>
  </div>
  <button class="btn btn-primary" type="submit">Submit form</button>
</form>

Supported elementis

Exempla nostra formae nativa <input>supra s textuales ostendunt, sed styli convalidationis formae prompti sunt ad nostram consuetudinem moderantis quoque.

Exemplum irritum feedback text
Magis exemplum invalidum feedback text
Exemplum irritum consuetudo eligere feedback
Exemplum irritum consuetudo file feedback
<form class="was-validated">
  <div class="custom-control custom-checkbox mb-3">
    <input type="checkbox" class="custom-control-input" id="customControlValidation1" required>
    <label class="custom-control-label" for="customControlValidation1">Check this custom checkbox</label>
    <div class="invalid-feedback">Example invalid feedback text</div>
  </div>

  <div class="custom-control custom-radio">
    <input type="radio" class="custom-control-input" id="customControlValidation2" name="radio-stacked" required>
    <label class="custom-control-label" for="customControlValidation2">Toggle this custom radio</label>
  </div>
  <div class="custom-control custom-radio mb-3">
    <input type="radio" class="custom-control-input" id="customControlValidation3" name="radio-stacked" required>
    <label class="custom-control-label" for="customControlValidation3">Or toggle this other custom radio</label>
    <div class="invalid-feedback">More example invalid feedback text</div>
  </div>

  <div class="form-group">
    <select class="custom-select" required>
      <option value="">Open this select menu</option>
      <option value="1">One</option>
      <option value="2">Two</option>
      <option value="3">Three</option>
    </select>
    <div class="invalid-feedback">Example invalid custom select feedback</div>
  </div>

  <div class="custom-file">
    <input type="file" class="custom-file-input" id="validatedCustomFile" required>
    <label class="custom-file-label" for="validatedCustomFile">Choose file...</label>
    <div class="invalid-feedback">Example invalid custom file feedback</div>
  </div>
</form>

Instrumentorum

.{valid|invalid}-feedbackSi forma tua layout id permittit, classes permutare potes, ut .{valid|invalid}-tooltipclasses ad sanationem feedback in instrumento appellato exhibeas. Vide parentem habere cum position: relativein eo pro tooltip positionis. In exemplo infra, cohortes nostrae columnae hoc iam habent, sed consilium tuum alterutram partem requirere potest.

Looks good!
Looks good!
@
Please choose a unique and valid username.
Please provide a valid city.
Please provide a valid state.
Please provide a valid zip.
<form class="needs-validation" novalidate>
  <div class="form-row">
    <div class="col-md-4 mb-3">
      <label for="validationTooltip01">First name</label>
      <input type="text" class="form-control" id="validationTooltip01" placeholder="First name" value="Mark" required>
      <div class="valid-tooltip">
        Looks good!
      </div>
    </div>
    <div class="col-md-4 mb-3">
      <label for="validationTooltip02">Last name</label>
      <input type="text" class="form-control" id="validationTooltip02" placeholder="Last name" value="Otto" required>
      <div class="valid-tooltip">
        Looks good!
      </div>
    </div>
    <div class="col-md-4 mb-3">
      <label for="validationTooltipUsername">Username</label>
      <div class="input-group">
        <div class="input-group-prepend">
          <span class="input-group-text" id="validationTooltipUsernamePrepend">@</span>
        </div>
        <input type="text" class="form-control" id="validationTooltipUsername" placeholder="Username" aria-describedby="validationTooltipUsernamePrepend" required>
        <div class="invalid-tooltip">
          Please choose a unique and valid username.
        </div>
      </div>
    </div>
  </div>
  <div class="form-row">
    <div class="col-md-6 mb-3">
      <label for="validationTooltip03">City</label>
      <input type="text" class="form-control" id="validationTooltip03" placeholder="City" required>
      <div class="invalid-tooltip">
        Please provide a valid city.
      </div>
    </div>
    <div class="col-md-3 mb-3">
      <label for="validationTooltip04">State</label>
      <input type="text" class="form-control" id="validationTooltip04" placeholder="State" required>
      <div class="invalid-tooltip">
        Please provide a valid state.
      </div>
    </div>
    <div class="col-md-3 mb-3">
      <label for="validationTooltip05">Zip</label>
      <input type="text" class="form-control" id="validationTooltip05" placeholder="Zip" required>
      <div class="invalid-tooltip">
        Please provide a valid zip.
      </div>
    </div>
  </div>
  <button class="btn btn-primary" type="submit">Submit form</button>
</form>

Formae consuetudo

Nam etiam plus cssc et crucis pasco constantiam, nostra consuetudine omnino utimur, elementa formare ut defaltis navigatri reponeremus. Super semanticam et accessibilem notam aedificantur, ut solida supplementa ad aliquem defaltam formam redigant.

Checkboxes et radios

Quaelibet reprimenda et radiophonica involuta <div>cum germano <span>ad nostram consuetudinem regendam et <label>ad textum comitantem efficiendum. Profecto haec eadem ratio est ac defalta nostra .form-check.

Utimur germano electore ~pro omnibus <input>civitatibus nostris - :checkedut formam nostram proprie consuetudini denotat. Composita cum .custom-control-labelclassibus, textum quoque edicere possumus pro cuiusque item <input>statu innixum.

Default celamus <input>cum opacityet utimur .custom-control-labelad novam consuetudinem condere formam indicator in loco suo cum ::beforeet ::after. Infeliciter non possumus consuetudinem unam e justo aedificare, <input>quia CSS scriptor contentin illo elementum non operatur.

In civitatibus repressis, iconibus SVG impressis basi 64 ex Open Iconicis utimur . Hoc nobis optimam potestatem praebet per navigatores et machinis ferendis et positis.

Checkboxes

<div class="custom-control custom-checkbox">
  <input type="checkbox" class="custom-control-input" id="customCheck1">
  <label class="custom-control-label" for="customCheck1">Check this custom checkbox</label>
</div>

Consuetudo checkboxes etiam :indeterminatepseudo classe uti potest cum manually via JavaScript (non est praesto HTML attributum ad eam specificandam).

Si usus es, sufficiat aliquid simile;

$('.your-checkbox').prop('indeterminate', true)

Radios

<div class="custom-control custom-radio">
  <input type="radio" id="customRadio1" name="customRadio" class="custom-control-input">
  <label class="custom-control-label" for="customRadio1">Toggle this custom radio</label>
</div>
<div class="custom-control custom-radio">
  <input type="radio" id="customRadio2" name="customRadio" class="custom-control-input">
  <label class="custom-control-label" for="customRadio2">Or toggle this other custom radio</label>
</div>

Inline

<div class="custom-control custom-radio custom-control-inline">
  <input type="radio" id="customRadioInline1" name="customRadioInline1" class="custom-control-input">
  <label class="custom-control-label" for="customRadioInline1">Toggle this custom radio</label>
</div>
<div class="custom-control custom-radio custom-control-inline">
  <input type="radio" id="customRadioInline2" name="customRadioInline1" class="custom-control-input">
  <label class="custom-control-label" for="customRadioInline2">Or toggle this other custom radio</label>
</div>

debilitatum

Consuetudines checkboxes et radios etiam debilitari possunt. Boolean disabledattributum addere <input>et indicatae consuetudinis et descriptionis pittacii automatice appellati erunt.

<div class="custom-control custom-checkbox">
  <input type="checkbox" class="custom-control-input" id="customCheckDisabled" disabled>
  <label class="custom-control-label" for="customCheckDisabled">Check this custom checkbox</label>
</div>

<div class="custom-control custom-radio">
  <input type="radio" id="radio3" name="radioDisabled" id="customRadioDisabled" class="custom-control-input" disabled>
  <label class="custom-control-label" for="customRadioDisabled">Toggle this custom radio</label>
</div>

Lego menu

Morbi <select>posuere nisi eget leo fringilla in eget .custom-selectfelis. Mores dicendi limitantur ad apparentiam initialem et debitum ad limites navigandi <select>mutare non possunt .<option>

<select class="custom-select">
  <option selected>Open this select menu</option>
  <option value="1">One</option>
  <option value="2">Two</option>
  <option value="3">Three</option>
</select>

Etiam ex parvis et magnis consuetudinibus eligere potes ut nostrae textus initibus similiter mediocribus respondeant.

<select class="custom-select custom-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>

<select class="custom-select custom-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>

Affirmat multipleetiam attributum;

<select class="custom-select" multiple>
  <option selected>Open this select menu</option>
  <option value="1">One</option>
  <option value="2">Two</option>
  <option value="3">Three</option>
</select>

sicut sizeattributum est;

<select class="custom-select" size="3">
  <option selected>Open this select menu</option>
  <option value="1">One</option>
  <option value="2">Two</option>
  <option value="3">Three</option>
</select>

Range

Create more <input type="range">controls with .custom-range. Vestigium (color) et pollex (pretii) utrumque appellati sunt ut idem per navigatores appareret. Cum solum IE et Firefox auxilium "implere" vestigia sua a sinistra vel dextra pollicis ut media ad progressum uisum indicant, non nunc id sustinemus.

<label for="customRange1">Example range</label>
<input type="range" class="custom-range" id="customRange1">

Range initibus implicatae valores habent pro minet max0et 100respective. Novas valores denotare potes pro utentibus minet maxattributis.

<label for="customRange2">Example range</label>
<input type="range" class="custom-range" min="0" max="5" id="customRange2">

Defalta, range initibus "disrumpam" ad valores integros. Ad hoc mutandum, stepvalorem definire potes. In exemplo infra duplicamus numerum graduum utendo step="0.5".

<label for="customRange3">Example range</label>
<input type="range" class="custom-range" min="0" max="5" step="0.5" id="customRange3">

File pasco

Tabella initus est maxime gnaviter fasciculi et requirit addito JavaScript si eos volitare velis cum functionibus Elige fasciculum… et lima nomen texti delectum.

<div class="custom-file">
  <input type="file" class="custom-file-input" id="customFile">
  <label class="custom-file-label" for="customFile">Choose file</label>
</div>

<input>Defectum lima via celamus opacityet pro stilo <label>. The button is generated and position with ::after. Demum declaramus a widthet heighte ad <input>iustae spatii ambitum contentum.

Translatione vel customising chordis

:lang()Pseudo-classis ad textum "Browse" translationis in alias linguas permittere adhibetur. Vincire vel addere viscus ad $custom-file-textSass variabilis cum tag linguarum pertinentibus et chordis localibus. chordae Anglicae eodem modo nativus esse possunt. Exempli gratia, hic est quomodo translationem Hispanicam addere possit (codex lingua Hispanica est es):

$custom-file-text: (
  en: "Browse",
  es: "Elegir"
);

Hic est lang(es)agendo de consuetudine fasciculi initus pro translatione Hispanica:

<div class="custom-file">
  <input type="file" class="custom-file-input" id="customFileLang" lang="es">
  <label class="custom-file-label" for="customFileLang">Seleccionar Archivo</label>
</div>

Linguam documenti tui (vel subtree eius) debes recte ponere ut textum rectam exhibeas. Hoc fieri potest utens attributio elementilang<html> vel HTTP Content-Languagecapitis , inter alias methodos.