Progress Bar
React.js
easy
15 mins
Create a Progress Bar Component in React that visually represents a single progress value. Users should be able to increment or decrement progress using buttons. Make sure to use inline css.
Requirements
- Display one progress bar.
- The bar should reflect a numeric progress (0β100%).
- Include buttons labeled '+10%' and '-10%' to increase or decrease the barβs value.
- Prevent values from going below 0% or above 100%.
- Change bar color based on value (e.g., red, orange, green).
- Color is selected based on thresholds:
- Red if less than 40%
- Orange if between 40β79%
- Green if 80% or more
Constraints & Edge Cases
- Constraint 1: Progress must stay between 0 and 100.
- Constraint 2: The background color-changing div must have an id="testBgColor" for testing the background color of progress bar.
- Edge Case 1: If decrementing would take a value below 0, clamp it to 0.
- Edge Case 2: If incrementing would take a value above 100, clamp it to 100.
Reference UI

Preview what you need to build
Companies:
netflix
twitch
oyo
Solve Similar questions π₯
Want to upskill? Explore our courses!
Namaste DSA
Master DSA from scratch with numerous problems, and expert guidance.
Namaste React
Wanna dive deep into React and become Frontend Expert? Learn with me now!
Namaste Frontend System Design
The most comprehensive and detailed course for frontend system design.
Namaste Node.js
Wanna dive deep into Node.js? Enroll into `Namaste Node.js` now!
