Skip to content

Commit 67779fc

Browse files
committed
docs: add FAQ to crate-level docs
1 parent b2dbbad commit 67779fc

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

crates/egui/src/lib.rs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -315,6 +315,20 @@
315315
//!
316316
//! See [`Context::request_discard`] and [`Options::max_passes`] for more.
317317
//!
318+
//! ## FAQ
319+
//!
320+
//! **How do I store state between frames?**
321+
//! Keep your own `struct` with the values you mutate (e.g. selected enum variants, slider numbers) and update it inside `App::update`. egui only borrows your data temporarily each frame - it never stores it for you.
322+
//!
323+
//! **Why does my layout jitter the first frame?**
324+
//! Some widgets (e.g. [`Grid`]) need a frame of measurements before they can allocate perfectly. Call [`Context::request_discard`] or keep the widget alive so the second frame reuses the cached layout.
325+
//!
326+
//! **How do I make widgets span the full width?**
327+
//! Use helpers like [`Ui::vertical_centered_justified`] or wrap content with [`Ui::with_layout`] and [`Layout::top_down`]/[`Layout::left_to_right`] to control justification explicitly.
328+
//!
329+
//! **Where can I see more complete examples?**
330+
//! The live demo at <https://www.egui.rs/#demo> mirrors the code in `crates/egui_demo_app` and `crates/egui_demo_lib`. Each window links back to the relevant source so you can inspect a working reference implementation.
331+
//!
318332
//! # Misc
319333
//!
320334
//! ## How widgets works

0 commit comments

Comments
 (0)