Skip to content

feat(examples): add full customization demo to the shadcn example - #1539

Open
demolaf wants to merge 7 commits into
mainfrom
feat/shadcn-customization-demo
Open

demolaf wants to merge 7 commits into
mainfrom
feat/shadcn-customization-demo

Conversation

@demolaf

@demolaf demolaf commented Nov 12, 2026 •

Copy link
Copy Markdown
Member

Adds the full customization demo to the shadcn example, the shadcn/ui counterpart of the React demo. The screens and auth logic carry over unchanged, the UI is built from this example's shadcn/ui components, and each Figma theme becomes a set of shadcn theme variables.

Changes

  • New /full-customization route with the same flows as the React demo: email entry, login, sign up, phone, MFA challenge and enrollment, reauthentication and an account page.
  • Built on shadcn Button, Input, Card, Select, InputOTP and a new Dialog. Each theme sets --primary, --secondary, --radius and the rest, plus a few extras shadcn has no token for, such as hard offset shadows.
  • The theme is set on <body> so the portalled dialog and country menu are themed too. The route is lazy loaded and hides the global toggles.
  • Adds the Professional theme from the Android and iOS demos with its own layout: providers first, flat left-aligned screens, a settings-style account page, and dark mode that follows the example's light/dark toggle.
  • The React demo gains the Professional theme too, built on native elements. Both demos share one reauth flow between the dialog styles, and a pending MFA challenge now survives a theme switch.
  • Also fixes two React demo bugs: a gap above the phone field on narrow screens, and the reauth dialog sitting in the top corner instead of centred.

Preview

  • Theme switching
fc-shadcn-themes.mp4
  • Email sign in (Doggo)
fc-shadcn-email-sign-in.mp4
  • Phone sign in (Coffee Spark)
fc-shadcn-phone-sign-in.mp4
  • Two-factor enrollment and challenge (Grid)
fc-shadcn-two-factor.mp4
  • Professional theme: sign in, two-factor setup and challenge
fc-shadcn-professional.mp4
  • Professional theme in dark mode
fc-shadcn-professional-dark.mp4
  • React demo, Professional theme: sign in, two-factor setup and challenge
fc-react-professional.mp4
  • React demo, Professional theme in dark mode
fc-react-professional-dark.mp4

Maintainer note: Fixes internal CPRN-661

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a comprehensive 'Full Customization Demo' to the shadcn example, featuring a complete authentication flow with three switchable themes (Doggo, Coffee Spark, and Grid). The implementation includes custom components, step-by-step forms for login, sign-up, phone authentication, and multi-factor authentication (MFA) enrollment, as well as lazy loading with error boundaries. The code review identified several improvement opportunities: adding an ESLint disable comment for a deliberate empty dependency array in useEffect, addressing potential runtime crashes in reauth.tsx by replacing non-null assertions with defensive null checks, and refactoring the initialization of state with the useDefaultCountry hook to avoid executing it on every render.

@demolaf
demolaf marked this pull request as draft November 12, 2026 13:28
…the Professional theme

The resolver cleanup now lives on a stable host, so switching theme mid-challenge no longer cancels the sign in, and the reauth hooks move to a shared module to break an import cycle. Also shows email link errors on the link screen, uses a solid focus ring, native radios for factor choice, a described and highlighted password mismatch, the example's dark mode toggle, and a confirm step before removing a factor.
… demo

Ports the Professional theme from the shadcn demo with native elements and Material Symbols icons, moves reauth into a shared module so both dialog styles use one flow, keeps the MFA challenge across theme switches, and centres the themed reauth dialog.
@demolaf
demolaf marked this pull request as ready for review November 18, 2026 12:41

@russellwheatley russellwheatley left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few small things below, mainly the theme count copy.

Comment thread examples/shadcn/src/App.tsx Outdated
<ItemContent>
<ItemTitle>Full Customization Demo</ItemTitle>
<ItemDescription className="text-xs">
A complete sign in flow built from this example's shadcn/ui components, with three switchable themes.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This says three themes, but with Professional there are four now. Same text in examples/react/src/App.tsx too.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated to four in both examples.

// The full customization demo draws its own chrome, so the example-wide toggles stay out of its way.
function GlobalToggles() {
const { pathname } = useLocation();
if (pathname.startsWith("/full-customization")) return null;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Professional follows the light/dark toggle, but the toggle is hidden on this route, so you have to go back to the example list to try dark mode. Might be worth keeping just the light/dark toggle here, or adding it to the theme switcher?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added a light/dark toggle to the theme switcher while Professional is active, since it's the only theme that uses it.

class ChunkErrorBoundary extends Component<{ children: ReactNode }, { failed: boolean }> {
state = { failed: false };

static getDerivedStateFromError() {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This catches every render error in the demo, not only a failed chunk, so a runtime bug would show up as "failed to load". Fine for an example, maybe just reword to "Something went wrong" or log the error.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reworded to "Something went wrong" and it now logs the error.

…idy the demo copy

The example's light/dark toggle is hidden on the demo route, so the theme switcher gets its own while Professional is active, fitted to phone widths. Also counts four themes on the example list and has the demo error boundary log the error and say something went wrong rather than blaming a failed load.

@russellwheatley russellwheatley left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants