Skip to content

An open source design system that's fully customizable and agent ready

TypeScript

refactor(template): clean up login, login-card, login-split for XDS purity (#1481)

rubyycheung0924b8b3536e
diff --git a/apps/sandbox/public/templates/colorful-home-vertical-3.png b/apps/sandbox/public/templates/colorful-home-vertical-3.png
new file mode 100644
index 0000000000..43eaedf07a
Binary files /dev/null and b/apps/sandbox/public/templates/colorful-home-vertical-3.png differ
diff --git a/packages/cli/templates/pages/login-card/page.tsx b/packages/cli/templates/pages/login-card/page.tsx
index a60d3e6925..8a60831ef9 100644
--- a/packages/cli/templates/pages/login-card/page.tsx
+++ b/packages/cli/templates/pages/login-card/page.tsx
@@ -2,88 +2,47 @@
import {useState} from 'react';
import * as stylex from '@stylexjs/stylex';
-import {XDSVStack, XDSHStack} from '@xds/core/Layout';
+import {CubeIcon} from '@heroicons/react/24/outline';
+import {XDSVStack} from '@xds/core/Layout';
+import {XDSCenter} from '@xds/core/Center';
import {XDSText, XDSHeading} from '@xds/core/Text';
import {XDSTextInput} from '@xds/core/TextInput';
import {XDSButton} from '@xds/core/Button';
import {XDSCard} from '@xds/core/Card';
import {XDSLink} from '@xds/core/Link';
import {XDSDivider} from '@xds/core/Divider';
+import {XDSIcon} from '@xds/core/Icon';
import {colorVars, spacingVars} from '@xds/core/theme/tokens.stylex';
-const LogoIcon = (props: React.SVGProps<SVGSVGElement>) => (
- <svg
- viewBox="0 0 24 24"
- fill="currentColor"
- width={24}
- height={24}
- {...props}>
- <rect x="3" y="3" width="18" height="18" rx="4" fill="currentColor" />
- <rect x="7" y="7" width="10" height="3" rx="1" fill="white" />
- <rect x="7" y="12" width="6" height="3" rx="1" fill="white" />
- </svg>
-);
+// Brand icons — no heroicons equivalent
const AppleIcon = (props: React.SVGProps<SVGSVGElement>) => (
- <svg
- viewBox="0 0 24 24"
- fill="currentColor"
- width={16}
- height={16}
- {...props}>
+ <svg viewBox="0 0 24 24" fill="currentColor" width={16} height={16} {...props}>
<path d="M17.05 20.28c-.98.95-2.05.88-3.08.4-1.09-.5-2.08-.48-3.24 0-1.44.62-2.2.44-3.06-.4C2.79 15.25 3.51 7.59 9.05 7.31c1.35.07 2.29.74 3.08.8 1.18-.24 2.31-.93 3.57-.84 1.51.12 2.65.72 3.4 1.8-3.12 1.87-2.38 5.98.48 7.13-.57 1.5-1.31 2.99-2.54 4.09zM12.03 7.25c-.15-2.23 1.66-4.07 3.74-4.25.29 2.58-2.34 4.5-3.74 4.25z" />
</svg>
);
const GoogleIcon = (props: React.SVGProps<SVGSVGElement>) => (
- <svg
- viewBox="0 0 24 24"
- fill="currentColor"
- width={16}
- height={16}
- {...props}>
- <path
- d="M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92a5.06 5.06 0 01-2.2 3.32v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.1z"
- fill="#4285F4"
- />
- <path
- d="M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23z"
- fill="#34A853"
- />
- <path
- d="M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.07H2.18C1.43 8.55 1 10.22 1 12s.43 3.45 1.18 4.93l2.85-2.22.81-.62z"
- fill="#FBBC05"
- />
- <path
- d="M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.07l3.66 2.84c.87-2.6 3.3-4.53 6.16-4.53z"
- fill="#EA4335"
- />
+ <svg viewBox="0 0 24 24" fill="currentColor" width={16} height={16} {...props}>
+ <path d="M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92a5.06 5.06 0 01-2.2 3.32v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.1z" fill="#4285F4" />
+ <path d="M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23z" fill="#34A853" />
+ <path d="M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.07H2.18C1.43 8.55 1 10.22 1 12s.43 3.45 1.18 4.93l2.85-2.22.81-.62z" fill="#FBBC05" />
+ <path d="M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.07l3.66 2.84c.87-2.6 3.3-4.53 6.16-4.53z" fill="#EA4335" />
</svg>
);
const styles = stylex.create({
- pageBg: {
+ page: {
+ minHeight: '100dvh',
+ padding: spacingVars['--spacing-6'],
backgroundColor: colorVars['--color-background-body'],
},
fullWidth: {
width: '100%',
},
- dividerRow: {
- display: 'flex',
- alignItems: 'center',
- gap: spacingVars['--spacing-4'],
- width: '100%',
- },
- dividerLine: {
- flexGrow: 1,
- },
- centered: {
- textAlign: 'center',
- },
- passwordRow: {
- display: 'flex',
- alignItems: 'center',
- justifyContent: 'space-between',
+ centered: {textAlign: 'center'},
+ termsFooter: {
+ maxWidth: 400,
},
});
@@ -93,146 +52,130 @@ export default function LoginSimple() {
const [loginFailed, setLoginFailed] = useState(false);
return (
- <div
- {...stylex.props(styles.pageBg)}
- style={{
- display: 'flex',
- flexDirection: 'column',
- alignItems: 'center',
- justifyContent: 'center',
- minHeight: '100svh',
- height: '100%',
+ <XDSCenter axis="both" xstyle={styles.page}>
+ <XDSVStack gap={4} hAlign="center">
+ {/* Logo */}
+ <XDSVStack gap={2} hAlign="center">
+ <XDSIcon icon={CubeIcon} size="lg" />
+ <XDSText type="body" weight="bold" size="lg">
+ Product Inc.
+ </XDSText>
+ </XDSVStack>
- padding: 24,
- position: 'fixed',
- inset: 0,
- overflow: 'auto',
- gap: 16,
- }}>
- {/* Logo — outside card */}
- <XDSVStack gap={2} hAlign="center">
- <LogoIcon />
- <XDSText type="body" weight="bold" size="lg">
- Product Inc.
- </XDSText>
- </XDSVStack>
- {/* Card */}
- <XDSCard padding={8} width={400}>
- <XDSVStack gap={4}>
- {/* Header */}
- <XDSVStack hAlign="center" xstyle={styles.centered}>
- <XDSVStack gap={1}>
- <XDSHeading level={2}>Welcome back</XDSHeading>
- <XDSText type="body" color="secondary" size="sm">
- Sign in to your account
- </XDSText>
+ {/* Card */}
+ <XDSCard padding={8} width={400}>
+ <XDSVStack gap={4}>
+ {/* Header */}
+ <XDSVStack hAlign="center" xstyle={styles.centered}>
+ <XDSVStack gap={1}>
+ <XDSHeading level={2}>Welcome back</XDSHeading>
+ <XDSText type="body" color="secondary" size="sm">
+ Sign in to your account
+ </XDSText>
+ </XDSVStack>
</XDSVStack>
- </XDSVStack>
- {/* Form fields */}
- <XDSVStack gap={2}>
- <XDSTextInput
- label="Email"
- isLabelHidden
- type="email"
- placeholder="[email protected]"
- value={email}
- onChange={setEmail}
- />
- <XDSVStack gap={1}>
+ {/* Form fields */}
+ <XDSVStack gap={2}>
<XDSTextInput
- label="Password"
+ label="Email"
isLabelHidden
- placeholder="Enter your password"
- type="password"
- value={password}
- onChange={(v: string) => {
- setPassword(v);
- setLoginFailed(false);
- }}
- status={
- loginFailed
- ? {type: 'error', message: 'Incorrect password. Try again.'}
- : undefined
- }
+ type="email"
+ placeholder="[email protected]"
+ value={email}
+ onChange={setEmail}
+ size="lg"
/>
- {loginFailed && (
- <div style={{textAlign: 'right'}}>
- <XDSLink
- label="Forgot your password?"
- href="#"
- size="sm"
- color="secondary"
- type="supporting">
- Forgot password?
- </XDSLink>
- </div>
- )}
+ <XDSVStack gap={1}>
+ <XDSTextInput
+ label="Password"
+ isLabelHidden
+ placeholder="Enter your password"
+ type="password"
+ value={password}
+ onChange={(v: string) => {
+ setPassword(v);
+ setLoginFailed(false);
+ }}
+ size="lg"
+ status={
+ loginFailed
+ ? {type: 'error', message: 'Incorrect password. Try again.'}
+ : undefined
+ }
+ />
+ {loginFailed && (
+ <XDSVStack hAlign="end">
+ <XDSLink
+ label="Forgot password?"
+ href="#"
+ size="sm"
+ color="secondary"
+ type="supporting">
+ Forgot password?
+ </XDSLink>
+ </XDSVStack>
+ )}
+ </XDSVStack>
</XDSVStack>
- </XDSVStack>
-
- {/* Login button */}
- <XDSButton
- label="Login"
- variant="primary"
- xstyle={styles.fullWidth}
- onClick={() => setLoginFailed(true)}
- />
-
- {/* Divider */}
- <XDSHStack gap={4} vAlign="center">
- <div style={{flex: 1}}>
- <XDSDivider />
- </div>
- <XDSText type="supporting" color="secondary">
- Or continue with
- </XDSText>
- <div style={{flex: 1}}>
- <XDSDivider />
- </div>
- </XDSHStack>
- {/* Social buttons */}
- <XDSVStack gap={3}>
+ {/* Login button */}
<XDSButton
- label="Login with Apple"
- variant="secondary"
- icon={<AppleIcon />}
+ label="Login"
+ variant="primary"
+ size="lg"
xstyle={styles.fullWidth}
+ onClick={() => setLoginFailed(true)}
/>
- <XDSButton
- label="Login with Google"
- variant="secondary"
- icon={<GoogleIcon />}
- xstyle={styles.fullWidth}
- />
- </XDSVStack>
- {/* Sign up link */}
- <XDSVStack hAlign="center" xstyle={styles.centered}>
- <XDSText type="supporting" color="secondary">
- Don&apos;t have an account?{' '}
- <XDSLink label="Sign up" href="#" type="supporting">
- Sign up
- </XDSLink>
- </XDSText>
+ {/* Divider */}
+ <XDSDivider label="Or continue with" />
+
+ {/* Social buttons */}
+ <XDSVStack gap={3}>
+ <XDSButton
+ label="Login with Apple"
+ variant="secondary"
+ icon={<AppleIcon />}
+ size="lg"
+ xstyle={styles.fullWidth}
+ />
+ <XDSButton
+ label="Login with Google"
+ variant="secondary"
+ icon={<GoogleIcon />}
+ size="lg"
+ xstyle={styles.fullWidth}
+ />
+ </XDSVStack>
+
+ {/* Sign up link */}
+ <XDSVStack hAlign="center">
+ <XDSText type="supporting" color="secondary">
+ Don&apos;t have an account?{' '}
+ <XDSLink label="Sign up" href="#" type="supporting">
+ Sign up
+ </XDSLink>
+ </XDSText>
+ </XDSVStack>
</XDSVStack>
+ </XDSCard>
+
+ {/* Terms */}
+ <XDSVStack hAlign="center" xstyle={styles.termsFooter}>
+ <XDSText type="supporting" color="secondary" xstyle={styles.centered}>
+ By clicking continue, you agree to our{' '}
+ <XDSLink label="Terms of Service" href="#" type="supporting">
+ Terms of Service
+ </XDSLink>{' '}
+ and{' '}
+ <XDSLink label="Privacy Policy" href="#" type="supporting">
+ Privacy Policy
+ </XDSLink>
+ .
+ </XDSText>
</XDSVStack>
- </XDSCard>
- {/* Terms — outside card */}
- <div style={{textAlign: 'center', maxWidth: 400}}>
- <XDSText type="supporting" color="secondary">
- By clicking continue, you agree to our{' '}
- <XDSLink label="Terms of Service" href="#" type="supporting">
- Terms of Service
- </XDSLink>{' '}
- and{' '}
- <XDSLink label="Privacy Policy" href="#" type="supporting">
- Privacy Policy
- </XDSLink>
- .
- </XDSText>
- </div>
- </div>
+ </XDSVStack>
+ </XDSCenter>
);
}
diff --git a/packages/cli/templates/pages/login-split/page.tsx b/packages/cli/templates/pages/login-split/page.tsx
index ac90868c43..af6e6eb1cf 100644
--- a/packages/cli/templates/pages/login-split/page.tsx
+++ b/packages/cli/templates/pages/login-split/page.tsx
@@ -3,137 +3,57 @@
import {useState} from 'react';
import * as stylex from '@stylexjs/stylex';
import {XDSVStack, XDSHStack} from '@xds/core/Layout';
+import {XDSCenter} from '@xds/core/Center';
import {XDSCard} from '@xds/core/Card';
import {XDSText, XDSHeading} from '@xds/core/Text';
import {XDSTextInput} from '@xds/core/TextInput';
import {XDSButton} from '@xds/core/Button';
import {XDSLink} from '@xds/core/Link';
import {XDSDivider} from '@xds/core/Divider';
-import {
- colorVars,
- spacingVars,
- radiusVars,
-} from '@xds/core/theme/tokens.stylex';
-const ImageIcon = (props: React.SVGProps<SVGSVGElement>) => (
- <svg
- viewBox="0 0 24 24"
- fill="none"
- stroke="currentColor"
- strokeWidth={2}
- strokeLinecap="round"
- strokeLinejoin="round"
- {...props}>
- <rect x="3" y="3" width="18" height="18" rx="2" ry="2" />
- <circle cx="8.5" cy="8.5" r="1.5" />
- <polyline points="21 15 16 10 5 21" />
- </svg>
-);
+import {colorVars, spacingVars} from '@xds/core/theme/tokens.stylex';
+
+// Brand icons — no heroicons equivalent
const AppleIcon = (props: React.SVGProps<SVGSVGElement>) => (
- <svg
- viewBox="0 0 24 24"
- fill="currentColor"
- width={16}
- height={16}
- {...props}>
+ <svg viewBox="0 0 24 24" fill="currentColor" width={16} height={16} {...props}>
<path d="M17.05 20.28c-.98.95-2.05.88-3.08.4-1.09-.5-2.08-.48-3.24 0-1.44.62-2.2.44-3.06-.4C2.79 15.25 3.51 7.59 9.05 7.31c1.35.07 2.29.74 3.08.8 1.18-.24 2.31-.93 3.57-.84 1.51.12 2.65.72 3.4 1.8-3.12 1.87-2.38 5.98.48 7.13-.57 1.5-1.31 2.99-2.54 4.09zM12.03 7.25c-.15-2.23 1.66-4.07 3.74-4.25.29 2.58-2.34 4.5-3.74 4.25z" />
</svg>
);
const GoogleIcon = (props: React.SVGProps<SVGSVGElement>) => (
- <svg
- viewBox="0 0 24 24"
- fill="currentColor"
- width={16}
- height={16}
- {...props}>
- <path
- d="M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92a5.06 5.06 0 01-2.2 3.32v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.1z"
- fill="#4285F4"
- />
- <path
- d="M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23z"
- fill="#34A853"
- />
- <path
- d="M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.07H2.18C1.43 8.55 1 10.22 1 12s.43 3.45 1.18 4.93l2.85-2.22.81-.62z"
- fill="#FBBC05"
- />
- <path
- d="M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.07l3.66 2.84c.87-2.6 3.3-4.53 6.16-4.53z"
- fill="#EA4335"
- />
- </svg>
-);
-
-const MetaIcon = (props: React.SVGProps<SVGSVGElement>) => (
- <svg
- viewBox="0 0 24 24"
- fill="currentColor"
- width={16}
- height={16}
- {...props}>
- <path d="M6.916 4.603c-1.293 0-2.378.89-3.252 2.14C2.453 8.558 1.8 11.073 1.8 13.2c0 1.225.293 2.198.865 2.88.54.643 1.31.97 2.215.97 1.168 0 2.085-.59 3.084-2.013.79-1.126 1.583-2.685 2.575-4.63l.387-.76c.828-1.627 1.778-3.377 2.937-4.726C15.15 3.49 16.622 2.8 18.25 2.8c1.85 0 3.387.87 4.454 2.4C23.76 6.69 24.2 8.933 24.2 11.5c0 2.758-.68 5.083-1.907 6.72C21.1 19.825 19.363 20.8 17.3 20.8v-2.9c1.26 0 2.233-.573 2.97-1.59.783-1.078 1.23-2.7 1.23-4.81 0-1.94-.332-3.553-.977-4.67-.6-1.04-1.44-1.63-2.573-1.63-1.078 0-1.972.613-2.873 1.8-.7.92-1.384 2.135-2.178 3.66l-.478.924c-1.005 1.94-1.88 3.468-2.876 4.676C8.242 18.018 6.92 18.9 5.1 18.9c-1.648 0-2.97-.62-3.888-1.713C.33 16.118-.1 14.578-.1 12.8c0-2.53.722-5.383 2.1-7.53C3.37 3.1 5.065 2 6.916 2v2.603z" />
+ <svg viewBox="0 0 24 24" fill="currentColor" width={16} height={16} {...props}>
+ <path d="M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92a5.06 5.06 0 01-2.2 3.32v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.1z" fill="#4285F4" />
+ <path d="M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23z" fill="#34A853" />
+ <path d="M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.07H2.18C1.43 8.55 1 10.22 1 12s.43 3.45 1.18 4.93l2.85-2.22.81-.62z" fill="#FBBC05" />
+ <path d="M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.07l3.66 2.84c.87-2.6 3.3-4.53 6.16-4.53z" fill="#EA4335" />
</svg>
);
const styles = stylex.create({
- pageBg: {
+ page: {
+ minHeight: '100dvh',
+ padding: spacingVars['--spacing-6'],
backgroundColor: colorVars['--color-background-body'],
},
- cardBg: {
- backgroundColor: colorVars['--color-background-card'],
- },
- imageBg: {
- backgroundColor: colorVars['--color-background-muted'],
+ fullWidth: {
+ width: '100%',
},
- card: {
+ centered: {textAlign: 'center'},
+ splitRow: {
display: 'flex',
- maxWidth: 900,
- width: '100%',
- backgroundColor: colorVars['--color-background-card'],
- borderRadius: radiusVars['--radius-container'],
- overflow: 'hidden',
- boxShadow: '0 1px 3px rgba(0,0,0,0.08)',
+ alignItems: 'stretch',
},
formSide: {
- flex: 1,
+ width: '50%',
padding: spacingVars['--spacing-8'],
display: 'flex',
flexDirection: 'column',
justifyContent: 'center',
},
- imageSide: {
- flex: 1,
- backgroundColor: colorVars['--color-background-muted'],
- display: 'flex',
- alignItems: 'center',
- justifyContent: 'center',
+ coverImage: {
+ width: '50%',
minHeight: 400,
- },
- fullWidth: {
- width: '100%',
- },
- dividerRow: {
- display: 'flex',
- alignItems: 'center',
- gap: spacingVars['--spacing-4'],
- width: '100%',
- },
- dividerLine: {
- flexGrow: 1,
- },
- centered: {
- textAlign: 'center',
- },
- passwordRow: {
- display: 'flex',
- alignItems: 'center',
- justifyContent: 'space-between',
- },
- socialRow: {
- display: 'flex',
- gap: spacingVars['--spacing-3'],
+ objectFit: 'cover',
},
socialButton: {
flex: 1,
@@ -146,169 +66,131 @@ export default function LoginTwoColumn() {
const [loginFailed, setLoginFailed] = useState(false);
return (
- <div
- {...stylex.props(styles.pageBg)}
- style={{
- display: 'flex',
- flexDirection: 'column',
- alignItems: 'center',
- justifyContent: 'center',
- minHeight: '100svh',
- height: '100%',
- padding: 24,
- position: 'fixed',
- inset: 0,
- overflow: 'auto',
- gap: 16,
- }}>
- {/* Card */}
- <XDSCard padding={0} maxWidth={900} width="100%">
- <XDSHStack>
- {/* Left — Form */}
- <div
- style={{
- width: 400,
- minWidth: 400,
- padding: 32,
- display: 'flex',
- flexDirection: 'column',
- justifyContent: 'center',
- }}>
- <XDSVStack gap={4}>
- <XDSVStack hAlign="center" xstyle={styles.centered}>
- <XDSVStack gap={1}>
- <XDSHeading level={2}>Welcome back</XDSHeading>
- <XDSText type="body" color="secondary" size="sm">
- Login to your Product Inc. account
- </XDSText>
+ <XDSCenter axis="both" xstyle={styles.page}>
+ <XDSVStack gap={4} hAlign="center">
+ {/* Card */}
+ <XDSCard padding={0} maxWidth={1000} width="100%">
+ <div {...stylex.props(styles.splitRow)}>
+ {/* Left — Form */}
+ <div {...stylex.props(styles.formSide)}>
+ <XDSVStack gap={4}>
+ <XDSVStack hAlign="center" xstyle={styles.centered}>
+ <XDSVStack gap={1}>
+ <XDSHeading level={2}>Welcome back</XDSHeading>
+ <XDSText type="body" color="secondary" size="sm">
+ Login to your Product Inc. account
+ </XDSText>
+ </XDSVStack>
</XDSVStack>
- </XDSVStack>
- <XDSVStack gap={2}>
- <XDSTextInput
- label="Email"
- isLabelHidden
- type="email"
- placeholder="[email protected]"
- value={email}
- onChange={setEmail}
- />
- <XDSVStack gap={1}>
+ <XDSVStack gap={2}>
<XDSTextInput
- label="Password"
+ label="Email"
isLabelHidden
- placeholder="Enter your password"
- type="password"
- value={password}
- onChange={(v: string) => {
- setPassword(v);
- setLoginFailed(false);
- }}
- status={
- loginFailed
- ? {
- type: 'error',
- message: 'Incorrect password. Try again.',
- }
- : undefined
- }
+ type="email"
+ placeholder="[email protected]"
+ value={email}
+ onChange={setEmail}
+ size="lg"
/>
- {loginFailed && (
- <div style={{textAlign: 'right'}}>
- <XDSLink
- label="Forgot your password?"
- href="#"
- size="sm"
- color="secondary"
- type="supporting">
- Forgot your password?
- </XDSLink>
- </div>
- )}
+ <XDSVStack gap={1}>
+ <XDSTextInput
+ label="Password"
+ isLabelHidden
+ placeholder="Enter your password"
+ type="password"
+ value={password}
+ onChange={(v: string) => {
+ setPassword(v);
+ setLoginFailed(false);
+ }}
+ size="lg"
+ status={
+ loginFailed
+ ? {
+ type: 'error',
+ message: 'Incorrect password. Try again.',
+ }
+ : undefined
+ }
+ />
+ {loginFailed && (
+ <XDSVStack hAlign="end">
+ <XDSLink
+ label="Forgot your password?"
+ href="#"
+ size="sm"
+ color="secondary"
+ type="supporting">
+ Forgot your password?
+ </XDSLink>
+ </XDSVStack>
+ )}
+ </XDSVStack>
</XDSVStack>
- </XDSVStack>
-
- <XDSButton
- label="Login"
- variant="primary"
- xstyle={styles.fullWidth}
- onClick={() => setLoginFailed(true)}
- />
-
- <XDSHStack gap={4} vAlign="center">
- <div style={{flex: 1}}>
- <XDSDivider />
- </div>
- <XDSText type="supporting" color="secondary">
- Or continue with
- </XDSText>
- <div style={{flex: 1}}>
- <XDSDivider />
- </div>
- </XDSHStack>
- <div {...stylex.props(styles.socialRow)}>
<XDSButton
- label="Apple"
- variant="secondary"
- icon={<AppleIcon />}
- xstyle={styles.socialButton}
+ label="Login"
+ variant="primary"
+ size="lg"
+ xstyle={styles.fullWidth}
+ onClick={() => setLoginFailed(true)}
/>
- <XDSButton
- label="Google"
- variant="secondary"
- icon={<GoogleIcon />}
- xstyle={styles.socialButton}
- />
- </div>
- <XDSVStack hAlign="center" xstyle={styles.centered}>
- <XDSText type="supporting" color="secondary">
- Don&apos;t have an account?{' '}
- <XDSLink label="Sign up" href="#" type="supporting">
- Sign up
- </XDSLink>
- </XDSText>
+ <XDSDivider label="Or continue with" />
+
+ <XDSHStack gap={3}>
+ <XDSButton
+ label="Apple"
+ variant="secondary"
+ icon={<AppleIcon />}
+ size="lg"
+ xstyle={styles.socialButton}
+ />
+ <XDSButton
+ label="Google"
+ variant="secondary"
+ icon={<GoogleIcon />}
+ size="lg"
+ xstyle={styles.socialButton}
+ />
+ </XDSHStack>
+
+ <XDSVStack hAlign="center">
+ <XDSText type="supporting" color="secondary">
+ Don&apos;t have an account?{' '}
+ <XDSLink label="Sign up" href="#" type="supporting">
+ Sign up
+ </XDSLink>
+ </XDSText>
+ </XDSVStack>
</XDSVStack>
- </XDSVStack>
- </div>
+ </div>
- {/* Right — Image placeholder */}
- <div
- {...stylex.props(styles.imageBg)}
- style={{
- flex: 1,
- display: 'flex',
- alignItems: 'center',
- justifyContent: 'center',
- minHeight: 400,
- borderRadius: '0 12px 12px 0',
- }}>
- <ImageIcon
- style={{
- width: 64,
- height: 64,
- opacity: 0.3,
- color: 'var(--color-text-disabled)',
- }}
+ {/* Right — Cover image */}
+ <img
+ {...stylex.props(styles.coverImage)}
+ src="/templates/colorful-home-vertical-3.png"
+ alt="Colorful home scene"
/>
</div>
- </XDSHStack>
- </XDSCard>
- {/* Terms — outside card */}
- <XDSVStack hAlign="center" xstyle={styles.centered}>
- <XDSText type="supporting" color="secondary">
- By clicking continue, you agree to our{' '}
- <XDSLink label="Terms of Service" href="#" type="supporting">
- Terms of Service
- </XDSLink>{' '}
- and{' '}
- <XDSLink label="Privacy Policy" href="#" type="supporting">
- Privacy Policy
- </XDSLink>
- .
- </XDSText>
+ </XDSCard>
+
+ {/* Terms */}
+ <XDSVStack hAlign="center">
+ <XDSText type="supporting" color="secondary" xstyle={styles.centered}>
+ By clicking continue, you agree to our{' '}
+ <XDSLink label="Terms of Service" href="#" type="supporting">
+ Terms of Service
+ </XDSLink>{' '}
+ and{' '}
+ <XDSLink label="Privacy Policy" href="#" type="supporting">
+ Privacy Policy
+ </XDSLink>
+ .
+ </XDSText>
+ </XDSVStack>
</XDSVStack>
- </div>
+ </XDSCenter>
);
}
diff --git a/packages/cli/templates/pages/login-sso/page.tsx b/packages/cli/templates/pages/login-sso/page.tsx
index d251540aaf..e2f246266e 100644
--- a/packages/cli/templates/pages/login-sso/page.tsx
+++ b/packages/cli/templates/pages/login-sso/page.tsx
@@ -13,7 +13,11 @@ import {XDSSection} from '@xds/core/Section';
import {XDSLink} from '@xds/core/Link';
import {XDSDivider} from '@xds/core/Divider';
import {XDSIcon} from '@xds/core/Icon';
-import {colorVars, spacingVars, radiusVars} from '@xds/core/theme/tokens.stylex';
+import {
+ colorVars,
+ spacingVars,
+ radiusVars,
+} from '@xds/core/theme/tokens.stylex';
// ---------------------------------------------------------------------------
// Styles
@@ -55,22 +59,52 @@ function MetaLogo(props: React.SVGProps<SVGSVGElement>) {
return (
<svg viewBox="0 0 290 191" {...props}>
<defs>
- <linearGradient id={g1} x1="61" y1="117" x2="259" y2="127" gradientUnits="userSpaceOnUse">
- <stop offset="0" stopColor="#0064e1" /><stop offset="0.4" stopColor="#0064e1" /><stop offset="0.83" stopColor="#0073ee" /><stop offset="1" stopColor="#0082fb" />
+ <linearGradient
+ id={g1}
+ x1="61"
+ y1="117"
+ x2="259"
+ y2="127"
+ gradientUnits="userSpaceOnUse">
+ <stop offset="0" stopColor="#0064e1" />
+ <stop offset="0.4" stopColor="#0064e1" />
+ <stop offset="0.83" stopColor="#0073ee" />
+ <stop offset="1" stopColor="#0082fb" />
</linearGradient>
- <linearGradient id={g2} x1="45" y1="139" x2="45" y2="66" gradientUnits="userSpaceOnUse">
- <stop offset="0" stopColor="#0082fb" /><stop offset="1" stopColor="#0064e0" />
+ <linearGradient
+ id={g2}
+ x1="45"
+ y1="139"
+ x2="45"
+ y2="66"
+ gradientUnits="userSpaceOnUse">
+ <stop offset="0" stopColor="#0082fb" />
+ <stop offset="1" stopColor="#0064e0" />
</linearGradient>
</defs>
- <path fill="#0081fb" d="m31.06,125.96c0,10.98 2.41,19.41 5.56,24.51 4.13,6.68 10.29,9.51 16.57,9.51 8.1,0 15.51-2.01 29.79-21.76 11.44-15.83 24.92-38.05 33.99-51.98l15.36-23.6c10.67-16.39 23.02-34.61 37.18-46.96 11.56-10.08 24.03-15.68 36.58-15.68 21.07,0 41.14,12.21 56.5,35.11 16.81,25.08 24.97,56.67 24.97,89.27 0,19.38-3.82,33.62-10.32,44.87-6.28,10.88-18.52,21.75-39.11,21.75l0-31.02c17.63,0 22.03-16.2 22.03-34.74 0-26.42-6.16-55.74-19.73-76.69-9.63-14.86-22.11-23.94-35.84-23.94-14.85,0-26.8,11.2-40.23,31.17-7.14,10.61-14.47,23.54-22.7,38.13l-9.06,16.05c-18.2,32.27-22.81,39.62-31.91,51.75-15.95,21.24-29.57,29.29-47.5,29.29-21.27,0-34.72-9.21-43.05-23.09-6.8-11.31-10.14-26.15-10.14-43.06z" />
- <path fill={`url(#${g1})`} d="m24.49,37.3c14.24-21.95 34.79-37.3 58.36-37.3 13.65,0 27.22,4.04 41.39,15.61 15.5,12.65 32.02,33.48 52.63,67.81l7.39,12.32c17.84,29.72 27.99,45.01 33.93,52.22 7.64,9.26 12.99,12.02 19.94,12.02 17.63,0 22.03-16.2 22.03-34.74l27.4-.86c0,19.38-3.82,33.62-10.32,44.87-6.28,10.88-18.52,21.75-39.11,21.75-12.8,0-24.14-2.78-36.68-14.61-9.64-9.08-20.91-25.21-29.58-39.71l-25.79-43.08c-12.94-21.62-24.81-37.74-31.68-45.04-7.39-7.85-16.89-17.33-32.05-17.33-12.27,0-22.69,8.61-31.41,21.78z" />
- <path fill={`url(#${g2})`} d="m82.35,31.23c-12.27,0-22.69,8.61-31.41,21.78-12.33,18.61-19.88,46.33-19.88,72.95 0,10.98 2.41,19.41 5.56,24.51l-26.48,17.44c-6.8-11.31-10.14-26.15-10.14-43.06 0-30.75 8.44-62.8 24.49-87.55 14.24-21.95 34.79-37.3 58.36-37.3z" />
+ <path
+ fill="#0081fb"
+ d="m31.06,125.96c0,10.98 2.41,19.41 5.56,24.51 4.13,6.68 10.29,9.51 16.57,9.51 8.1,0 15.51-2.01 29.79-21.76 11.44-15.83 24.92-38.05 33.99-51.98l15.36-23.6c10.67-16.39 23.02-34.61 37.18-46.96 11.56-10.08 24.03-15.68 36.58-15.68 21.07,0 41.14,12.21 56.5,35.11 16.81,25.08 24.97,56.67 24.97,89.27 0,19.38-3.82,33.62-10.32,44.87-6.28,10.88-18.52,21.75-39.11,21.75l0-31.02c17.63,0 22.03-16.2 22.03-34.74 0-26.42-6.16-55.74-19.73-76.69-9.63-14.86-22.11-23.94-35.84-23.94-14.85,0-26.8,11.2-40.23,31.17-7.14,10.61-14.47,23.54-22.7,38.13l-9.06,16.05c-18.2,32.27-22.81,39.62-31.91,51.75-15.95,21.24-29.57,29.29-47.5,29.29-21.27,0-34.72-9.21-43.05-23.09-6.8-11.31-10.14-26.15-10.14-43.06z"
+ />
+ <path
+ fill={`url(#${g1})`}
+ d="m24.49,37.3c14.24-21.95 34.79-37.3 58.36-37.3 13.65,0 27.22,4.04 41.39,15.61 15.5,12.65 32.02,33.48 52.63,67.81l7.39,12.32c17.84,29.72 27.99,45.01 33.93,52.22 7.64,9.26 12.99,12.02 19.94,12.02 17.63,0 22.03-16.2 22.03-34.74l27.4-.86c0,19.38-3.82,33.62-10.32,44.87-6.28,10.88-18.52,21.75-39.11,21.75-12.8,0-24.14-2.78-36.68-14.61-9.64-9.08-20.91-25.21-29.58-39.71l-25.79-43.08c-12.94-21.62-24.81-37.74-31.68-45.04-7.39-7.85-16.89-17.33-32.05-17.33-12.27,0-22.69,8.61-31.41,21.78z"
+ />
+ <path
+ fill={`url(#${g2})`}
+ d="m82.35,31.23c-12.27,0-22.69,8.61-31.41,21.78-12.33,18.61-19.88,46.33-19.88,72.95 0,10.98 2.41,19.41 5.56,24.51l-26.48,17.44c-6.8-11.31-10.14-26.15-10.14-43.06 0-30.75 8.44-62.8 24.49-87.55 14.24-21.95 34.79-37.3 58.36-37.3z"
+ />
</svg>
);
}
// Mock SSO providers keyed by email domain
-type SSOProvider = {name: string; color: string; abbr: string; logo?: React.ComponentType<React.SVGProps<SVGSVGElement>>};
+type SSOProvider = {
+ name: string;
+ color: string;
+ abbr: string;
+ logo?: React.ComponentType<React.SVGProps<SVGSVGElement>>;
+};
const SSO_PROVIDERS: Record<string, SSOProvider> = {
'google.com': {name: 'Google Workspace', color: '#4285F4', abbr: 'G'},
'microsoft.com': {name: 'Microsoft Entra ID', color: '#00A4EF', abbr: 'M'},
diff --git a/packages/cli/templates/pages/login/page.tsx b/packages/cli/templates/pages/login/page.tsx
index 9c408c157a..f34fa45912 100644
--- a/packages/cli/templates/pages/login/page.tsx
+++ b/packages/cli/templates/pages/login/page.tsx
@@ -1,56 +1,83 @@
'use client';
import {useState} from 'react';
-import {XDSLayout, XDSLayoutContent} from '@xds/core';
-import {XDSText} from '@xds/core';
-import {XDSTextInput} from '@xds/core';
-import {XDSButton} from '@xds/core';
-import {XDSCard} from '@xds/core';
-import {XDSCenter} from '@xds/core';
-import {XDSFormLayout} from '@xds/core';
+import * as stylex from '@stylexjs/stylex';
+import {XDSVStack} from '@xds/core/Layout';
+import {XDSCenter} from '@xds/core/Center';
+import {XDSText, XDSHeading} from '@xds/core/Text';
+import {XDSTextInput} from '@xds/core/TextInput';
+import {XDSButton} from '@xds/core/Button';
+import {XDSCard} from '@xds/core/Card';
+import {XDSIcon} from '@xds/core/Icon';
+import {CubeIcon} from '@heroicons/react/24/outline';
+import {colorVars, spacingVars} from '@xds/core/theme/tokens.stylex';
+
+const styles = stylex.create({
+ page: {
+ minHeight: '100dvh',
+ padding: spacingVars['--spacing-6'],
+ backgroundColor: colorVars['--color-background-body'],
+ },
+ fullWidth: {
+ width: '100%',
+ },
+ centered: {textAlign: 'center'},
+});
export default function LoginPage() {
const [email, setEmail] = useState('');
const [password, setPassword] = useState('');
- const handleSubmit = (e: React.FormEvent) => {
- e.preventDefault();
- // Handle login
- };
-
return (
- <XDSLayout
- content={
- <XDSLayoutContent>
- <XDSCenter width="100%" height="100vh">
- <form onSubmit={handleSubmit}>
- <XDSCard maxWidth={400} width="100%">
- <XDSFormLayout>
- <XDSText type="large" weight="semibold">
- Sign in
- </XDSText>
-
- <XDSTextInput
- label="Email"
- value={email}
- onChange={setEmail}
- placeholder="[email protected]"
- />
-
- <XDSTextInput
- label="Password"
- value={password}
- onChange={setPassword}
- placeholder="Enter your password"
- />
-
- <XDSButton label="Sign in" variant="primary" type="submit" />
- </XDSFormLayout>
- </XDSCard>
- </form>
- </XDSCenter>
- </XDSLayoutContent>
- }
- />
+ <XDSCenter axis="both" xstyle={styles.page}>
+ <XDSVStack gap={4} hAlign="center">
+ {/* Logo */}
+ <XDSVStack gap={2} hAlign="center">
+ <XDSIcon icon={CubeIcon} size="lg" />
+ <XDSText type="body" weight="bold" size="lg">
+ Product Inc.
+ </XDSText>
+ </XDSVStack>
+
+ {/* Card */}
+ <XDSCard padding={8} width={400}>
+ <XDSVStack gap={4}>
+ <XDSVStack hAlign="center" xstyle={styles.centered}>
+ <XDSVStack gap={1}>
+ <XDSHeading level={2}>Sign in</XDSHeading>
+ <XDSText type="body" color="secondary" size="sm">
+ Enter your credentials to continue
+ </XDSText>
+ </XDSVStack>
+ </XDSVStack>
+
+ <XDSTextInput
+ label="Email"
+ value={email}
+ onChange={setEmail}
+ placeholder="[email protected]"
+ type="email"
+ size="lg"
+ />
+
+ <XDSTextInput
+ label="Password"
+ value={password}
+ onChange={setPassword}
+ placeholder="Enter your password"
+ type="password"
+ size="lg"
+ />
+
+ <XDSButton
+ label="Sign in"
+ variant="primary"
+ size="lg"
+ xstyle={styles.fullWidth}
+ />
+ </XDSVStack>
+ </XDSCard>
+ </XDSVStack>
+ </XDSCenter>
);
}