All components

Components · Learning

AnswerChoice

One option in a question. It pops when correct and shakes once when wrong.

Try itChange the motion setting at the top to feel each personality.
An exit should be
Every state

Use it

<AnswerChoice state="correct" onClick={pick}>
  Quicker than the enter
</AnswerChoice>

How it moves

WhenRoleWhat moves
Pointer moves over or away, while idlestate-changeBackground color changes
Pressed down, releasedfeedbackScales to the role's scale and back
Becomes selectedstate-changeBackground color changes
Becomes correctstate-change, then celebrationColors change, and the choice pops from the celebration scale back to 1
Becomes incorrectstate-change, then attentionColors change, and the choice shakes once across the attention distance
Result mark appearsenterThe check or cross fades in and rises by the enter distance, growing from the enter scale
Returns to idlestate-changeColors change back. Nothing else moves

Rules:

Reduced motion: the celebration scale is 1 and the attention and enter distances are 0, so nothing moves. The colors still change and the mark still fades in.

CSS variables used: --ss-motion-feedback-*, --ss-motion-state-change-duration, --ss-motion-state-change-easing, --ss-motion-celebration-scale, --ss-motion-celebration-spring, --ss-motion-celebration-spring-duration, --ss-motion-attention-distance, --ss-motion-attention-duration, --ss-motion-attention-easing, --ss-motion-enter-distance, --ss-motion-enter-spring, --ss-motion-enter-spring-duration.

The check or x is the Icon component, so it draws itself as it appears (Icon motion: draw). Under reduced motion it appears complete.