Skip to content

Signup screen in SwiftUI, Flutter, React Native and HTML/CSS

A signup screen in all four targets: social buttons, divider, fields, hint and terms.

Open in editor

A signup screen is a login screen with more to get wrong: two alternative sign-in buttons, a divider that has to line up with its label, three fields, a hint under the password, and a block of small print that wraps to two lines. We drew it once at 390 by 844 (an iPhone 14) and exported it to all four targets. The code below is the generator's output, unedited.

What we drew

ElementPositionSizeNotes
Title, "Create your account"x 24, y 96342 x 3628px, bold
Subtitlex 24, y 140342 x 2215px, grey
"Continue with Apple"x 24, y 196342 x 52outlined, radius 14
"Continue with Google"x 24, y 260342 x 52outlined, radius 14
Divider, left rulex 24, y 336150 x 11px line
Divider label, "or"x 175, y 32640 x 2013px, centred
Divider, right rulex 216, y 336150 x 11px line
Full name fieldx 24, y 364342 x 48radius 12
Email fieldx 24, y 428342 x 48email keyboard
Password fieldx 24, y 492342 x 48secure entry
Hintx 24, y 548342 x 1813px, grey
"Create account"x 24, y 588342 x 52filled, radius 14
Termsx 24, y 664342 x 3613px, centred, two lines
Sign-in linkx 24, y 740342 x 2215px, medium, centred

The divider is the part worth checking by hand. The rules and the label have to add up to the full content width: 150 + 1 + 40 + 1 + 150 = 342, so the left rule ends at x 174, the label sits from 175 to 215, and the right rule starts at 216 and ends at 366, the same right margin as everything else. The two social buttons are 12 apart (248 to 260), the three fields are 16 apart (412 to 428, 476 to 492), and the hint sits 8 below the password field (540 to 548). The terms paragraph is 36 tall because 13px type at a 1.4 line height is about 18 a line, and two lines is what that sentence takes at this width.

React Native

Each of the three buttons is a Pressable containing both its rectangle and its label, so a tap on the text counts as a tap on the button. The fields are plain TextInputs, with keyboardType="email-address" on the email field and secureTextEntry on the password.

import React from 'react';
import { View, Text, Pressable, TextInput, StyleSheet } from 'react-native';

export default function Signup() {
  const handleApple = () => {};
  const handleGoogle = () => {};
  const handleCreate = () => {};

  return (
    <View style={styles.screen}>
      <Text style={styles.title}>{"Create your account"}</Text>
      <Text style={styles.subtitle}>{"It takes about a minute."}</Text>
      <Pressable onPress={handleApple} style={({ pressed }) => [styles.group, pressed && styles.pressed]}>
        <View style={styles.apple} />
        <View style={styles.appleLabel}><Text style={styles.appleLabelText}>{"Continue with Apple"}</Text></View>
      </Pressable>
      <Pressable onPress={handleGoogle} style={({ pressed }) => [styles.group2, pressed && styles.pressed]}>
        <View style={styles.google} />
        <View style={styles.googleLabel}><Text style={styles.googleLabelText}>{"Continue with Google"}</Text></View>
      </Pressable>
      <View style={styles.ruleLeft} />
      <Text style={styles.or}>{"or"}</Text>
      <View style={styles.ruleRight} />
      <TextInput style={styles.name} placeholder={"Full name"} placeholderTextColor="#9ca3af" />
      <TextInput style={styles.email} placeholder={"Email"} placeholderTextColor="#9ca3af" keyboardType="email-address" />
      <TextInput style={styles.password} placeholder={"Password"} placeholderTextColor="#9ca3af" secureTextEntry />
      <Text style={styles.hint}>{"Use at least 8 characters."}</Text>
      <Pressable onPress={handleCreate} style={({ pressed }) => [styles.group3, pressed && styles.pressed]}>
        <View style={styles.create} />
        <View style={styles.createLabel}><Text style={styles.createLabelText}>{"Create account"}</Text></View>
      </Pressable>
      <Text style={styles.terms}>{"By creating an account you agree to our Terms and Privacy Policy."}</Text>
      <Text style={styles.signInLink}>{"Already have an account? Sign in"}</Text>
    </View>
  );
}

const styles = StyleSheet.create({
  screen: {
    flex: 1,
    backgroundColor: '#ffffff',
  },
  title: {
    position: 'absolute',
    left: 24,
    top: 96,
    width: 342,
    height: 36,
    color: '#17171A',
    fontFamily: 'Inter',
    fontSize: 28,
    lineHeight: 36,
    textAlign: 'left',
    fontWeight: '700',
  },
  subtitle: {
    position: 'absolute',
    left: 24,
    top: 140,
    width: 342,
    height: 22,
    color: '#5B5B63',
    fontFamily: 'Inter',
    fontSize: 15,
    lineHeight: 21,
    textAlign: 'left',
  },
  group: {
    position: 'absolute',
    left: 24,
    top: 196,
    width: 342,
    height: 52,
  },
  apple: {
    position: 'absolute',
    left: 0,
    top: 0,
    width: 342,
    height: 52,
    borderRadius: 14,
    backgroundColor: '#ffffff',
    borderWidth: 1,
    borderColor: '#E4E1D8',
  },
  appleLabel: {
    position: 'absolute',
    left: 0,
    top: 0,
    width: 342,
    height: 52,
    justifyContent: 'center',
  },
  appleLabelText: {
    color: '#17171A',
    fontFamily: 'Inter',
    fontSize: 16,
    lineHeight: 21,
    textAlign: 'center',
    fontWeight: '600',
  },
  group2: {
    position: 'absolute',
    left: 24,
    top: 260,
    width: 342,
    height: 52,
  },
  google: {
    position: 'absolute',
    left: 0,
    top: 0,
    width: 342,
    height: 52,
    borderRadius: 14,
    backgroundColor: '#ffffff',
    borderWidth: 1,
    borderColor: '#E4E1D8',
  },
  googleLabel: {
    position: 'absolute',
    left: 0,
    top: 0,
    width: 342,
    height: 52,
    justifyContent: 'center',
  },
  googleLabelText: {
    color: '#17171A',
    fontFamily: 'Inter',
    fontSize: 16,
    lineHeight: 21,
    textAlign: 'center',
    fontWeight: '600',
  },
  ruleLeft: {
    position: 'absolute',
    left: 24,
    top: 336,
    width: 150,
    height: 1,
    borderRadius: 0,
    backgroundColor: '#E4E1D8',
  },
  or: {
    position: 'absolute',
    left: 175,
    top: 326,
    width: 40,
    height: 20,
    color: '#5B5B63',
    fontFamily: 'Inter',
    fontSize: 13,
    lineHeight: 18,
    textAlign: 'center',
  },
  ruleRight: {
    position: 'absolute',
    left: 216,
    top: 336,
    width: 150,
    height: 1,
    borderRadius: 0,
    backgroundColor: '#E4E1D8',
  },
  name: {
    position: 'absolute',
    left: 24,
    top: 364,
    width: 342,
    height: 48,
    backgroundColor: '#ffffff',
    color: '#17171A',
    fontFamily: 'Inter',
    fontSize: 16,
    paddingHorizontal: 12,
    textAlign: 'left',
    borderRadius: 12,
    borderWidth: 1,
    borderColor: '#E4E1D8',
  },
  email: {
    position: 'absolute',
    left: 24,
    top: 428,
    width: 342,
    height: 48,
    backgroundColor: '#ffffff',
    color: '#17171A',
    fontFamily: 'Inter',
    fontSize: 16,
    paddingHorizontal: 12,
    textAlign: 'left',
    borderRadius: 12,
    borderWidth: 1,
    borderColor: '#E4E1D8',
  },
  password: {
    position: 'absolute',
    left: 24,
    top: 492,
    width: 342,
    height: 48,
    backgroundColor: '#ffffff',
    color: '#17171A',
    fontFamily: 'Inter',
    fontSize: 16,
    paddingHorizontal: 12,
    textAlign: 'left',
    borderRadius: 12,
    borderWidth: 1,
    borderColor: '#E4E1D8',
  },
  hint: {
    position: 'absolute',
    left: 24,
    top: 548,
    width: 342,
    height: 18,
    color: '#5B5B63',
    fontFamily: 'Inter',
    fontSize: 13,
    lineHeight: 18,
    textAlign: 'left',
  },
  group3: {
    position: 'absolute',
    left: 24,
    top: 588,
    width: 342,
    height: 52,
  },
  create: {
    position: 'absolute',
    left: 0,
    top: 0,
    width: 342,
    height: 52,
    borderRadius: 14,
    backgroundColor: '#2A50D8',
  },
  createLabel: {
    position: 'absolute',
    left: 0,
    top: 0,
    width: 342,
    height: 52,
    justifyContent: 'center',
  },
  createLabelText: {
    color: '#ffffff',
    fontFamily: 'Inter',
    fontSize: 16,
    lineHeight: 21,
    textAlign: 'center',
    fontWeight: '600',
  },
  terms: {
    position: 'absolute',
    left: 24,
    top: 664,
    width: 342,
    height: 36,
    color: '#5B5B63',
    fontFamily: 'Inter',
    fontSize: 13,
    lineHeight: 18,
    textAlign: 'center',
  },
  signInLink: {
    position: 'absolute',
    left: 24,
    top: 740,
    width: 342,
    height: 22,
    color: '#2A50D8',
    fontFamily: 'Inter',
    fontSize: 15,
    lineHeight: 21,
    textAlign: 'center',
    fontWeight: '500',
  },
  pressed: {
    opacity: 0.6,
  },
});

What this does not do

  • No logic. handleApple, handleGoogle and handleCreate are empty. Authentication, validation and showing an error under the hint are yours to add.
  • No brand marks. The Apple and Google buttons are outlined rectangles with text. If your sign-in provider's guidelines require their logo or a specific button style, add it.
  • Small print does not reflow. The terms box is 36 tall for two lines. A longer translation that wraps to three lines would overflow it, so redraw or resize it for that language.
  • Fixed size and no keyboard avoidance. The screen is 390 by 844, and nothing moves when the keyboard opens.
  • Fonts by name. Inter is asked for by family name and not embedded.

Make your own

Open the editor, change any number, and the four files above change with it. What you can build lists every control and property the canvas supports, limits included.