Components
Textfield
Used to enter spesific text input form
Component Status Details
Status component contains a list of checks and completeness that has been tested and owned by each component
Usage
Textfield are used to defines a text input control.
Use Legion Textfield styles allow users to type text into an app, with support lots type and attribute to customize.
Usage With Theme
Available themes: ThemeAGR, ThemeMyTEnS, ThemeIHS & ThemeEazy
Outline
@State var text: String = ""LGNOutlineTextField(text: $text)
Inline
@State var text: String = ""LGNInlineTextField(text: $text)
Usage Without Theme
Outline
@State var text: String = ""OutlineTxtField(text: $text)
Inline
@State var text: String = ""InlineTxtField(text: $text)
Outline
Outline State
Idle
![](https://legion-legion-ui-images-public-stage.oss-ap-southeast-5.aliyuncs.com/legion/component/textfield/ios-textfield-outline-idle.png)
@State var text: String = ""LGNOutlineTextField(titleKey: "Placeholder"text: $text).state(.idle)
Error
![](https://legion-legion-ui-images-public-stage.oss-ap-southeast-5.aliyuncs.com/legion/component/textfield/ios-textfield-outline-error.png)
@State var text: String = ""LGNOutlineTextField(titleKey: "Placeholder"text: $text).state(.error)
Success
![](https://legion-legion-ui-images-public-stage.oss-ap-southeast-5.aliyuncs.com/legion/component/textfield/ios-textfield-outline-success.png)
@State var text: String = ""LGNOutlineTextField(titleKey: "Placeholder"text: $text).state(.success)
Disabled
![](https://legion-legion-ui-images-public-stage.oss-ap-southeast-5.aliyuncs.com/legion/component/textfield/ios-textfield-outline-disabled.png)
@State var text: String = ""LGNOutlineTextField(titleKey: "Placeholder"text: $text).state(.disable)
Outline Left Icon
![](https://legion-legion-ui-images-public-stage.oss-ap-southeast-5.aliyuncs.com/legion/component/textfield/ios-textfield-outline-left-icon.png)
@State var text: String = ""LGNOutlineTextField(titleKey: "Placeholder"text: $text,leftIcon: Image(systemName: "info.circle"))
Outline Secure Text
![](https://legion-legion-ui-images-public-stage.oss-ap-southeast-5.aliyuncs.com/legion/component/textfield/ios-textfield-outline-secure-text.png)
@State var text: String = ""@State var isSecured: Bool = trueLGNOutlineTextField(titleKey: "Placeholder",text: $text).setSecured($isSecured)
Outline Label Title
![](https://legion-legion-ui-images-public-stage.oss-ap-southeast-5.aliyuncs.com/legion/component/textfield/ios-textfield-outline-label-title.png)
@State var text: String = ""LGNOutlineTextField(titleKey: "Placeholder",text: $text,label: "title")
Outline Caption
Caption with Image
![](https://legion-legion-ui-images-public-stage.oss-ap-southeast-5.aliyuncs.com/legion/component/textfield/ios-textfield-outline-caption-with-image.png)
@State var text: String = ""LGNOutlineTextField(titleKey: "Placeholder",text: $text).showCaption(caption: ContentModel(image: Image(systemName: "exclamationmark.triangle"),text: "caption"
Caption without Image
![](https://legion-legion-ui-images-public-stage.oss-ap-southeast-5.aliyuncs.com/legion/component/textfield/ios-textfield-outline-caption.png)
@State var text: String = ""LGNOutlineTextField(titleKey: "Placeholder",text: $text).showCaption(caption: ContentModel(text: "caption"),showCaption: true)
Outline Prefix
Prefix with Image
![](https://legion-legion-ui-images-public-stage.oss-ap-southeast-5.aliyuncs.com/legion/component/textfield/ios-textfield-outline-prefix-with-image.png)
@State var text: String = ""LGNOutlineTextField(titleKey: "Placeholder",text: $text,prefix: ContentModel(image: Image(systemName: "chevron.right"),text: "prefix"))
Prefix without Image
![](https://legion-legion-ui-images-public-stage.oss-ap-southeast-5.aliyuncs.com/legion/component/textfield/ios-textfield-outline-prefix.png)
@State var text: String = ""LGNOutlineTextField(titleKey: "Placeholder",text: $text,prefix: ContentModel(text: "prefix"))
Outline Suffix
Suffix with Image
![](https://legion-legion-ui-images-public-stage.oss-ap-southeast-5.aliyuncs.com/legion/component/textfield/ios-textfield-outline-suffix-with-image.png)
@State var text: String = ""LGNOutlineTextField(titleKey: "Placeholder",text: $text,suffix: ContentModel(image: Image(systemName: "chevron.right"),text: "suffix"))
Suffix without Image
![](https://legion-legion-ui-images-public-stage.oss-ap-southeast-5.aliyuncs.com/legion/component/textfield/ios-textfield-outline-suffix.png)
@State var text: String = ""LGNOutlineTextField(titleKey: "Placeholder",text: $text,suffix: ContentModel(text: "suffix"))
Outline Hint Text
Hint and Caption
![](https://legion-legion-ui-images-public-stage.oss-ap-southeast-5.aliyuncs.com/legion/component/textfield/ios-textfield-outline-hint-caption.png)
@State var text: String = ""LGNOutlineTextField(titleKey: "Placeholder",text: $text).showCaption(caption: ContentModel(text: "Caption",hintText: "Hint Text"
Hint only
![](https://legion-legion-ui-images-public-stage.oss-ap-southeast-5.aliyuncs.com/legion/component/textfield/ios-textfield-outline-hint.png)
@State var text: String = ""LGNOutlineTextField(titleKey: "Placeholder",text: $text).showCaption(caption: ContentModel(text: "Caption",hintText: "Hint Text"
Inline
Inline State
Idle
![](https://legion-legion-ui-images-public-stage.oss-ap-southeast-5.aliyuncs.com/legion/component/textfield/ios-textfield-inline-idle.png)
@State var text: String = ""LGNInlineTextField(titleKey: "Placeholder"text: $text).state(.idle)
Error
![](https://legion-legion-ui-images-public-stage.oss-ap-southeast-5.aliyuncs.com/legion/component/textfield/ios-textfield-inline-error.png)
@State var text: String = ""LGNInlineTextField(titleKey: "Placeholder"text: $text)
Success
![](https://legion-legion-ui-images-public-stage.oss-ap-southeast-5.aliyuncs.com/legion/component/textfield/ios-textfield-inline-success.png)
@State var text: String = ""LGNInlineTextField(titleKey: "Placeholder"text: $text).state(.success)
Disabled
![](https://legion-legion-ui-images-public-stage.oss-ap-southeast-5.aliyuncs.com/legion/component/textfield/ios-textfield-inline-disabled.png)
@State var text: String = ""LGNInlineTextField(titleKey: "Placeholder"text: $text).state(.disable)
Inline Left Icon
![](https://legion-legion-ui-images-public-stage.oss-ap-southeast-5.aliyuncs.com/legion/component/textfield/ios-textfield-inline-left-icon.png)
@State var text: String = ""LGNInlineTextField(titleKey: "Placeholder"text: $text,leftIcon: Image(systemName: "info.circle"))
Inline Secure Text
![](https://legion-legion-ui-images-public-stage.oss-ap-southeast-5.aliyuncs.com/legion/component/textfield/ios-textfield-inline-secure-text.png)
@State var text: String = ""@State var isSecured: Bool = trueLGNInlineTextField(titleKey: "Placeholder",text: $text).setSecured($isSecured)
Inline Label Title
![](https://legion-legion-ui-images-public-stage.oss-ap-southeast-5.aliyuncs.com/legion/component/textfield/ios-textfield-inline-label-title.png)
@State var text: String = ""LGNInlineTextField(titleKey: "Placeholder",text: $text,label: "title")
Inline Caption
Caption with Image
![](https://legion-legion-ui-images-public-stage.oss-ap-southeast-5.aliyuncs.com/legion/component/textfield/ios-textfield-inline-caption-with-image.png)
@State var text: String = ""LGNInlineTextField(titleKey: "Placeholder",text: $text).showCaption(caption: ContentModel(image: Image(systemName: "exclamationmark.triangle"),text: "caption"
Caption without Image
![](https://legion-legion-ui-images-public-stage.oss-ap-southeast-5.aliyuncs.com/legion/component/textfield/ios-textfield-inline-caption.png)
@State var text: String = ""LGNInlineTextField(titleKey: "Placeholder",text: $text).showCaption(caption: ContentModel(text: "caption"),showCaption: true)
Inline Prefix
Prefix with Image
![](https://legion-legion-ui-images-public-stage.oss-ap-southeast-5.aliyuncs.com/legion/component/textfield/ios-textfield-inline-prefix-with-image.png)
@State var text: String = ""LGNInlineTextField(titleKey: "Placeholder",text: $text,prefix: ContentModel(image: Image(systemName: "chevron.right"),text: "prefix"))
Prefix without Image
![](https://legion-legion-ui-images-public-stage.oss-ap-southeast-5.aliyuncs.com/legion/component/textfield/ios-textfield-inline-prefix.png)
@State var text: String = ""LGNInlineTextField(titleKey: "Placeholder",text: $text,prefix: ContentModel(text: "prefix"))
Inline Suffix
Suffix with Image
![](https://legion-legion-ui-images-public-stage.oss-ap-southeast-5.aliyuncs.com/legion/component/textfield/ios-textfield-inline-suffix-with-image.png)
@State var text: String = ""LGNInlineTextField(titleKey: "Placeholder",text: $text,suffix: ContentModel(image: Image(systemName: "chevron.right"),text: "suffix"))
Suffix without Image
![](https://legion-legion-ui-images-public-stage.oss-ap-southeast-5.aliyuncs.com/legion/component/textfield/ios-textfield-inline-suffix.png)
@State var text: String = ""LGNInlineTextField(titleKey: "Placeholder",text: $text,suffix: ContentModel(text: "suffix"))
Inline Hint Text
Hint and Caption
![](https://legion-legion-ui-images-public-stage.oss-ap-southeast-5.aliyuncs.com/legion/component/textfield/ios-textfield-inline-hint-caption.png)
@State var text: String = ""LGNInlineTextField(titleKey: "Placeholder",text: $text).showCaption(caption: ContentModel(text: "Caption",hintText: "Hint Text"
Hint only
![](https://legion-legion-ui-images-public-stage.oss-ap-southeast-5.aliyuncs.com/legion/component/textfield/ios-textfield-inline-hint.png)
@State var text: String = ""LGNInlineTextField(titleKey: "Placeholder",text: $text).showCaption(caption: ContentModel(text: "Caption",hintText: "Hint Text"
Properties
Properties | Description | Default Value |
---|---|---|
titleKey | The key for the localized title of the text field, describing its purpose, default value is empty string | empty string "" |
text | The text to display and edit | not have |
label | The label to represent the title of the text field, default value is nil | nil (literal null value for objective-C classes) |
leftIcon | The icon is on the left of the text | nil (literal null value for objective-C classes) |
prefix | To show prefix content with position left side in text field | nil (literal null value for objective-C classes) |
sufix | To show suffix content with position right side in text field | nil (literal null value for objective-C classes) |
defaultBorderColor | The color will appear on the border of the text field, default value is Color tertiary300 | Color.tertiary300 |
errorBorderColor | The color will appear on the border of the text field on the error state, default value is Color error500 | Color.error500 |
successBorderColor | The color will appear on the border of the text field on the success state, default value is Color success500 | Color.success500 |