Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .changeset/account-button-controller.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
---
---
12 changes: 7 additions & 5 deletions packages/swingset/src/stories/account-button.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@ exposes **Add organization**, **Add account**, and **Sign out of all accounts**.

It is the styled Mosaic component composed from the headless `@clerk/headless` popover primitive plus
slot recipes, and inherits the primitive's open/close behavior, focus management, and ARIA wiring. This
first pass is presentational: the parts render from the props on `AccountButtonRoot` (mock data in the
examples). A `useAccountButtonController()` that reads live Clerk resources is a drop-in follow-up.
`AccountButtonView` is presentational: the parts render from the props on `AccountButtonRoot` (mock data
in the examples). The connected `AccountButton` wraps it with `useAccountButtonController()`, which reads
live Clerk resources and needs no props.

## Example

Expand All @@ -22,12 +23,13 @@ examples). A `useAccountButtonController()` that reads live Clerk resources is a

## Usage

The all-in-one `AccountButton` renders the trigger and popup from a single prop-driven call:
The all-in-one, presentational `AccountButtonView` renders the trigger and popup from a single
prop-driven call (the connected, Clerk-backed `AccountButton` wraps it and needs no props):

```tsx
import { AccountButton } from '@clerk/ui/mosaic/account/account-button.view';
import { AccountButtonView } from '@clerk/ui/mosaic/account/account-button.view';

<AccountButton
<AccountButtonView
status='ready'
activeAccount={{ sessionId: 'sess_1', userId: 'user_1', name: 'Preston Booth', email: 'preston@clerk.dev' }}
activeOrganizationId='org_clerk_app'
Expand Down
8 changes: 4 additions & 4 deletions packages/swingset/src/stories/account-button.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/** @jsxImportSource @emotion/react */
import { AccountButton, type AccountButtonProps } from '@clerk/ui/mosaic/account/account-button.view';
import { type AccountButtonProps, AccountButtonView } from '@clerk/ui/mosaic/account/account-button.view';

import type { StoryMeta } from '@/lib/types';

Expand Down Expand Up @@ -35,7 +35,7 @@ const preston = { sessionId: 'sess_1', userId: 'user_1', name: 'Preston Booth',

export function Default(_args: Record<string, unknown>) {
return (
<AccountButton
<AccountButtonView
{...handlers}
status='ready'
activeAccount={preston}
Expand Down Expand Up @@ -63,7 +63,7 @@ export function Default(_args: Record<string, unknown>) {

export function Personal(_args: Record<string, unknown>) {
return (
<AccountButton
<AccountButtonView
{...handlers}
status='ready'
activeAccount={{
Expand All @@ -86,7 +86,7 @@ export function Personal(_args: Record<string, unknown>) {

export function MultipleAccounts(_args: Record<string, unknown>) {
return (
<AccountButton
<AccountButtonView
{...handlers}
status='ready'
activeAccount={preston}
Expand Down
Loading
Loading