Expand description
Inline validation error display widget. Inline validation error display widget.
Displays validation errors near form fields with:
- Configurable error styling (default: red text with icon)
- Smooth appearance animation via opacity interpolation
- Screen reader accessibility (ARIA error association via semantic info)
§Example
ⓘ
use ftui_widgets::{ValidationErrorDisplay, ValidationErrorState};
// Simple inline error
let error = ValidationErrorDisplay::new("This field is required");
let mut state = ValidationErrorState::default();
error.render(area, &mut frame, &mut state);
// With custom styling
let error = ValidationErrorDisplay::new("Invalid email address")
.with_icon("!")
.with_style(Style::new().fg(PackedRgba::rgb(255, 100, 100)));§Invariants (Alien Artifact)
- Icon presence: Icon is always rendered when error is visible
- Animation bounds: Opacity is clamped to [0.0, 1.0]
- Width calculation: Total width = icon_width + 1 + message_width
- Accessibility: When rendered, screen readers can announce error text
§Failure Modes
| Scenario | Behavior |
|---|---|
| Empty message | Renders icon only |
| Zero-width area | No-op, state unchanged |
| Very narrow area | Truncates message with ellipsis |
| Animation overflow | Saturates at 0.0 or 1.0 |
Structs§
- Validation
Error Display - A widget for displaying inline validation errors.
- Validation
Error State - State for validation error animation and accessibility.
Constants§
- ANIMATION_
DURATION_ MS - Default animation duration.
- ERROR_
BG_ DEFAULT - Default error background color (dark red).
- ERROR_
FG_ DEFAULT - Default error foreground color (red).
- ERROR_
ICON_ DEFAULT - Default error icon.