rpi_tui/spacer.rs
1//! Spacer component for adding empty space.
2
3use std::any::Any;
4
5use super::component::Component;
6
7/// Spacer component that adds empty vertical space.
8pub struct Spacer {
9 height: usize,
10}
11
12impl Spacer {
13 /// Create a new spacer with the given height in rows.
14 pub fn new(height: usize) -> Self {
15 Self { height }
16 }
17}
18
19impl Component for Spacer {
20 fn render(&self, _width: usize) -> Vec<String> {
21 (0..self.height).map(|_| String::new()).collect()
22 }
23
24 fn invalidate(&self) {
25 // Spacer has no cached state
26 }
27
28 fn as_any(&self) -> &dyn Any {
29 self
30 }
31}