Buttons
Yi amfani da salon maɓalli na al'ada na Bootstrap don ayyuka a cikin tsari, maganganu, da ƙari tare da goyan baya don girma dabam, jihohi, da ƙari.
Misalai
Bootstrap ya ƙunshi nau'ikan maɓalli da aka ƙirƙira, kowannensu yana hidimar maƙasudin nasa, tare da wasu ƙarin abubuwan da aka jefa don ƙarin sarrafawa.
Isar da ma'ana ga fasahar taimako
Yin amfani da launi don ƙara ma'ana kawai yana ba da alamar gani, wanda ba za a isar da shi ga masu amfani da fasahar taimako ba - kamar masu karanta allo. Tabbatar cewa bayanin da launi ke nunawa ko dai a bayyane yake daga abun cikin kanta (misali rubutun bayyane), ko kuma an haɗa shi ta hanyar madadin, kamar ƙarin rubutu da aka ɓoye tare da .sr-only
ajin.
Kashe rubutun rubutu
Idan ba ka son rubutun maɓallin ya naɗe, za ka iya ƙara .text-nowrap
ajin zuwa maɓallin. A cikin Sass, zaku iya saita $btn-white-space: nowrap
don musaki rubutun rubutu don kowane maɓalli.
Maballin tags
An .btn
tsara azuzuwan don a yi amfani da su tare da <button>
kashi. Koyaya, zaku iya amfani da waɗannan azuzuwan akan <a>
ko <input>
abubuwa (ko da yake wasu masu bincike na iya amfani da ma'anar ta ɗan bambanta).
Lokacin amfani da azuzuwan maɓalli akan <a>
abubuwan da ake amfani da su don haifar da ayyuka na cikin shafi (kamar abun ciki mai rugujewa), maimakon haɗawa zuwa sabbin shafuka ko sassan cikin shafin na yanzu, waɗannan hanyoyin haɗin yakamata a ba role="button"
su don isar da manufar su daidai ga fasahar taimako kamar su. masu karanta allo.
Maɓallin fayyace
Kuna buƙatar maɓalli, amma ba manyan launukan bangon da suke kawowa ba? Maye gurbin tsoffin azuzuwan gyare-gyare tare da .btn-outline-*
waɗanda don cire duk hotunan bango da launuka akan kowane maɓalli.
Girman girma
Kuna son manyan maɓalli ko ƙarami? Ƙara .btn-lg
ko .btn-sm
don ƙarin girma.
Ƙirƙirar maɓallan matakin toshe-waɗanda ke faɗin faɗin iyaye-ta ƙara .btn-block
.
Jihar mai aiki
Maɓallai za su bayyana a danna (tare da bango mai duhu, iyakar duhu, da inuwar saiti) lokacin aiki. Babu buƙatar ƙara aji zuwa <button>
s yayin da suke amfani da ajin ƙididdiga . Koyaya, har yanzu kuna iya tilasta bayyanar mai aiki iri ɗaya tare da .active
(kuma haɗa aria-pressed="true"
sifa) idan kuna buƙatar kwafin jihar ta hanyar shirye-shirye.
Jihar naƙasassu
Sanya maɓallan su zama marasa aiki ta ƙara disabled
sifa ta boolean zuwa kowane <button>
abu.
Maɓallan da aka kashe ta amfani da <a>
kashi sun ɗan bambanta:
<a>
s ba sa goyan bayandisabled
sifa, don haka dole ne ka ƙara.disabled
ajin don ganin ya zama naƙasasshe.- Wasu salon abokantaka na gaba an haɗa su don kashe duk
pointer-events
akan maɓallan anga. A cikin masu bincike waɗanda ke goyan bayan wannan kadara, ba za ku ga siginar nakasa ba kwata-kwata. - Maɓallan da aka kashe yakamata su haɗa da
aria-disabled="true"
sifa don nuna yanayin abubuwan fasahar taimako.
Haɗin aikin haɗin gwiwa
Ajin .disabled
yana amfani pointer-events: none
da shi don ƙoƙarin kashe aikin haɗin yanar gizo na <a>
s, amma wannan kadarorin CSS ba a daidaita ba tukuna. Bugu da kari, har ma a cikin masu binciken da ke goyan bayan pointer-events: none
, kewayawar madannai ya kasance ba shi da tasiri, ma'ana cewa masu amfani da madannai masu gani da masu amfani da fasahar taimako har yanzu za su iya kunna waɗannan hanyoyin haɗin. Don haka don zama lafiya, ƙara tabindex="-1"
sifa akan waɗannan hanyoyin haɗin (don hana su karɓar mayar da hankali kan madannai) kuma yi amfani da JavaScript na al'ada don musaki ayyukansu.
Maballin plugin
Yi ƙari tare da maɓalli. Maɓallin sarrafawa ko ƙirƙiri ƙungiyoyin maɓalli don ƙarin abubuwan haɗin gwiwa kamar sandunan kayan aiki.
Juyawa jihohi
Ƙara data-toggle="button"
don kunna yanayin maɓalli active
. Idan kana riga-kafin maɓalli, dole ne ka ƙara .active
ajin da hannu da aria-pressed="true"
zuwa <button>
.
Akwatin dubawa da maɓallan rediyo
Za a iya amfani da salon Bootstrap .button
zuwa wasu abubuwa, kamar <label>
s, don samar da akwatin rajistan shiga ko maɓallin maɓallin rediyo. Ƙara data-toggle="buttons"
zuwa abubuwan da .btn-group
ke ɗauke da waɗannan maɓallan da aka gyara don ba da damar haɓaka halayensu ta JavaScript kuma ƙara .btn-group-toggle
zuwa salon <input>
s ɗin da ke cikin maɓallan ku. Lura cewa zaku iya ƙirƙirar maɓallan shigarwa guda ɗaya ko ƙungiyoyinsu.
Yanayin da aka bincika don waɗannan maɓallan ana sabunta su ne kawai ta hanyar abin da click
ya faru akan maɓallin. Idan kun yi amfani da wata hanya don sabunta shigarwar-misali, tare da <input type="reset">
ko ta amfani da kayan shigar da hannu da hannu checked
-zaku buƙaci kunnawa .active
da <label>
hannu.
Lura cewa maɓallan da aka riga aka bincika suna buƙatar ka ƙara .active
ajin da hannu zuwa shigarwar <label>
.
Hanyoyin
Hanya | Bayani |
---|---|
$().button('toggle') |
Canza yanayin turawa. Yana ba da maɓallin kamannin cewa an kunna shi. |
$().button('dispose') |
Yana lalata maɓalli na wani abu. |