Overview
TheSeverityBadge component displays ESLint rule severity levels with appropriate icons and colors. Built on top of the Badge component with predefined configurations for each severity level.
Import
Basic Usage
Severity Levels
The component supports four severity levels:- Error
- Warn
- Suggestion
- Off
Props
'error' | 'warn' | 'suggestion' | 'off'
required
The severity level to display.
string
Additional CSS classes to apply.
Severity Configuration
Each severity level has a predefined configuration:Design Details
- Always uses the
smsize variant from Badge - Icon is hidden from screen readers with
aria-hidden="true" - Label text is accessible to screen readers
- Each severity has a distinct icon and color for quick recognition
Examples
In a Rule List
With Custom Styling
All Severities
Type Exports
The component also exports theSeverity type for use in TypeScript:
Component Definition
Location:packages/gadget-ui/src/components/severity-badge.tsx:17