Skip to main content

UserButton

Function UserButton 

Source
pub fn UserButton(_: UserButtonProps) -> Element
Expand description

Mounted Clerk user button UI.

§Example

use dioxus::prelude::*;
use dioxus_clerk::*;

#[component]
fn HeaderAccountMenu() -> Element {
    rsx! {
        SignedIn {
            UserButton { class: "inline-flex" }
        }
    }
}

§Props

For details, see the props struct definition.

  • after_sign_out_url : Option<String>

    URL Clerk should use after sign-out.

  • after_switch_session_url : Option<String>

    URL Clerk should use after switching sessions in a multi-session app.

  • sign_in_url : Option<String>

    URL Clerk should use when adding another account.

  • show_name : Option<bool>

    Show the user’s name next to the avatar when Clerk supports it.

  • default_open : Option<bool>

    Whether the user button menu should open by default on first render.

  • user_profile_mode : Option<UserProfileMode>

    How the user button opens the user profile UI.

  • user_profile_url : Option<String>

    User profile URL for navigation mode.

  • user_profile_props : Option<serde_json::Value>

    Raw options forwarded to the underlying UserProfile component.

  • appearance : Option<serde_json::Value>

    Raw Clerk appearance object.

  • options : UserButtonOptions

    Advanced options forwarded to Clerk, as a UserButtonOptions builder or a raw serde_json::Value. Explicit props win when both set the same Clerk option key.

  • id : Option<String>

    Optional id for the Clerk widget host <div> that clerk-js mounts into. May also be set through the attribute spread; this prop wins when both are present.

  • attributes : Vec<Attribute>

    Attributes (including class) spread onto the Clerk widget host <div>.

  • fallback : Element

    Rendered while the Clerk user button widget is mounting.