Monday Hero
Website
V2
V2
  • Overview
  • Workflow Basics
  • Getting Started
    • Installing the Desktop App
    • Log In & Create a Project
    • Prepare Design to Get the Best Code Results
    • Import Design Files into Monday Hero
      • Import Figma Design Files into Monday Hero
        • Import Your Figma Text Style and Color Library
      • Import Adobe XD Design Files into Monday Hero
      • Import Sketch Design Files Into Monday Hero
    • Share Your Project & Manage Roles
  • DESIGN TO FLUTTER
    • Convert Design to Flutter
    • Create Flutter Components
      • System Components
        • Material & Cupertino Components
        • Flutter Supported Components
      • Custom Components
    • Create Responsive Code
    • Colors
    • Text Styles
    • Assets
    • Sync Code
    • Flutter Project Base
      • Fast Start with Monday Hero Starter Project
      • Integrate Monday Hero to your Existing Project
    • Shadows, Gradients, and Other Design Elements
    • Troubleshooting Guide
      • Checklist for Design Element Review and Code Generation
      • Github Monday Hero Starter Project Troubleshooting
  • DESIGN TO SWIFT
    • Convert Design to Swift
    • Create Swift Components
      • System Components
        • Views
        • Texts
        • Images
        • Button
        • TextField/EditText
        • Text Area
        • Status Bar
        • Search Bar
        • List
        • Grid
        • Swift Supported Components
      • Custom Components
      • Video Player Code Component
    • Colors
    • Text Styles
    • Assets
    • Shadows, Gradients, and Other Design Elements
    • Firebase
      • How to get Video URL from Firebase
    • Export Code
      • Integrating Exported Files into an Existing Xcode Project
  • Hero AI Assistant
    • Hero AI Assistant
  • Design to React
    • Convert Design to React
  • Step-By-Step Tutorials
    • 🏖️Travel App
  • Support
    • Roadmap
    • Suggest a New Feature
    • Report a Bug
    • Product Announcements
    • Mail to Support
    • Frequently Asked Questions
  • Join & Follow Us
    • YouTube
    • Discord Community
    • GitHub
    • Twitter
    • LinkedIn
    • Blog
    • Instagram
    • Facebook
Powered by GitBook
On this page
  • Examples of Components
  • Generated iOS/Android code

Was this helpful?

  1. DESIGN TO SWIFT
  2. Create Swift Components
  3. System Components

TextField/EditText

Convert TextField/EditText component to Android/iOS code.

PreviousButtonNextText Area

Last updated 1 year ago

Was this helpful?

TextField in Swift and EditText in Kotlin is generally used for form pages. It's generally used for the user to enter the email and password like in the images below. TextFields have different names and properties in iOS and Android, they're explained below.

Examples of Components

TextField

TextFields have 4 properties in Monday Hero :

Text: The initial text displayed by the text field. You can specify the text as a plain string or as an attributed string.

Placeholder: A placeholder is a text displayed by the textField when the string is empty. Typing any text into the text field hides this string.

Left icon: You can add an icon to the left side of the textField.

Right icon: You can add an icon to the right side of the textField.

Edit Text

EditTextis used for entering and modifying text.

Additionally, Monday Hero also lets you select and generate 3 attributes of this component: Text: The initial text displayed by the text field. You can specify the text as a plain string or as an attributed string. Hint: A hint is a text displayed by the EditText when the string is empty. Typing any text into the text field hides this string. Left icon: You can add an icon to the left side of the EditText.

Generated iOS/Android code

Let's see the code that generated for the e-mail textField.

//SignInViewController.swift
import UIKit

class SignInViewController: UIViewController {

//Connection from an Interface Builder to a UI component
@IBOutlet private weak var emailTextField: UITextField!

	override func viewDidLoad() {
		super.viewDidLoad()
		setupViews()
	}
}

extension SignInViewController {
	private func setupViews() {
	
		//TextField properties
		emailTextField.layer.borderColor = UIColor.salt.cgColor
		emailTextField.layer.borderWidth =  1
		emailTextField.layer.cornerRadius = 21.5
		emailTextField.layer.masksToBounds =  true 
		emailTextField.backgroundColor = UIColor.daisy
		emailTextField.placeholder = NSLocalizedString("email", comment: "")
		emailTextField.textColor = UIColor.indigo
		emailTextField.font = UIFont.textStyle5
		emailTextField.textAlignment = .left 
		emailTextField.setLeftView(leftViewFrame : CGRect(x: 0, y: 0, width: 22, height: 43))
	
	}		
}

Let's see the generated code for EditText. You can also see the layout constraints.

!--activityLogin.xml-->
<EditText
	android:id="@+id/email"
	android:layout_width="0dp"
	android:layout_height="wrap_content"
	android:background="@drawable/email_background_drawable"
	style="@style/textStyle"
	android:text="@string/email"
	android:gravity="left|center"
	android:textColor="?attr/indigo"
	android:textColorHint="?attr/indigo"
	android:paddingLeft="22dp"
	android:paddingRight="22dp"
	android:layout_marginStart="39dp"
	android:layout_marginEnd="38dp"
	android:layout_marginBottom="21dp"
	app:layout_constraintStart_toStartOf="parent"
	app:layout_constraintEnd_toEndOf="parent"
	app:layout_constraintTop_toBottomOf="@+id/halfBackground"
	app:layout_constraintBottom_toTopOf="@+id/password"/>
<!--Drawables/email_background_drawable.xml-->
<selector xmlns:android="http://schemas.android.com/apk/res/android">
  <item>
    <shape android:shape="rectangle">
      <solid android:color="?attr/daisy"/>
      <stroke android:width="1dp" android:color="?attr/salt"/>
      <corners android:radius="21dp"/>
    </shape>
  </item>
</selector>

You can do further edit/configurations in your IDE after you export it.

⚠️This feature is available in only Mac App. Web App support for Android is coming soon. If you need to install the desktop app,

⚠️This feature is available in only Mac App. Web App support for Android is coming soon. If you need to install the desktop app,

click here.
click here.
TextField component example.