Kokende liboso
Mikanda mpe bandakisa mpo na kosalela ba barres ya progression personnalisée ya Bootstrap oyo ezali na lisungi mpo na ba barres oyo etandami, ba fond d’animation, mpe ba étiquettes ya makomi.
Ndenge oyo esalaka
Ba composants ya progrès etongami na ba éléments HTML mibale, mua CSS pona ko setting largeur, pe mua ba attributs. Tosalelaka te eleman HTML5<progress>
, kosala ete okoka kosala ebele ya ba barres ya progrès, ko animer yango, mpe kotia ba étiquettes ya makomi likolo na yango.
- Tosalelaka
.progress
lokola enveloppe pona kolakisa valeur max ya barre ya progression. - Tosalelaka oyo ya kati
.progress-bar
mpo na komonisa bokoli oyo esalemi tii sikoyo. - The
.progress-bar
esengaka style ya inline, classe ya utilitaire, to CSS personnalisé pona kotiya largeur na bango. - The
.progress-bar
esengaka mpe mwarole
mpearia
bizaleli mpo na kosala ete ekoki kozwama, bakisa mpe nkombo oyo ekoki kozwama (kosalelaaria-label
,aria-labelledby
, to ya ndenge wana).
Botia yango nyonso esika moko, mpe bozali na bandakisa oyo elandi.
<div class="progress">
<div class="progress-bar" role="progressbar" aria-label="Basic example" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100"></div>
</div>
<div class="progress">
<div class="progress-bar" role="progressbar" aria-label="Basic example" style="width: 25%" aria-valuenow="25" aria-valuemin="0" aria-valuemax="100"></div>
</div>
<div class="progress">
<div class="progress-bar" role="progressbar" aria-label="Basic example" style="width: 50%" aria-valuenow="50" aria-valuemin="0" aria-valuemax="100"></div>
</div>
<div class="progress">
<div class="progress-bar" role="progressbar" aria-label="Basic example" style="width: 75%" aria-valuenow="75" aria-valuemin="0" aria-valuemax="100"></div>
</div>
<div class="progress">
<div class="progress-bar" role="progressbar" aria-label="Basic example" style="width: 100%" aria-valuenow="100" aria-valuemin="0" aria-valuemax="100"></div>
</div>
Bootstrap epesaka mwa ndambo ya ba utilitaires mpo na kotiya bonene . Na kotalela bamposa na yo, yango ekoki kosalisa na kobongisa nokinoki bokoli.
<div class="progress">
<div class="progress-bar w-75" role="progressbar" aria-label="Basic example" aria-valuenow="75" aria-valuemin="0" aria-valuemax="100"></div>
</div>
Ba étiquettes
Bakisa ba étiquettes na ba barres na yo ya progrès na kotiaka makomi na kati ya .progress-bar
.
<div class="progress">
<div class="progress-bar" role="progressbar" aria-label="Example with label" style="width: 25%;" aria-valuenow="25" aria-valuemin="0" aria-valuemax="100">25%</div>
</div>
Molai
Totie kaka height
valeur na .progress
, donc soki o changer valeur wana ya kati .progress-bar
eko changer automatiquement taille en conséquence.
<div class="progress" style="height: 1px;">
<div class="progress-bar" role="progressbar" aria-label="Example 1px high" style="width: 25%;" aria-valuenow="25" aria-valuemin="0" aria-valuemax="100"></div>
</div>
<div class="progress" style="height: 20px;">
<div class="progress-bar" role="progressbar" aria-label="Example 20px high" style="width: 25%;" aria-valuenow="25" aria-valuemin="0" aria-valuemax="100"></div>
</div>
Makambo oyo esalemaki na nsima
Salelá bakelasi ya utilité ya nsima mpo na kobongola ndenge oyo ba barres ya progrès mokomoko ezali komonana.
<div class="progress">
<div class="progress-bar bg-success" role="progressbar" aria-label="Success example" style="width: 25%" aria-valuenow="25" aria-valuemin="0" aria-valuemax="100"></div>
</div>
<div class="progress">
<div class="progress-bar bg-info" role="progressbar" aria-label="Info example" style="width: 50%" aria-valuenow="50" aria-valuemin="0" aria-valuemax="100"></div>
</div>
<div class="progress">
<div class="progress-bar bg-warning" role="progressbar" aria-label="Warning example" style="width: 75%" aria-valuenow="75" aria-valuemin="0" aria-valuemax="100"></div>
</div>
<div class="progress">
<div class="progress-bar bg-danger" role="progressbar" aria-label="Danger example" style="width: 100%" aria-valuenow="100" aria-valuemin="0" aria-valuemax="100"></div>
</div>
Kopesa ndimbola na ba technologies ya kosunga
Kosalela langi mpo na kobakisa ndimbola epesaka kaka elembo ya komona, oyo ekopesama te na basaleli ya mayele ya kosunga – lokola batángi ya écran. Sala ete sango oyo elakisami na langi ezala polele uta na makambo yango moko (ndakisa makomi oyo ezali komonana), to ekotisama na nzela ya mayele mosusu, lokola makomi ya kobakisa oyo ebombami elongo na .visually-hidden
kelasi.
Ba barres ebele
Botia ba barres ya progression ebele na composante ya progression soki oza na besoin.
<div class="progress">
<div class="progress-bar" role="progressbar" aria-label="Segment one" style="width: 15%" aria-valuenow="15" aria-valuemin="0" aria-valuemax="100"></div>
<div class="progress-bar bg-success" role="progressbar" aria-label="Segment two" style="width: 30%" aria-valuenow="30" aria-valuemin="0" aria-valuemax="100"></div>
<div class="progress-bar bg-info" role="progressbar" aria-label="Segment three" style="width: 20%" aria-valuenow="20" aria-valuemin="0" aria-valuemax="100"></div>
</div>
Ezali na bansinga
Bakisa .progress-bar-striped
na nyonso .progress-bar
mpo na kosalela bande na nzela ya gradient CSS likolo ya langi ya nsima ya barre ya bokende liboso.
<div class="progress">
<div class="progress-bar progress-bar-striped" role="progressbar" aria-label="Default striped example" style="width: 10%" aria-valuenow="10" aria-valuemin="0" aria-valuemax="100"></div>
</div>
<div class="progress">
<div class="progress-bar progress-bar-striped bg-success" role="progressbar" aria-label="Success striped example" style="width: 25%" aria-valuenow="25" aria-valuemin="0" aria-valuemax="100"></div>
</div>
<div class="progress">
<div class="progress-bar progress-bar-striped bg-info" role="progressbar" aria-label="Info striped example" style="width: 50%" aria-valuenow="50" aria-valuemin="0" aria-valuemax="100"></div>
</div>
<div class="progress">
<div class="progress-bar progress-bar-striped bg-warning" role="progressbar" aria-label="Warning striped example" style="width: 75%" aria-valuenow="75" aria-valuemin="0" aria-valuemax="100"></div>
</div>
<div class="progress">
<div class="progress-bar progress-bar-striped bg-danger" role="progressbar" aria-label="Danger striped example" style="width: 100%" aria-valuenow="100" aria-valuemin="0" aria-valuemax="100"></div>
</div>
Ba rayures animées
Gradient rayé ekoki pe kozala animation. Bakisa .progress-bar-animated
na mpo na .progress-bar
ko animer ba rayures droite à gauche via ba animations CSS3.
<div class="progress">
<div class="progress-bar progress-bar-striped progress-bar-animated" role="progressbar" aria-label="Animated striped example" aria-valuenow="75" aria-valuemin="0" aria-valuemax="100" style="width: 75%"></div>
</div>
CSS
Ba variables oyo ezali
Ebakisami na v5.2.0Lokola eteni ya approche ya ba variables CSS oyo ezali ko évoluer ya Bootstrap, ba barres ya progrès esalela sikoyo ba variables CSS locales na .progress
pona personnalisation ya temps réel oyo ematisami. Ba valeurs pona ba variables ya CSS etiamaki na nzela ya Sass, yango wana personnalisation ya Sass ezali kaka kosungama, pe.
--#{$prefix}progress-height: #{$progress-height};
@include rfs($progress-font-size, --#{$prefix}progress-font-size);
--#{$prefix}progress-bg: #{$progress-bg};
--#{$prefix}progress-border-radius: #{$progress-border-radius};
--#{$prefix}progress-box-shadow: #{$progress-box-shadow};
--#{$prefix}progress-bar-color: #{$progress-bar-color};
--#{$prefix}progress-bar-bg: #{$progress-bar-bg};
--#{$prefix}progress-bar-transition: #{$progress-bar-transition};
Ba variables ya Sass
$progress-height: 1rem;
$progress-font-size: $font-size-base * .75;
$progress-bg: $gray-200;
$progress-border-radius: $border-radius;
$progress-box-shadow: $box-shadow-inset;
$progress-bar-color: $white;
$progress-bar-bg: $primary;
$progress-bar-animation-timing: 1s linear infinite;
$progress-bar-transition: width .6s ease;
Ba cadres clés
Esalemi mpo na kosala ba animations ya CSS mpo na .progress-bar-animated
. Ezali na kati ya scss/_progress-bar.scss
.
@if $enable-transitions {
@keyframes progress-bar-stripes {
0% { background-position-x: $progress-height; }
}
}