Composants
API CSS

API CSS

Le framework de composants intègre une API CSS complète vous permettant de personnaliser l'apparence de tous les composants sans écrire de CSS personnalisé.

Principe de fonctionnement

Chaque fois qu'un composant expose une propriété css, sa valeur doit être une liste de classes CSS séparées par des espaces.

// Exemple : appliquer des classes à l'item d'index 0 d'une SortList
sortlist.items[0]["css"] = "success-state animated pulse infinite"

La propriété css est disponible sur la plupart des éléments des composants. Consultez la documentation de chaque composant pour connaître les propriétés css exposées.


Classes d'apparence

Ces classes modifient la couleur de fond et la bordure d'un élément pour signaler un état particulier à l'apprenant.

ClasseEffet
success-stateFond vert + texte vert foncé (état de succès)
warning-stateFond jaune + texte ambre (état d'avertissement)
error-stateFond rouge + texte rouge foncé (état d'erreur)
success-borderBordure verte uniquement
warning-borderBordure jaune uniquement
error-borderBordure rouge uniquement

Exemple d'utilisation :

// Marquer un item correct
sortlist.items[0]["css"] = "success-state"
 
// Marquer un item incorrect
sortlist.items[1]["css"] = "error-state"
 
// Ajouter uniquement une bordure d'avertissement
sortlist.items[2]["css"] = "warning-border"

Cliquez sur une apparence ci-dessous pour copier sa classe CSS :

success-state
warning-state
error-state
success-border
warning-border
error-border

Classes d'animation

Le framework utilise la bibliothèque Animate.css (opens in a new tab). Les classes d'animation s'utilisent toujours avec la classe de base animated.

// Syntaxe générale
element["css"] = "animated <nomAnimation>"

Attentions / Emphases

ClasseEffet
bounceRebond
flashClignotement
pulsePulsation
rubberBandEffet élastique
headShakeSecousse de tête
swingBalancement
tadaEffet tada (zoom + rotation)
wobbleOscillation
jelloEffet gelée
jackInTheBoxApparition surprenante
heartBeatBattement de cœur

Entrées (Bounce)

Classe
bounceIn
bounceInDown
bounceInLeft
bounceInRight
bounceInUp

Sorties (Bounce)

Classe
bounceOut
bounceOutDown
bounceOutLeft
bounceOutRight
bounceOutUp

Entrées (Fade)

Classe
fadeIn
fadeInDown
fadeInDownBig
fadeInLeft
fadeInLeftBig
fadeInRight
fadeInRightBig
fadeInUp
fadeInUpBig

Sorties (Fade)

Classe
fadeOut
fadeOutDown
fadeOutDownBig
fadeOutLeft
fadeOutLeftBig
fadeOutRight
fadeOutRightBig
fadeOutUp
fadeOutUpBig

Flip

Classe
flipInX
flipInY
flipOutX
flipOutY

LightSpeed

Classe
lightSpeedIn
lightSpeedOut

Rotations (Entrées)

Classe
rotateIn
rotateInDownLeft
rotateInDownRight
rotateInUpLeft
rotateInUpRight

Rotations (Sorties)

Classe
rotateOut
rotateOutDownLeft
rotateOutDownRight
rotateOutUpLeft
rotateOutUpRight

Spéciales

ClasseEffet
hingeChute d'une charnière
rollInRoulé vers l'intérieur
rollOutRoulé vers l'extérieur

Zoom (Entrées)

Classe
zoomIn
zoomInDown
zoomInLeft
zoomInRight
zoomInUp

Zoom (Sorties)

Classe
zoomOut
zoomOutDown
zoomOutLeft
zoomOutRight
zoomOutUp

Slides (Entrées)

Classe
slideInDown
slideInLeft
slideInRight
slideInUp

Slides (Sorties)

Classe
slideOutDown
slideOutLeft
slideOutRight
slideOutUp

Cliquez sur une animation pour la prévisualiser, double-cliquez pour copier sa classe CSS :

Clic pour prévisualiser · Double-clic pour copier la classe CSS.

bounce
flash
pulse
rubberBand
shakeX
shakeY
headShake
swing
tada
wobble
jello
heartBeat
backInDown
backInLeft
backInRight
backInUp
backOutDown
backOutLeft
backOutRight
backOutUp
bounceIn
bounceInDown
bounceInLeft
bounceInRight
bounceInUp
bounceOut
bounceOutDown
bounceOutLeft
bounceOutRight
bounceOutUp
fadeIn
fadeInDown
fadeInDownBig
fadeInLeft
fadeInLeftBig
fadeInRight
fadeInRightBig
fadeInUp
fadeInUpBig
fadeInTopLeft
fadeInTopRight
fadeInBottomLeft
fadeInBottomRight
fadeOut
fadeOutDown
fadeOutDownBig
fadeOutLeft
fadeOutLeftBig
fadeOutRight
fadeOutRightBig
fadeOutUp
fadeOutUpBig
fadeOutTopLeft
fadeOutTopRight
fadeOutBottomRight
fadeOutBottomLeft
flip
flipInX
flipInY
flipOutX
flipOutY
lightSpeedInRight
lightSpeedInLeft
lightSpeedOutRight
lightSpeedOutLeft
rotateIn
rotateInDownLeft
rotateInDownRight
rotateInUpLeft
rotateInUpRight
rotateOut
rotateOutDownLeft
rotateOutDownRight
rotateOutUpLeft
rotateOutUpRight
hinge
jackInTheBox
rollIn
rollOut
zoomIn
zoomInDown
zoomInLeft
zoomInRight
zoomInUp
zoomOut
zoomOutDown
zoomOutLeft
zoomOutRight
zoomOutUp
slideInDown
slideInLeft
slideInRight
slideInUp
slideOutDown
slideOutLeft
slideOutRight
slideOutUp

Options d'animation

Ces classes s'appliquent en complément d'une animation pour en contrôler la vitesse ou le délai.

Vitesse

ClasseDurée
fast800ms
faster500ms
slow2s
slower3s

Délai de déclenchement

ClasseDélai
delay-1s1 seconde
delay-2s2 secondes
delay-3s3 secondes
delay-4s4 secondes
delay-5s5 secondes

Répétition

ClasseEffet
infiniteRépète l'animation indéfiniment

Combiner apparences et animations

Vous pouvez combiner des classes d'apparence et d'animation pour un retour visuel riche :

// Élément correct avec une animation de pulsation infinie
element["css"] = "success-state animated pulse infinite"
 
// Élément incorrect avec une secousse rapide
element["css"] = "error-state animated headShake faster"
 
// Bordure d'avertissement avec animation lente en boucle
element["css"] = "warning-border animated heartBeat slow infinite"
⚠️

L'animation infinite est à utiliser avec modération. Une animation perpétuelle peut distraire l'apprenant. Privilégiez-la pour les feedbacks importants ou les états actifs.