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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
use *;
use component_doc;
use inject_style;
use ;
use content_with_aside_styles;
/// Two-column layout for documentation-style pages: growing content + sticky aside.
///
/// Place [`ContentWithAside`] inside [`LayoutMain`](crate::LayoutMain) when the main region needs a primary reading column and a secondary rail (table of contents, metadata, or related links). The content column grows; the aside minimally fits and stays sticky on wide viewports (typically when the viewport is wide enough for the two-column grid — the aside stops being sticky on narrow breakpoints).
///
/// # When to use
///
/// - Long documentation or design-language pages with an in-page anchor rail - Settings or guide pages where secondary navigation sits beside prose - Any main content area that pairs scrollable copy with a compact right column
///
/// # Usage
///
/// 1. Nest inside [`Layout`](crate::Layout) → [`LayoutMain`](crate::LayoutMain). 2. Put the page title, lead copy, and body sections in [`Content`]. 3. Put the table of contents or utility rail in [`Aside`] — often an [`Anchor`](crate::Anchor). 4. Slot source order does not matter; CSS places content left and aside right.
///
/// # Best Practices
///
/// ## Do's
///
/// * Keep the hero (title + lead) inside [`Content`] so the aside top-aligns with the page title * Use [`Anchor`](crate::Anchor) + [`AnchorLink`](crate::AnchorLink) in the aside for in-page navigation * Reserve the aside for short labels — long copy belongs in the content column
///
/// ## Don'ts
///
/// * Do not place full-width chrome above [`ContentWithAside`] if the aside should align with the title * Do not use the aside for primary page actions — keep CTAs in the content column
///
/// # Examples
///
/// ## Basic content and aside
/// Two-column layout with filled Material regions labeling each column.
/// <!-- default -->
/// <!-- preview -->
/// ```rust
/// use crate::{Aside, Content, ContentWithAside, Material, MaterialElevation, MaterialVariant};
/// view! {
/// <div data-testid="content-with-aside-preview" style="width: 100%;">
/// <ContentWithAside>
/// <Content slot>
/// <Material variant=MaterialVariant::Solid elevation=MaterialElevation::Resting>
/// <div style="background: var(--orb-color-surface-subtle); min-height: 120px; display: flex; align-items: center; justify-content: center;">
/// "Content"
/// </div>
/// </Material>
/// </Content>
/// <Aside slot>
/// <Material variant=MaterialVariant::Solid elevation=MaterialElevation::Resting>
/// <div style="background: var(--orb-color-surface-overlay); min-height: 72px; display: flex; align-items: center; justify-content: center;">
/// "Aside"
/// </div>
/// </Material>
/// </Aside>
/// </ContentWithAside>
/// </div>
/// }
/// ```
///
/// ## Sticky aside while scrolling
/// Tall content with a bounded scrollport; the aside stays sticky and carries a typical doc-page anchor rail.
/// <!-- preview -->
/// ```rust
/// use crate::{Anchor, AnchorLink, Aside, Content, ContentWithAside, SectionTitle};
/// view! {
/// <div data-testid="content-with-aside-sticky" style="height: 240px; overflow: auto; width: 100%; max-width: 560px;">
/// <ContentWithAside>
/// <Content slot>
/// <h3 id="top">"Top"</h3>
/// <p style="height: 200px">"Scrollable section."</p>
/// <h3 id="bottom">"Bottom"</h3>
/// <p style="height: 120px">"More content."</p>
/// </Content>
/// <Aside slot>
/// <SectionTitle>"On this page"</SectionTitle>
/// <Anchor>
/// <AnchorLink title="Top".to_string() href="#top" />
/// <AnchorLink title="Bottom".to_string() href="#bottom" />
/// </Anchor>
/// </Aside>
/// </ContentWithAside>
/// </div>
/// }
/// ```