1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
//! Maud UI components — fields, inputs, tables, shells, and HTMX helpers.
//!
//! # Component model
//!
//! Lariv UI is built with [`maud`] markup returned from functions and structs in
//! [`crate::components`]. There is no runtime component tree — parents pass `Markup` slots
//! to layout helpers at compile time.
//!
//! # Categories
//!
//! | Module | Examples |
//! |--------|----------|
//! | **Shells** | [`ShellScaffold`](crate::components::ShellScaffold), [`ShellTopbar`](crate::components::ShellTopbar) — page chrome |
//! | **Layout** | `container_row`, `container_column`, cards, sidebars |
//! | **Fields** | `field_text`, `field_title`, `field_markdown` — read-only display |
//! | **Inputs** | `input_text`, `input_select`, `input_foreign_key` — editable form controls |
//! | **Forms** | `form()` — wrap inputs with action URL and HTMX attrs |
//! | **Tables** | [`data_table_list`](crate::components::data_table_list) — sortable, paginated grids |
//! | **Buttons** | `button_submit`, `button_link`, `button_modal`, `button_post` |
//! | **HTMX** | [`form_hx_post_route`](crate::components::form_hx_post_route), [`hx_nav_app_layout`](crate::components::hx_nav_app_layout) |
//!
//! # Example: form with inputs
//!
//! ```ignore
//! use maud::html;
//! use lariv_rs::components::{form, input_text, field_text, FormOpts};
//!
//! fn edit_form(name: &str) -> maud::Markup {
//! form(FormOpts {
//! action: "/items/create",
//! title: "Create item",
//! ..Default::default()
//! }, html! {
//! (input_text("name", name, "Name"))
//! })
//! }
//! ```
//!
//! # Example: data table
//!
//! ```ignore
//! use lariv_rs::components::{data_table_list, TableColumnHeader, TableRow};
//!
//! data_table_list::<MyTableKey>(
//! "Items",
//! actions,
//! &[
//! TableColumnHeader {
//! key: "Name",
//! label: "Name",
//! sort_url: Some(&name_sort),
//! push_url: true,
//! },
//! TableColumnHeader {
//! key: "CreatedAt",
//! label: "Created",
//! sort_url: None,
//! push_url: true,
//! },
//! ],
//! &rows,
//! pagination,
//! )
//! ```
//!
//! # Swap keys
//!
//! HTMX target regions use typed [`SwapKey`](crate::components::SwapKey) markers declared with
//! [`swap_key!`](crate::swap_key). Prefer `form_hx_post`, `data_table_list::<K>`, and
//! `hx_target` over raw `hx-target` strings.
//!
//! # Forms with validation
//!
//! For POST handling, pair UI inputs with [`html_form`](crate::html_form) derive macros on
//! the server — see [`HtmlForm`](crate::html_form::HtmlForm) and layer create/update flows.