# Field URL: /components/field Source: https://github.com/daangn/seed-design/blob/dev/docs/content/components/field.mdx A container component for receiving a value from the user, providing consistent label, helper text, error notation, and status feedback. ## Anatomy ![Anatomy image of Field. Consists of three areas: Header, Input, and Footer.]() Field consists of three areas: Header, Input, and Footer. - The Header includes a Label, a Requirement Mark, and a Sub Action in the Suffix Slot if needed. - Input is the area where the actual input UI is placed, such as [Text Input](/components/text-input), [Textarea](/components/text-input#textarea), and [Input Button](/components/input-button). - The Footer provides supplementary information via Helper Text, Error Message, and Character Count. ## Properties ### Header Property ![Field Header Property - Label Weight, Requirement Mark, Suffix Slot]() Label is provided in two weights: Medium and Bold. Write the Label text as a noun phrase without a period, and it is best expressed on a single line. Use up to a maximum of two lines only when necessary. Whether input is required can be indicated to the right of the Label. Required values are shown with a Requirement Mark, and optional values with Text. The Suffix Slot is positioned to the right of the Label, providing a supplementary action function via a Ghost Button or Icon. ### Input Slot ![Field Input Slot - the area where various Input components can be placed]() Various Input components that receive the actual value can be placed in the Input Slot. The Input components provided by Crispy are as follows, and they are provided in combination as Templates. A Field including Text Input A Field including Textarea A Field including Checkbox Group A Field including Radio Group A Field including Select Box Group A Field including Select A Field including Slider A Field including Input Button If a special format or feature such as masking is needed, the format and behavior can be defined directly for use. ### Footer Property ![Field Footer Property - Helper Text, Error Message, Character Count]() Helper Text and Error Message are positioned on the left of the Footer, and Character Count can be shown on the right. When Error Message and Helper Text exist at the same time, only the Error Message is shown. Write the message concisely, in an instructional form. (e.g. "Please enter a 10-11 digit phone number") Character Count is shown in the Neutral color when a value exists. Use it only when there is a limit on the input length. ## Guidelines ### Form structure ![Form components - Input, Field, Fieldset, Form]() To use the Field component, you must first understand the basic structure of a Form. A Form is a structure for receiving input values from a user, largely composed of four elements. - **Input**: The element responsible for the actual input in the UI. - **Field**: An element that bundles Header, Input, and Footer together. - **Fieldset**: A container that groups multiple Fields into one section. - **Form**: A container that submits and validates the values of input elements such as Input, Field, and Fieldset. ### Submit and Validation A Form goes through a process of validating whether the value entered in the Input is valid and submitting the value. There are generally two methods of validation, and they can be mixed depending on the situation. For simple validation such as required values or character count checks, use the inline method; for business logic or server rules, apply validation on submit. For fields with a high risk of mis-entry, such as security or financial information, inline validation that provides immediate feedback is recommended. #### Validation on Submit ![Example of validation on submit]() Validation proceeds when the Submit button is clicked. The Submit button can be enabled depending on whether conditions are met, or it can always remain enabled. By default, the full validation-on-submit method is used. #### Inline validation ![Example of inline validation]() Validation proceeds at the Field level. The input value is validated whenever focus leaves the Input element (blur) or the value changes (change/update). Used when there are many fields on a screen and error accumulation needs to be prevented. ### Notice on leaving the page ![Example of a leave-notice dialog being shown]() If the user tries to leave again after entering a write or edit screen, a warning notice that the entered values may be lost must be shown via [Alert Dialog](/components/alert-dialog) or similar. ![Example where a leave-notice dialog is unnecessary: when there is no change to the value, when auto-save is used]() The notice can be omitted when there is no change to the value or when there is an auto-save feature. ### Indicating whether input is required ![Indicating required input - example of using a Requirement Mark]() If 2/3 or more of the fields on a screen are required, show only "Optional" (for the optional ones); otherwise, use only '\*'. Do not mix the two notations within a single Form. ### Composing a Form on a single screen ![Example of composing a Form on a single screen]() A UX pattern that can be used when creating or editing an entity. The Form must be composed so as to enter or edit the entity's data. The Create Form and the Update Form should maintain the same composition where possible. ### Composing a step-by-step Form ![Example of composing a step-by-step Form]() A UX pattern that can be used when additional data entry or editing is needed based on the option selected in a previous step. It can also be used when a mobile screen becomes complex with multiple Forms and Inputs. Depending on the situation or the flow being composed, this can be mixed with a single-screen Form. ## Specification ### Field Component spec (JSON): /rootage/components/field.json ### Field Label Component spec (JSON): /rootage/components/field-label.json