BooleanChart component renders an LED-style indicator that visualizes boolean states with customizable colors and labels. Perfect for status indicators and binary state displays.
Basic Usage
Props
The current state to display. Can be:
true- Shows ON state with green LEDfalse- Shows OFF state with dark LED"Sin datos"- Shows no data state with gray LED- Any other value is treated as having data
Label text to display when value is
true (ON state).Label text to display when value is
false (OFF state).Color for the LED in ON state. Accepts hex color codes. Used for the gradient and glow effect.
Color for the LED in OFF state. Accepts hex color codes.
Examples
Motor Status
Connection Status
No Data State
Custom Colors
Visual States
ON State (value = true)
LED Appearance:- Gradient: Radial gradient with three stops
- Center (offset 0):
#d1fae5(light green) - Mid (offset 0.4): Your
colorOn - Edge (offset 1):
#065f46(dark green)
- Center (offset 0):
- Glow: 35px shadow blur with
colorOn - Text color:
#065f46(dark green) - Text: Shows
textOnvalue
OFF State (value = false)
LED Appearance:- Gradient: Radial gradient
- Center (offset 0):
#9ca3af(light gray) - Edge (offset 1):
#1f2937(dark gray)
- Center (offset 0):
- Glow: 10px shadow blur, black
- Text color:
#374151(medium gray) - Text: Shows
textOffvalue
No Data State (value = “Sin datos”)
LED Appearance:- Gradient: Radial gradient
- Center (offset 0):
#e5e7eb(very light gray) - Edge (offset 1):
#6b7280(medium gray)
- Center (offset 0):
- Glow: 8px shadow blur
- Text color:
#6b7280(gray) - Text: “Sin datos”
LED Structure
The component is built with three layers:1. Main LED Circle (z-index: 3)
- Symbol: Circle
- Size: 110px diameter
- Position:
[0.5, 0.55](centered, slightly down) - Style: Radial gradient based on state
- Shadow: Dynamic based on state
2. Outer Ring (z-index: 2)
- Symbol: Circle
- Size: 130px diameter
- Position:
[0.5, 0.55] - Style: Transparent fill with dark border
- Border: 6px,
#1f2937 - Shadow: 15px blur,
rgba(0,0,0,0.6)
3. Status Text (z-index: 4)
- Type: Custom text element
- Position: 82% from top, centered horizontally
- Font size: 20px
- Font weight: 600 (semi-bold)
- Color: Dynamic based on state
Configuration Schema
The component has a validation schema (Zod) for configuration:Schema Requirements
Chart title (minimum 1 character).
ON state label (minimum 1 character).
OFF state label (minimum 1 character).
Hex color code for ON state. Must match pattern:
#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})Hex color code for OFF state. Must match pattern:
#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})Display order (minimum 1).
colorOnandcolorOffmust be different- All colors must be valid hex codes
Use Cases
- Equipment status: Motors, pumps, valves on/off
- Connection indicators: Network status, device connectivity
- Alarm states: Active/inactive alarms
- Process states: Running/stopped, enabled/disabled
- Binary sensors: Door open/closed, motion detected/clear
- System health: OK/error status
Accessibility
The component uses both color and text to convey state:- Clear text labels for each state
- High contrast between states
- Distinct visual styling (glow effects)
- No animation that could cause distraction
Container Requirements
The chart uses a coordinate system and works best in square containers:- Minimum size: 150x150px
- Optimal size: 200x200px to 300x300px
- Maintains aspect ratio automatically
See: BooleanChartSchema.js

