Source

Fa'amau

Fa'aoga sitaili fa'aautu masani a Bootstrap mo gaioiga i fomu, talanoaga, ma isi mea fa'atasi ai ma le lagolago mo le tele o lapopoa, setete, ma isi mea.

Faataitaiga

O le Bootstrap e aofia ai le tele o sitaili faʻamaufaʻailogaina faʻamau, o loʻo faʻaogaina e taʻitasi lona lava faʻamoemoega faʻapitoa, faʻatasi ai ma nai mea faʻaopoopo e lafo i totonu mo le sili atu le pulea.

<button type="button" class="btn btn-primary">Primary</button>
<button type="button" class="btn btn-secondary">Secondary</button>
<button type="button" class="btn btn-success">Success</button>
<button type="button" class="btn btn-danger">Danger</button>
<button type="button" class="btn btn-warning">Warning</button>
<button type="button" class="btn btn-info">Info</button>
<button type="button" class="btn btn-light">Light</button>
<button type="button" class="btn btn-dark">Dark</button>

<button type="button" class="btn btn-link">Link</button>
Tu'uina atu le uiga i tekinolosi fesoasoani

O le fa'aogaina o le lanu e fa'aopoopo ai le uiga e na'o se fa'aaliga va'aia, e le fa'ailoa atu i tagata fa'aoga o tekonolosi fesoasoani - e pei o le au faitau mata. Ia fa'amautinoa o fa'amatalaga o lo'o fa'ailogaina i le lanu e manino mai le anotusi lava ia (fa'ata'ita'iga o tusitusiga va'aia), pe fa'aofi mai i isi auala, e pei o tusitusiga fa'aopoopo natia i le .sr-onlyvasega.

Fa'ailoga fa'amau

O .btnvasega ua mamanuina e faʻaaogaina ma le <button>elemene. Ae ui i lea, e mafai foʻi ona e faʻaogaina nei vasega i luga <a>poʻo <input>elemene (e ui o nisi tagata suʻesuʻe e mafai ona faʻaogaina se faʻaliliuga laʻititi).

Pe a fa'aogaina vasega fa'amau i <a>elemene e fa'aaogaina e fa'aosoina ai galuega i totonu o le itulau (pei o le malepelepe o mea), nai lo le feso'ota'i i itulau fou po'o vaega i totonu o le itulau o lo'o i ai nei, e tatau ona tu'uina atu nei feso'ota'iga a role="button"e fa'ailoa lelei ai lo latou fa'amoemoe i tekinolosi fesoasoani e pei o le lau faitau mata.

So'oga
<a class="btn btn-primary" href="#" role="button">Link</a>
<button class="btn btn-primary" type="submit">Button</button>
<input class="btn btn-primary" type="button" value="Input">
<input class="btn btn-primary" type="submit" value="Submit">
<input class="btn btn-primary" type="reset" value="Reset">

Otootoga faamau

E mana'omia se fa'amau, ae le o lanu tetele o tua latou te aumaia? Suia vasega fa'aoga fa'aletonu i vasega .btn-outline-*e aveese uma ata ma lanu i luga o so'o se ki.

<button type="button" class="btn btn-outline-primary">Primary</button>
<button type="button" class="btn btn-outline-secondary">Secondary</button>
<button type="button" class="btn btn-outline-success">Success</button>
<button type="button" class="btn btn-outline-danger">Danger</button>
<button type="button" class="btn btn-outline-warning">Warning</button>
<button type="button" class="btn btn-outline-info">Info</button>
<button type="button" class="btn btn-outline-light">Light</button>
<button type="button" class="btn btn-outline-dark">Dark</button>

Tele

Mana'o i fa'amau tetele pe la'ititi? Fa'aopoopo .btn-lgpe .btn-smmo isi lapopo'a.

<button type="button" class="btn btn-primary btn-lg">Large button</button>
<button type="button" class="btn btn-secondary btn-lg">Large button</button>
<button type="button" class="btn btn-primary btn-sm">Small button</button>
<button type="button" class="btn btn-secondary btn-sm">Small button</button>

Fausia fa'amau fa'apoloka—o mea e fa'alautele le lautele atoa o se matua—e ala i le fa'aopoopoina .btn-block.

<button type="button" class="btn btn-primary btn-lg btn-block">Block level button</button>
<button type="button" class="btn btn-secondary btn-lg btn-block">Block level button</button>

Tulaga toaga

O fa'amau o le a foliga oomi (ma le pogisa pito i tua, pogisa tuaoi, ma fa'aofi ata lafoia) pe a gaioi. E le mana'omia le fa'aopoopoina o se vasega i <button>le s a'o latou fa'aogaina se pseudo-class . Ae ui i lea, e mafai lava ona e faʻamalosi foliga tutusa ma le .active(ma aofia ai le aria-pressed="true"uiga) pe a manaʻomia ona e toe faʻaogaina le setete i le polokalame.

<a href="#" class="btn btn-primary btn-lg active" role="button" aria-pressed="true">Primary link</a>
<a href="#" class="btn btn-secondary btn-lg active" role="button" aria-pressed="true">Link</a>

Tulaga le atoatoa

Fa'apena fa'amau fa'agaoioi e ala i le fa'aopoopoina o le disableduiga boolean i so'o se <button>elemene.

<button type="button" class="btn btn-lg btn-primary" disabled>Primary button</button>
<button type="button" class="btn btn-secondary btn-lg" disabled>Button</button>

O fa'amau fa'aletonu e fa'aaoga ai le <a>elemene e fai si 'ese'ese:

  • <a>e le lagolagoina le disableduiga, o lea e tatau ai ona e faaopoopo le .disabledvasega ina ia foliga mai e le atoatoa.
  • O nisi sitaili faauo i le lumana'i o lo'o i ai e fa'amalo uma pointer-eventsi fa'amau taula. I su'esu'ega o lo'o lagolagoina lena mea totino, e te le va'ai i le fa'ama'i fa'aletonu.
  • O faʻamau faʻaletonu e tatau ona aofia ai le aria-disabled="true"uiga e faʻaalia ai le tulaga o le elemene i tekinolosi fesoasoani.
<a href="#" class="btn btn-primary btn-lg disabled" tabindex="-1" role="button" aria-disabled="true">Primary link</a>
<a href="#" class="btn btn-secondary btn-lg disabled" tabindex="-1" role="button" aria-disabled="true">Link</a>

E .disabledfa'aoga e le vasega pointer-events: nonee taumafai e fa'amalo le feso'ota'iga o <a>le s, ae o lena CSS meatotino e le'i fa'asalaina. E le gata i lea, e oo lava i tagata su'esu'e o lo'o lagolagoina pointer-events: none, e tumau pea le le a'afiaina o le ta'avale keyboard, o lona uiga o tagata fa'aoga keyboard ma tagata fa'aoga fesoasoani tekonolosi o le a mafai lava ona fa'agaoioia nei so'oga. O lea ina ia saogalemu, faʻaopoopo se tabindex="-1"uiga i luga o nei soʻotaga (e puipuia ai i latou mai le mauaina o le keyboard) ma faʻaoga le JavaScript masani e faʻamalo ai a latou galuega.

Fa'amau fa'amau

Fai atili i fa'amau. Fa'amalo fa'aigoa po'o le fa'atupuina o vaega o fa'amau mo nisi vaega e pei o meafaigaluega.

Togi setete

Fa'aopoopo data-toggle="button"e sui le tulaga o se faamau active. Afai o lo'o e tosoina muamua se faamau, e tatau ona e fa'aopoopo ma le lima le .activevasega ma aria-pressed="true" le <button>.

<button type="button" class="btn btn-primary" data-toggle="button" aria-pressed="false" autocomplete="off">
  Single toggle
</button>

Pusa siaki ma faamau leitio

E mafai ona fa'aoga sitaili a Bootstrap .buttoni isi elemene, e pei o <label>le s, e tu'uina atu ai le pusa siaki po'o le sitaili o le leitio e sosolo. Fa'aopoopo data-toggle="buttons"i se mea o .btn-grouplo'o i ai na fa'amau fa'alelei ina ia mafai ai a latou amio fe'avea'i e ala i le JavaScript ma fa'aopoopo .btn-group-togglei le sitaili o <input>s i totonu o au fa'amau. Manatua e mafai ona e faia ni fa'amau fa'aulu e tasi po'o ni vaega o latou.

O le tulaga siaki mo nei faamau e na'o le fa'afouina e ala i clickmea na tupu i luga o le ki. Afai e te fa'aogaina se isi auala e fa'afou ai le fa'aulufale—fa'ata'ita'iga, fa'atasi <input type="reset">ma le fa'aogaina ma le lima ole mea e tu'uina atu checked—e mana'omia lou kili .activei le <label>lima.

Manatua o fa'amau na mua'i siaki e mana'omia oe e fa'aopoopo ma le lima le .activevasega i le mea fa'aoga <label>.

<div class="btn-group-toggle" data-toggle="buttons">
  <label class="btn btn-secondary active">
    <input type="checkbox" checked autocomplete="off"> Checked
  </label>
</div>
<div class="btn-group btn-group-toggle" data-toggle="buttons">
  <label class="btn btn-secondary active">
    <input type="radio" name="options" id="option1" autocomplete="off" checked> Active
  </label>
  <label class="btn btn-secondary">
    <input type="radio" name="options" id="option2" autocomplete="off"> Radio
  </label>
  <label class="btn btn-secondary">
    <input type="radio" name="options" id="option3" autocomplete="off"> Radio
  </label>
</div>

Metotia

Metotia Fa'amatalaga
$().button('toggle') Togi le tulaga tulei. Tu'u atu i le ki le foliga mai ua fa'agaoioia.
$().button('dispose') Fa'aleaga le faamau o se elemene.