Ingredient trait for a struct, and the Pantry renders it in the preview pane with navigation, description, and prop documentation.
The Ingredient trait
Four methods are required:
Optional methods with defaults:
Basic ingredient
A static ingredient is a unit struct with mock data:Interactive ingredient
Setinteractive() to true to receive keyboard and mouse input when the preview pane has focus. Press Enter in the sidebar to focus an interactive ingredient. Press Esc to return.
true from handle_key() or handle_mouse() to consume the event, false to let the Pantry handle it.
Tab assignment
Overridetab() to place ingredients in a different tab:
Feature gating
Gate ingredient modules behind#[cfg(feature = "tui-pantry")] so they don’t compile into production:
Registration
Declare your ingredient modules inpantry.toml:
my_crate::widgets::gauge::ingredient::ingredients() via the pantry_ingredients!() proc macro. The entry point uses this automatically:
[ingredients] section in pantry.toml, pass the factory directly: