dioxus_clerk/components/create_organization.rs
1use crate::options::CreateOrganizationOptions;
2use crate::options::Routing;
3use dioxus::prelude::*;
4
5/// Mounted Clerk create-organization UI.
6///
7/// # Example
8///
9/// ```no_run
10/// use dioxus::prelude::*;
11/// use dioxus_clerk::*;
12///
13/// #[component]
14/// fn NewOrganizationPage() -> Element {
15/// rsx! {
16/// CreateOrganization { routing: Routing::Path, path: "/organizations/new" }
17/// }
18/// }
19/// ```
20#[component]
21pub fn CreateOrganization(
22 /// Embedded routing mode.
23 #[props(into)]
24 routing: Option<Routing>,
25 /// Path used by embedded routing.
26 #[props(into)]
27 path: Option<String>,
28 /// URL Clerk should use after creating an organization.
29 #[props(into)]
30 after_create_organization_url: Option<String>,
31 /// Raw Clerk appearance object.
32 appearance: Option<serde_json::Value>,
33 /// Advanced options forwarded to Clerk, as a
34 /// [`CreateOrganizationOptions`](crate::CreateOrganizationOptions) builder
35 /// or a raw `serde_json::Value`. Explicit props win when both set the same
36 /// Clerk option key.
37 #[props(default = CreateOrganizationOptions::from_value(serde_json::Value::Null), into)]
38 options: CreateOrganizationOptions,
39 /// Optional id for the Clerk widget host `<div>` that clerk-js mounts
40 /// into. May also be set through the attribute spread; this prop wins
41 /// when both are present.
42 #[props(into)]
43 id: Option<String>,
44 /// Attributes (including `class`) spread onto the Clerk widget host
45 /// `<div>`.
46 #[props(extends = GlobalAttributes)]
47 attributes: Vec<Attribute>,
48 /// Rendered while the Clerk create-organization widget is mounting.
49 #[props(default = rsx! {})]
50 fallback: Element,
51) -> Element {
52 let options = options
53 .maybe_routing(routing)
54 .maybe_path(path)
55 .maybe_after_create_organization_url(after_create_organization_url)
56 .maybe_appearance(appearance)
57 .into_value();
58
59 super::widget::render(
60 super::widget::Widget::CreateOrganization,
61 super::widget::WidgetProps::new(options, fallback, id, attributes),
62 )
63}