<SignedOut />
The SignedOut component conditionally renders its children only when the user is not authenticated with Asgardeo.
It checks the current authentication state and displays content for unauthenticated users, while rendering optional fallback content (or nothing by default) when the user is authenticated.
This makes it ideal for showing sign-in prompts, public landing pages, or content that should only be visible to guests.
Usage
You can use the SignedOut component to wrap any content that should only be visible to unauthenticated users.
Basic Usage
Use SignedOut to show content only when not signed in.
src/App.jsx
import { SignedOut, SignInButton } from '@asgardeo/react'
function App() {
return (
<SignedOut>
<div>
<h1>Welcome!</h1>
<SignInButton />
</div>
</SignedOut>
)
}
export default App
note
If the user is signed in, nothing will be rendered unless you provide a fallback prop.
With Fallback
Show alternative content when the user is signed in:
src/App.jsx
import { SignedOut } from '@asgardeo/react'
function App() {
return (
<SignedOut fallback={<p>You are already signed in</p>}>
<div>
<h1>Welcome!</h1>
<p>Please sign in to continue</p>
</div>
</SignedOut>
)
}
export default App
Props
| Prop | Type | Required | Description |
|---|---|---|---|
children | ReactNode | ✅ | Content to render when the user is signed out |
fallback | ReactNode | ❌ | Content to render when signed in |