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
//! Declarative components to represent control-flow and other useful
//! constructs in the [`leptos`] web framework not directly
//! provided by default.
//!
//! This crate provides 2 main components
//!
//! - [`If`](if_::If)
//! - [`PortalInput`](portal::PortalInput)
//!
//! # Usage
//! For more usage examples, please refer to the respective
//! components' documentation, but here's a taste.
//!
//! ## If
//! ```rust
//! use leptos::*;
//! use leptos_declarative::prelude::*;
//!
//! # let _ = create_scope(create_runtime(), |cx| {
//! let (a, _) = create_signal(cx, true);
//! let (b, _) = create_signal(cx, false);
//!
//! view! { cx,
//! <If signal=a>
//! <Then>"A is true!"</Then>
//! <ElseIf signal=b>"B is true!"</ElseIf>
//! <Else>"Both A and B are false!"</Else>
//! </If>
//! };
//! # });
//! ```
//!
//! ## Portal
//! ```rust
//! use leptos::*;
//! use leptos_declarative::prelude::*;
//!
//! # let _ = create_scope(create_runtime(), |cx| {
//!
//! struct PortalId;
//!
//! view! { cx,
//! <PortalProvider>
//! <div>
//! <h1>"Portal goes here!"</h1>
//! <PortalOutput id=PortalId />
//! </div>
//!
//! <PortalInput id=PortalId>
//! <p>"I went through the portal!"</p>
//! </PortalInput>
//! </PortalProvider>
//! };
//! # });
//! ```
/// Convenient import of all components.