easy12 min
Build a Character Counter
Build a textarea with a live character counter that shows how many characters have been typed and how many remain before reaching a maximum limit. The counter should change color when approaching or exceeding the limit.
Skills
useStatecontrolled inputsderived state
Tests
- Renders with empty textarea and "0 / 150" count
- Updates character count as user types
- Shows warning color when near the limit
- Shows error color when over the limit
Loading editor...