<meter> for values within a known range. The browser automatically shows colors based on the value and thresholds defined by low, high, and optimum attributes.
Basic Usage
Attributes
value (required)
The current measurement value:min and max
Define the range boundaries (defaults: min=0, max=1):low and high
Define threshold boundaries for the measurement:optimum
Defines the ideal value. The browser uses this to determine color:Color Logic
The meter automatically displays colors based on the value relative to thresholds:- Green (Optimum) - Value is in the optimal range
- Yellow (Suboptimal) - Value is acceptable but not ideal
- Red (Critical) - Value is in a critical range
Example: Storage Usage
Example: Performance Score
Styling
Meters include:- Full width by default
- Customizable height via
--bar-heightCSS variable - Rounded corners (pill shape)
- Automatic color coding (green, yellow, red)
- Muted background
Custom Height
Custom Width
Use Cases
- Disk usage - Show storage space used
- Battery level - Display charge remaining
- Temperature - Show current temperature in a range
- Performance metrics - Display scores or ratings
- Capacity - Show how full something is
Dynamic Updates
Update meter values with JavaScript:With Labels
Add labels for better context:Accessibility
The<meter> element is automatically accessible with:
- Proper ARIA role
- Screen reader announcements of value and range
- Semantic HTML meaning
For showing progress of ongoing operations, use the Progress component instead.