A spinner component in Bootstrap is a small animated graphic that shows loading or processing activity to users, helping them know the app is working.
Click to reveal answer
beginner
How do you create a simple spinner using Bootstrap?
Use the <div class='spinner-border' role='status'><span class='visually-hidden'>Loading...</span></div> code. This creates a circular spinner with accessible text.
Click to reveal answer
intermediate
What role does role='status' play in spinner components?
It helps screen readers announce the spinner as a status message, improving accessibility for users who rely on assistive technology.
Click to reveal answer
beginner
Name two types of spinners Bootstrap offers.
Bootstrap offers border spinners (a rotating border) and grow spinners (a growing and shrinking circle).
Click to reveal answer
intermediate
How can you change the color of a Bootstrap spinner?
Add a color utility class like <code>text-primary</code>, <code>text-success</code>, or <code>text-danger</code> to the spinner element to change its color.
Click to reveal answer
Which Bootstrap class creates a border spinner?
Aspinner-border
Bspinner-grow
Cspinner-circle
Dspinner-rotate
✗ Incorrect
The class spinner-border creates a spinner with a rotating border.
What is the purpose of the <span class='visually-hidden'> inside a spinner?
ATo add color to the spinner
BTo show a tooltip on hover
CTo provide accessible text for screen readers
DTo animate the spinner
✗ Incorrect
The visually-hidden class hides text visually but keeps it readable by screen readers.
Which attribute improves accessibility by indicating the spinner is a status message?
Atabindex='0'
Brole='button'
Caria-hidden='true'
Drole='status'
✗ Incorrect
The role='status' tells assistive tech that the spinner is a live status update.
How do you make a spinner larger in Bootstrap?
AAdd class <code>spinner-border</code> with custom CSS size
BAdd inline style <code>font-size</code>
CAdd class <code>spinner-lg</code>
DAdd class <code>spinner-border-sm</code>
✗ Incorrect
Bootstrap does not provide a built-in large spinner class, so you customize size with CSS on the spinner element.
Which spinner type grows and shrinks instead of rotating?
Aspinner-border
Bspinner-grow
Cspinner-pulse
Dspinner-fade
✗ Incorrect
The spinner-grow class creates a spinner that grows and shrinks.
Explain how to create an accessible spinner component in Bootstrap.
Think about both the visual spinner and how screen readers understand it.
You got /3 concepts.
Describe how you can customize the appearance of Bootstrap spinners.
Consider color, size, and spinner style.
You got /3 concepts.
Practice
(1/5)
1. What is the main purpose of Bootstrap spinner components?
easy
A. To show a loading or processing state visually
B. To create navigation menus
C. To style buttons with colors
D. To add images to the page
Solution
Step 1: Understand spinner usage
Spinners are used to indicate that something is loading or processing in the background.
Step 2: Identify spinner purpose in Bootstrap
Bootstrap spinner components visually show this loading state to users.
Final Answer:
To show a loading or processing state visually -> Option A
Quick Check:
Spinner = Loading indicator [OK]
Hint: Spinners always mean loading or waiting [OK]
Common Mistakes:
Thinking spinners are for decoration only
Confusing spinners with buttons
Using spinners for static images
2. Which of the following is the correct Bootstrap class to create a border spinner?
easy
A. spinner-grow
B. spinner-spin
C. spinner-border
D. spinner-circle
Solution
Step 1: Recall Bootstrap spinner classes
Bootstrap provides two main spinner classes: spinner-border and spinner-grow.
Step 2: Identify the border spinner class
The class spinner-border creates a spinner with a border style.
Final Answer:
spinner-border -> Option C
Quick Check:
Border spinner class = spinner-border [OK]
Hint: Border spinner always uses spinner-border class [OK]
Common Mistakes:
Using spinner-grow for border spinner
Typing class names incorrectly
Confusing spinner classes with button classes
3. What will be the visible result of this code snippet?
C. Missing role="status" attribute for accessibility
D. Span should have class visually-hidden for screen readers
Solution
Step 1: Check accessibility best practices for spinners
Bootstrap recommends adding a span with visually-hidden class inside spinners to provide accessible text for screen readers.
Step 2: Analyze given code
The span inside the spinner lacks the visually-hidden class, so the text is visible visually, which is not ideal.
Final Answer:
Span should have class visually-hidden for screen readers -> Option D
Quick Check:
Accessible text inside spinner needs visually-hidden class [OK]
Hint: Use visually-hidden class on spinner text for accessibility [OK]
Common Mistakes:
Omitting visually-hidden class
Using aria-label instead of role
Confusing aria-label with aria-labelledby
5. You want to create a spinner that grows in size and uses the Bootstrap danger color with accessible text. Which code snippet correctly achieves this?
hard
A.
Loading...
B.
Loading...
C.
Loading...
D.
Loading...
Solution
Step 1: Choose spinner-grow for growing animation
The question asks for a spinner that grows in size, so spinner-grow is the correct class.
Step 2: Apply danger color and accessibility
The text-danger class applies the red color. The role="status" and span with visually-hidden provide accessible loading text.
Step 3: Verify all requirements
Loading... uses spinner-grow, text-danger, role="status", and hidden accessible text correctly.
Final Answer:
<div class="spinner-grow text-danger" role="status"><span class="visually-hidden">Loading...</span></div> -> Option B
Quick Check:
Growing spinner + danger color + accessible text =