Bɔtin dɛn
Yuz Bootstrap in kɔstɔm bɔtin stayl dɛn fɔ akshɔn dɛn na fɔm dɛn, dayalɔg dɛn, ɛn mɔ wit sɔpɔt fɔ bɔku saiz dɛn, stet dɛn, ɛn ɔda tin dɛn.
Bootstrap inklud sɔm prɛdifayn bɔtin stayl dɛn, ɛni wan de sav in yon sɛmantik pɔpɔshɔn, wit sɔm ɛkstra dɛn we dɛn trowe insay fɔ mɔ kɔntrol.
Fɔ gi minin to ɛtɛknɔlɔji dɛn we de ɛp
Yuz kala fɔ ad minin de jɔs gi wan vijual indikashɔn, we dɛn nɔ go gi to di wan dɛn we de yuz ɛtɛknɔlɔji dɛn we de ɛp – lɛk skrin rida dɛn. Mek shɔ se di infɔmeshɔn we dɛn sho wit di kɔlɔ de sho klia wan frɔm di tin we de insay insɛf (ɛgz. di tɛks we yu de si), ɔ dɛn put am insay ɔda we dɛn, lɛk ɔda tɛks we dɛn ayd wit di .sr-only
klas.
Dɛn .btn
mek di klas dɛn fɔ yuz wit di <button>
ɛlimɛnt. Bɔt yu kin yuz dɛn klas dɛn ya bak pan <a>
ɔ <input>
ɛlimɛnt dɛn (pan ɔl we sɔm brɔuza dɛn kin yuz wan smɔl difrɛn rɛndreshɔn).
We yu de yuz bɔtin klas dɛn pan <a>
ɛlimɛnt dɛn we dɛn kin yuz fɔ trig in-pej wok (lɛk kɔntinyu fɔ kɔlaps), pas fɔ link to nyu pej ɔ sɛkshɔn dɛn insay di pej we de naw, dɛn fɔ gi dɛn link dɛn ya a role="button"
fɔ mek dɛn ebul fɔ gi dɛn rizin di rayt we to ɛtɛknɔlɔji dɛn we de ɛp dɛn lɛk skrin rida dɛn.
Yu nid bɔtin, bɔt nɔto di hefty bakgrɔn kɔlɔ dɛn we dɛn kin briŋ? Riples di difɔlt modifya klas dɛn wit di .btn-outline-*
wan dɛn fɔ pul ɔl di bakgrɔn pikchɔ ɛn kɔlɔ dɛn na ɛni bɔtin.
Fans big ɔ smɔl bɔtin dɛn? Ad .btn-lg
ɔ .btn-sm
fɔ ɔda saiz dɛn.
Krio blɔk lɛvɛl bɔtin dɛn—di wan dɛn we de span di ful wit fɔ wan mama ɔ papa—bay we yu ad .btn-block
.
Bɔtin dɛn go apia we dɛn prɛs (wit bakgrɔn we dak, bɔda we dak, ɛn shado we dɛn put insay) we dɛn de wok. No nid nɔ de fɔ ad klas to <button>
s as dɛn de yuz pseudo-klas . Bɔt, yu kin stil fos di sem aktiv apinɛns wit .active
(ɛn inklud di aria-pressed="true"
atribyut) if yu nid fɔ riplik di stet programmatik wan.
Mek bɔtin dɛn luk inaktiv bay we yu ad di disabled
buli atribyut to ɛni <button>
ɛlimɛnt.
Di bɔtin dɛn we nɔ ebul fɔ yuz di <a>
ɛlimɛnt kin biev difrɛn smɔl:
<a>
s nɔ de sɔpɔt didisabled
atribyut, so yu fɔ ad di.disabled
klas fɔ mek i tan lɛk se i nɔ ebul fɔ si.- Sɔm stayl dɛn we go fayn fɔ tumara bambay de fɔ disable ɔl
pointer-events
di ankɔ bɔtin dɛn. Insay brawza dɛn we de sɔpɔt da prɔpati de, yu nɔ go si di kɔsa we dɔn disable atɔl. - Disabled bɔtin dɛn fɔ gɛt di
aria-disabled="true"
atribyut fɔ sho di stet fɔ di ɛlimɛnt to ɛp teknɔlɔji dɛn.
Link funkshɔnaliti caveat
Di .disabled
klas de yuz pointer-events: none
fɔ tray fɔ disable di link funkshɔnaliti fɔ <a>
s, bɔt da CSS prɔpati de nɔ standad yet. Apat frɔm dat, ivin insay brawza dɛn we de sɔpɔt pointer-events: none
, di kibɔd nevigishɔn nɔ de afɛkt, we min se di wan dɛn we de si di kibɔd ɛn di wan dɛn we de yuz ɛtɛknɔlɔji dɛn we de ɛp dɛn go stil ebul fɔ aktiv dɛn link dɛn ya. So fɔ mek yu sef, ad wan tabindex="-1"
atribyut na dɛn link dɛn ya (fɔ mek dɛn nɔ gɛt kibɔd fɔs) ɛn yuz kɔstɔm JavaSkript fɔ disable dɛn wok.
Du mɔ wit bɔtin dɛn. Kɔntrol bɔtin de tɔk ɔ mek grup dɛn fɔ bɔtin fɔ mɔ kɔmpɔnɛnt dɛn lɛk tulba dɛn.
Add data-toggle="button"
to toggle wan bɔtin in active
stet. If yu de pri-toggling wan bɔtin, yu fɔ ad di .active
klas ɛn aria-pressed="true"
to di <button>
.
Yu kin yuz Bootstrap in .button
stayl dɛn fɔ ɔda ɛlimɛnt dɛn, lɛk <label>
s, fɔ gi chɛkbɔks ɔ redio stayl bɔtin tɔgl. Ad data-toggle="buttons"
to wan .btn-group
we gɛt dɛn bɔtin dɛn we dɛn dɔn chenj fɔ mek dɛn ebul fɔ chenj di we aw dɛn de biev bay JavaSkript ɛn ad .btn-group-toggle
fɔ stayl di <input>
s dɛn we de insay yu bɔtin dɛn. Notis se yu kin mek wan bɔtin dɛn we gɛt input-pawa ɔ grup dɛn pan dɛn.
Di stet we dɛn chɛk fɔ dɛn bɔtin dɛn ya de ɔpdet nɔmɔ bay click
di ivin we de na di bɔtin. If yu yuz ɔda we fɔ ɔpdet di input—ɛgz., wit <input type="reset">
ɔ bay we yu yuz di input in checked
prɔpati wit yu an—yu go nid fɔ tɔgl .active
di wan <label>
wit yu an.
Notis se di bɔtin dɛn we yu dɔn chɛk bifo tɛm nid fɔ ad di .active
klas wit yu an to di input in <label>
.
We | Tɔk bɔt |
---|---|
$().button('toggle') |
Toggles push stet. Gi di bɔtin di we aw i tan lɛk se dɛn dɔn aktiv am. |
$().button('dispose') |
I de pwɛl wan ɛlimɛnt in bɔtin. |