@gfazioli/mantine-led
A highly customizable LED indicator component for React applications built with Mantine. Provides visual feedback for status indicators with support for colors, sizes, animations, and controlled states.
Installation
After installation import package styles at the root of your application:
You can import styles within a layer @layer mantine-led by importing @gfazioli/mantine-led/styles.layer.css file.
Usage
Explore all available props and see the component in action:
Controlled
The Led component is fully controlled through the value prop. Here's an example of controlling the LED state:
Variants
The Led component supports four visual variants: flat (default), 3d (realistic with depth and specular highlight), neon (glowing neon sign style), and dot (ultra-minimal):
flat
3d
neon
dot
Colors
The Led component supports all Mantine theme colors. Use the color prop to set the LED color:
Off Color
Use the offColor prop to customize the LED appearance when turned off. By default, the off state uses a dimmed version of the main color.
Off (red)
On (green)
Off 3D (gray)
On 3D (blue)
Gradient
Use the gradient prop to apply a linear gradient to the LED when on. Accepts a MantineGradient object with from, to, and optional deg properties:
Fire
Ice
3D Gradient
Neon Gradient
Shapes
The shape prop controls the LED form factor. Available shapes are circle (default), square, and rectangle:
Circle
Square
Rectangle
Circle 3D
Square 3D
Rectangle 3D
Animations
Add visual feedback with built-in animations. The component supports multiple animation types:
- pulse: Smooth pulsing effect
- flash: Quick flashing
- breathe: Slow breathing effect
- blink: Regular blinking
- glow: Glowing effect with increased intensity
Pulse
Flash
Breathe
Blink
Glow
Animation Count
Use the animationCount prop to limit the number of animation iterations. By default, animations loop infinitely. When a count is set, the animation stops after the specified number of cycles:
3 flashes
5 pulses
Infinite
Interactive
Provide an onChange callback to make the LED clickable and toggleable. The LED becomes keyboard-accessible with role="switch" and responds to click, Enter, and Space:
Click the LEDs to toggle them
Tooltip
Use the tooltip prop to display a tooltip on hover. This is useful for compact dashboards where LEDs are small and need contextual information. Use tooltipProps to customize the underlying Mantine Tooltip component — you can control position, withArrow, color, multiline, and any other Tooltip prop:
With tooltipProps
Labels
Add descriptive labels to your LED indicators with full customization support:
The label prop accepts any React node, allowing you to use custom components like badges, icons, or formatted text. Use labelPosition to control whether the label appears on the left or right side of the LED.
Led.Group
Use Led.Group to render multiple LEDs with shared props. Pass value as a number to activate the first N LEDs, or as a boolean array for individual control:
Signal strength: 3/5
Color Scale
Use colorScale to map different colors progressively across LEDs — perfect for VU meters and level indicators:
VU Meter: 7/10
Cascade Animation
Use animationDelay on Led.Group to create staggered cascade effects. Each LED starts its animation with a progressive delay:
Cascade animation (staggered delay)
Led.Matrix
Use Led.Matrix to render a 2D grid of LEDs. Pass a boolean[][] array to control individual LED states:
Heart (dot)
Heart (flat)
4x4 all on
Led.SevenSegment
Use Led.SevenSegment to display numbers and characters using a classic seven-segment display. Supports digits 0-9, hex characters A-F, and special characters like :, ., -:
Number
Clock
Text
Live Clock
A real-time clock using Led.SevenSegment with hours, minutes, and seconds:
Live clock
Styles API
Led supports Styles API, you can add styles to any inner element of the component with classNames prop. Follow Styles API documentation to learn more.
Component Styles API
Hover over selectors to highlight corresponding elements
Accessibility
The Led component follows WAI-ARIA best practices:
- Non-interactive LEDs use
role="status"with optionalaria-labelfrom string labels - Interactive LEDs (with
onChange) userole="switch"witharia-checkedand keyboard support (Enter, Space) - Use the
descriptionprop to addaria-descriptionfor screen readers - Animations are automatically disabled when the user has
prefers-reduced-motion: reduceenabled
Use Cases
System Status Panel
Monitor multiple system components with organized LED indicators:
System Status Panel
Network
Services
Resources
Security
DEFCON Alert System
A fun example showing how to build a DEFCON (Defense Readiness Condition) alert system with animated LEDs:
Defense Readiness Condition
DEFCON 5
Normal readiness
DEFCON 4
Increased intelligence watch
DEFCON 3
Increase in force readiness
DEFCON 2
Further increase in force readiness
DEFCON 1
Maximum force readiness
Traffic Light
An automatic traffic light that cycles through red, yellow, and green with realistic timing. Demonstrates offColor, variant="3d", animate, and tooltip:
red
Password Strength Meter
A real-time password strength indicator using Led.Group with colorScale and shape="rectangle":
Enter a password