Diforomo
Mehlala le ditlhahlo ta tirio ta mekgwa ya taolo ya foromo, dikgetho ta peakanyo, le dikarolo ta tlwaelo ta go hlama mehutahuta ya diforomo.
Kakaretšo
Ditaolo tša foromo tša Bootstrap di atološa go mekgwa ya rena ya foromo ya Rebooted ka diklase. Šomiša diklase tše go kgetha go tsena dipontšhong tša tšona tše di rulagantšwego bakeng sa phetolelo ye e sa fetogego kudu go ralala le diphensele le didirišwa.
Kgonthiša gore o šomiša type
seka sa maleba go ditseno ka moka (mohlala, email
bakeng sa aterese ya imeile goba number
bakeng sa tshedimošo ya dipalo) go diriša mohola wa ditaolo tše mpsha tša tsenyo go swana le netefatšo ya imeile, kgetho ya dinomoro, le tše dingwe.
Mohlala wa ka pela wa go bontšha mekgwa ya foromo ya Bootstrap ke ye. Tšwela pele o bala bakeng sa ditokomane tša diklase tše di nyakegago, peakanyo ya foromo, le tše dingwe.
<form>
<div class="mb-3">
<label for="exampleInputEmail1" class="form-label">Email address</label>
<input type="email" class="form-control" id="exampleInputEmail1" aria-describedby="emailHelp">
<div id="emailHelp" class="form-text">We'll never share your email with anyone else.</div>
</div>
<div class="mb-3">
<label for="exampleInputPassword1" class="form-label">Password</label>
<input type="password" class="form-control" id="exampleInputPassword1">
</div>
<div class="mb-3 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>
Foromo sengwalwa
Sengwalwa sa foromo sa maemo a boloko goba sa maemo a ka gare ga mothaladi se ka hlolwa ka go šomiša .form-text
.
Go tswalanya sengwalwa sa foromo le ditaolo ta foromo
Sengwalwa sa foromo se swanetše go tswalanywa ka go lebanya le taolo ya foromo yeo e amanago le go šomiša aria-describedby
seka. Se se tla netefatša gore theknolotši ya go thuša—go swana le dibadi tša skrine—di tla tsebiša sengwalwa se sa foromo ge modiriši a tsepamiša kgopolo goba a tsena taolong.
Sengwalwa sa foromo ka fase ga ditseno se ka setaele ka .form-text
. Ge e le gore elemente ya maemo a boloko e tla šomišwa, moedi wa godimo o okeletšwa bakeng sa sekgoba se bonolo go tšwa go ditseno tše di lego ka godimo.
<label for="inputPassword5" class="form-label">Password</label>
<input type="password" id="inputPassword5" class="form-control" aria-describedby="passwordHelpBlock">
<div id="passwordHelpBlock" class="form-text">
Your password must be 8-20 characters long, contain letters and numbers, and must not contain spaces, special characters, or emoji.
</div>
Sengwalwa sa ka gare ga mothaladi se ka šomiša elemente efe goba efe ye e tlwaelegilego ya HTML ya ka gare ga mothaladi (e ka ba <span>
, <small>
, goba se sengwe) ka go se be le selo go feta .form-text
sehlopha.
<div class="row g-3 align-items-center">
<div class="col-auto">
<label for="inputPassword6" class="col-form-label">Password</label>
</div>
<div class="col-auto">
<input type="password" id="inputPassword6" class="form-control" aria-describedby="passwordHelpInline">
</div>
<div class="col-auto">
<span id="passwordHelpInline" class="form-text">
Must be 8-20 characters long.
</span>
</div>
</div>
Diforomo tša bao ba golofetšego
Oketša disabled
seka sa boolean go tsenyo go thibela ditirišano tša modiriši le go dira gore e bonagale e le bofefo.
<input class="form-control" id="disabledInput" type="text" placeholder="Disabled input here..." disabled>
Oketša disabled
seka go a <fieldset>
go šitiša ditaolo ka moka ka gare. Diphensele di swara ditaolo ka moka tša foromo ya setlogo ( <input>
, <select>
, le <button>
dielemente) ka gare ga a <fieldset disabled>
bjalo ka tšeo di golofetšego, go thibela bobedi ditirišano tša khiiboto le toeba go tšona.
Le ge go le bjalo, ge e le gore foromo ya gago e akaretša gape le dielemente tša go swana le konope ya tlwaelo tša go swana le <a class="btn btn-*">...</a>
, tše di tla fiwa fela setaele sa pointer-events: none
, go ra gore di sa tsepama ebile di šoma ka go šomiša khiiboto. Tabeng ye, o swanetše go fetoša ka seatla ditaolo tše ka go tlaleletša tabindex="-1"
go di thibela go amogela nepo le aria-disabled="disabled"
go laetša boemo bja tšona go theknolotši ya go thuša.
<form>
<fieldset disabled>
<legend>Disabled fieldset example</legend>
<div class="mb-3">
<label for="disabledTextInput" class="form-label">Disabled input</label>
<input type="text" id="disabledTextInput" class="form-control" placeholder="Disabled input">
</div>
<div class="mb-3">
<label for="disabledSelect" class="form-label">Disabled select menu</label>
<select id="disabledSelect" class="form-select">
<option>Disabled select</option>
</select>
</div>
<div class="mb-3">
<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>
</div>
<button type="submit" class="btn btn-primary">Submit</button>
</fieldset>
</form>
Phihlelelo
Netefatša gore ditaolo ka moka tša foromo di na le leina la maleba leo le fihlelelwago gore morero wa tšona o kgone go fetišetšwa go badiriši ba theknolotši ya go thuša. Tsela ye bonolo ya go fihlelela se ke go šomiša <label>
elemente, goba—mo tabeng ya dikonope—go akaretša sengwalwa seo se hlalošago ka mo go lekanego bjalo ka karolo ya <button>...</button>
diteng.
Bakeng sa maemo ao go ona go sa kgonegego go akaretša <label>
diteng tša sengwalwa tše di bonagalago goba tša maleba, go na le ditsela tše dingwe tša go sa fa leina leo le fihlelelwago, go swana le:
<label>
elements patiloeng sebelisa.visually-hidden
sehlopha- Go šupa elemente ye e lego gona yeo e ka šomago bjalo ka leina ka go šomiša
aria-labelledby
- Go fana ka
title
seka - Beakanya ka go lebanya leina leo le fihlelelwago godimo ga elemente ka go šomiša
aria-label
Ge e le gore ga go le e tee ya tše yeo e lego gona, theknolotši ya go thuša e ka retologela go šomiša placeholder
seka bjalo ka go boela morago bakeng sa leina leo le fihlelelwago godimo <input>
le <textarea>
dielemente. Mehlala yeo e lego karolong ye e fa mekgwa ye mmalwa ye e šišintšwego, yeo e lebanego le taba ye e itšego.
Le ge go šomiša diteng tše di utilwego ka pono ( .visually-hidden
, aria-label
, gaešita le placeholder
diteng, tšeo di nyamelelago ge tšhemo ya foromo e šetše e na le diteng) go tla hola badiriši ba theknolotši ya go thuša, go hloka sengwalwa sa leibole seo se bonagalago go sa dutše go ka ba bothata go badiriši ba itšego. Mohuta o itšego wa leina le le bonagalago ka kakaretšo ke mokgwa wo mokaone, bobedi bakeng sa phihlelelo le go šomišega.
Sass
Diphetogo tše ntši tša foromo di bewa maemong a kakaretšo go šomišwa gape le go katološwa ke dikarolo tša foromo ka botee. O tla bona tše gantši kudu bjalo ka $btn-input-*
le $input-*
diphetogo.
Diphetogo
$btn-input-*
diphetogo ke diphetogo tša lefase ka bophara tšeo di abelanwago magareng ga dikonope tša rena le dikarolo tša rena tša foromo. O tla hwetša tše di abelwa gape gantši bjalo ka dikelo go diphetogo tše dingwe tše di itšego tša karolo.
$input-btn-padding-y: .375rem;
$input-btn-padding-x: .75rem;
$input-btn-font-family: null;
$input-btn-font-size: $font-size-base;
$input-btn-line-height: $line-height-base;
$input-btn-focus-width: .25rem;
$input-btn-focus-color-opacity: .25;
$input-btn-focus-color: rgba($component-active-bg, $input-btn-focus-color-opacity);
$input-btn-focus-blur: 0;
$input-btn-focus-box-shadow: 0 0 $input-btn-focus-blur $input-btn-focus-width $input-btn-focus-color;
$input-btn-padding-y-sm: .25rem;
$input-btn-padding-x-sm: .5rem;
$input-btn-font-size-sm: $font-size-sm;
$input-btn-padding-y-lg: .5rem;
$input-btn-padding-x-lg: 1rem;
$input-btn-font-size-lg: $font-size-lg;
$input-btn-border-width: $border-width;