From 740e2cc5bfbf0e3b7b3796f70657dec28445727e Mon Sep 17 00:00:00 2001 From: Nate Butler Date: Fri, 3 Nov 2023 16:28:54 -0400 Subject: [PATCH] Start on ui root doc Co-Authored-By: Marshall Bowers <1486634+maxdeviant@users.noreply.github.com> --- crates/ui2/src/lib.rs | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/crates/ui2/src/lib.rs b/crates/ui2/src/lib.rs index 5d0a57c6d9..fb25d21bf0 100644 --- a/crates/ui2/src/lib.rs +++ b/crates/ui2/src/lib.rs @@ -9,6 +9,37 @@ //! //! Expect some inconsistencies from component to component as we work out the best way to build these components. //! +//! ## Getting Started +//! +//! This is a quick primer to get you started using the UI components. +//! +//! You shouldn't need to construct an element from scratch very often. If you find +//! yourself manually styling things like hover, text colors, etc, you should +//! probably check that there isn't already a base component for whatever you are building. +//! +//! Here is an into to some of the most common elements: +//! +//! ### Text +//! +//! For generic UI text most frequently you will use a [`Label`] component. +//! +//! ```rust +//! use ui2::prelude::*; +//! use ui2::{Label, LabelColor}; +//! +//! pub fn render_some_ui_text() -> impl Component { +//! div().p_2().child( +//! Label::new("Hello World") +//! .color(LabelColor::Muted) +//! ) +//! } +//! ``` +//! +//! ### Interactive Elements +//! +//! - Icon: To make an icon interactive, use [`IconButton`]. +//! - Button: To make a button interactive, use [`Button`]. +//! //! ## Design Philosophy //! //! Work in Progress!