# Select URL: /components/select Source: https://github.com/daangn/seed-design/blob/dev/docs/content/components/select.mdx A component used to select a value from a list of options to submit to a Form. Select can be used within a Field component to be used as a Select Field. ## Anatomy ![Select Anatomy image. Composed of Trigger, Content, Item, Group, and Divider.]() Select consists of two parts: Trigger and Content. Items are placed within Content, and related Items are grouped together using Group. Dividers are displayed between Groups. - **Trigger**: Displays the currently selected value or Placeholder. Pressing it opens the Content. A Chevron indicating whether the Content is open is displayed in the Suffix Icon. Prefix Icon is optional. - **Content**: A panel displayed following the Trigger that displays the list of options. Its width aligns with the Trigger. - **Item**: A single option within Content. Content is expressed through Item Label, Item Description, and Prefix Icon, and the selection state is indicated by an Indicator. - **Group**: A unit that groups related Items within Content. A title can be attached using Group Label. - **Divider**: A separator line automatically displayed between Groups. Not displayed between Items. In this document, **option** refers to the choice itself to be placed in the list, **Item** refers to the UI element that renders that option in Content, and **selected value** refers to the data that the user chose and submitted to the Form. ## Properties ### Size ![Select Size Property - Large, Medium]() Select provides two sizes: Large and Medium. - **Large**: Can be used on both mobile and desktop. - **Medium**: Used only on Breakpoint `lg` and above (desktop). Choose this when you want to use a smaller Select in a mouse-driven environment where precise selection is possible. #### Responsive ![Example of Select switching between Large and Medium based on Breakpoint]() You can switch the Size of Select based on Breakpoint. Use Medium for `lg` and above, and Large below `lg`, so the same Form works naturally on both mobile and desktop. ### State Select's state is divided by whether Content is open, and by the States of Trigger and Item respectively. When Content opens, the Chevron displayed in the Trigger's Suffix Icon rotates 180°. #### Trigger State ![Select Trigger State - Enabled, Pressed, Error, Error Pressed, Disabled, Read Only]() - **Enabled**: The default state. Users can select. - **Pressed**: The state while the Trigger is being pressed. - **Error**: The state when Form validation fails. The Trigger border is emphasized with Critical Tone. - **Error Pressed**: The state while the Trigger is being pressed in Error state. - **Disabled**: The inactive state. Users cannot interact with it. - **Read Only**: A state where value is displayed but cannot be changed. #### Item State ![Select Item State - Enabled, Pressed, Selected, Disabled]() - **Enabled**: The default state. - **Pressed**: The state while the Item is being pressed. - **Selected**: The currently selected Item. A Checkmark is displayed in the Indicator. - **Disabled**: The inactive state. Cannot be selected. ### Selection Mode Select defaults to single selection where only one value is chosen, and also supports multiple selection where multiple values are chosen. - **Single Selection**: Maintains only one selected value. Selecting an already chosen option does not deselect it and the value remains unchanged. - **Multiple Selection**: Maintains multiple selected values. Selecting an already chosen option deselects it. Since single selection cannot be deselected, if "none" can be an answer for a field, that answer must be represented as an option in the list. See [Receiving "none" as an answer in single selection](#receiving-none-as-an-answer-in-single-selection). ### Has Prefix Icon ![Select Has Prefix Icon Property - Example of applying Prefix Icon to Trigger and Item]() Prefix Icon can be displayed on the left side of both Trigger and Item respectively. Trigger's Prefix Icon is used when you want to indicate with an icon what kind of value is being selected. The Prefix Icon actually displayed in the Trigger is determined by the number of selected values. - **1 Selection**: The Prefix Icon of the selected Item is displayed in the Trigger. It overrides any Prefix Icon specified for the Trigger. If the selected Item has no Prefix Icon, the Prefix Icon specified for the Trigger is displayed as is. - **2 or More Selections**: Applies only in multiple selection, and the Prefix Icon specified for the Trigger is displayed regardless of the Prefix Icon of the selected Items. If no Prefix Icon is determined to be displayed in either case, the Trigger is displayed without a Prefix Icon. ### Interaction ![Example of toggling Content display by pressing Trigger, and closing Content by pressing outside]() ![Example of Content closing when an Item is selected]() - **When Trigger is pressed**: Content is displayed below the Trigger. If there is not enough space at the bottom of the screen, it automatically switches to the top. - **When Content opens**: Even if the selected Item is below the Content, it opens in a scrolled state where the Item is visible. - **When Item is pressed**: The selected value is displayed in the Trigger. In single selection, the Content closes, and in multiple selection, it remains open so you can continue selecting multiple values. - **When outside Content is pressed**: The Content closes. Any previously selected values remain unchanged. ### Content Height The height of Content is determined as the smaller of the maximum 480px and the remaining screen space around the Trigger, and if there are more options, they scroll within the Content. Select with many options is designed assuming a state where scrolling occurs within the Content. ## Guidelines ### Using with Field Label Select is always used with [Field](/components/field) Label. Without Field Label, it is impossible to know what the selected value means after selection. Field Label cannot be replaced by Trigger's Placeholder. Placeholder disappears when a value is selected. ### Receiving "none" as an answer in single selection In single selection Select, selecting an already chosen option does not deselect it. Therefore, if "none" can be one answer for a field, that answer must be represented as an option in the list. Such an option is referred to as a **"none" option** below. There are three types depending on the nature of the field. - **Fields where "none" can be an answer**: Include a "none" option in the list. - **Fields where one must be selected**: Do not include a "none" option, and make it impossible to submit without selecting something. (Example: country code for phone number) - **Fields where an unselected state cannot exist**: Do not include a "none" option and pre-select a default value. (Example: sort criteria) Selecting a "none" option is treated as selecting a value. The Item Label is displayed in the Trigger, and validation passes even for required fields. Including a "none" option in a required field allows you to distinguish whether the user skipped the question or answered that there is none. The Item Label for "none" option should contain the core of the question as is. For example, in a Select with Field Label "preferred airline meal," write "no preferred airline meal" instead of "not applicable." Since this option has a different nature from others, place it in a separate Group at the beginning or end of the list. ### Using multiple selection In multiple selection, selecting an already chosen option deselects it, so there is no need for a separate option to undo selection. However, since constraints on multiple selection are not apparent on screen, follow these guidelines. - **Guide the number of selections possible**: It is difficult to know how many options can be selected just from the appearance of Select. Explicitly state in Field's Helper Text like "Select up to 3." - **Indicate if required**: For required fields that must have at least one selection, use Field's Requirement Mark and similar methods. In this case, Form submission should fail if nothing is selected, and Field's Error Message should guide that a required response is needed. - **Do not include options that change the selection state of other options**: Actions like "select all" or "none" that deselect the rest are unpredictable. - If "select all" is frequently used in a field, utilize [parent-child Checkbox](/components/checkbox#using-checkbox-group). - If you need to distinguish between "answered with nothing" and "answered no," consider placing a separate input element beforehand. For example, first show a Checkbox with Label "has defects," and only expose multiple selection Select with Field Label "type of defects" when checked. See [Receiving "none" as an answer in single selection](#receiving-none-as-an-answer-in-single-selection) for how to handle the same issue in single selection. ### Displaying selected values in multiple selection Since Trigger is a single line, if the combined length of selected values exceeds the Trigger width, the trailing values are truncated with ellipsis. As selections increase or Item Labels get longer, it becomes difficult to even know how many were selected, so we distinguish between cases where all selected values can be shown and cases where they cannot. #### When all selected values can be displayed Join selected values with separators. Since separators and conjunctions differ by language, do not specify characters directly but follow [CLDR](https://cldr.unicode.org/)'s [List Patterns](https://unicode.org/reports/tr35/tr35-general.html#ListPatterns). Trigger shows what was selected. Since the relationship between selected values differs by field, use only separators or include conjunctions based on that relationship. - **Using only separators**: For Form fields where values are submitted as is, there is no combining relationship between values, so separators alone are sufficient. - **Revealing relationship with conjunctions**: If selected values are combined as conditions and the result differs, use conjunctions to reveal how values combine. | Language | Either one applies | Both apply | | -------- | ------------------ | ------------ | | Korean | Red or Blue | Red and Blue | | English | Red or Blue | Red and Blue | The degree to which conjunctions reveal combining methods differs by language. Some languages use the same conjunction in both cases or use no conjunction at all. Therefore, do not convey the combining method only through conjunctions, but also explain how values combine in Field's Helper Text. #### When not all selected values can be displayed Summarize selected values by count. Choose one of two forms that fits the nature of the list. - **Representative value and remaining count**: Keep the first selected value and show the count of remaining values. If you selected three and show the first one, the displayed number is 2. Since a clue remains about what was selected, this suits lists where each value has a distinct meaning. - **Total count**: Do not show values, only the total count selected. Suits lists where values are equivalent and showing one doesn't help, or lists too narrow to display the representative value. | Language | Representative and remaining | Total count | | -------- | ---------------------------- | ----------- | | Korean | Location and 2 others | 3 selected | | English | Gangnam-gu and 2 others | 3 selected | This summary form is not covered by CLDR List Patterns. Number notation follows grammar by language. Korean uses different units depending on what is being counted, and English may use different words for singular and plural based on count. See the "Order of numbers and units" section in [International Design](/foundations/international-design). - **Korean**: Particle usage differs - one particle means count minus the preceding item, while another means total count including the preceding item. Using the wrong particle can communicate incorrect information. - **English**: Notation using symbols like "+2" to abbreviate can be used, but is not applicable to all languages. ### Determining option order Arrange the list order to match the flow in which users scan options. Choose one criterion that the list already has, such as usage frequency, size, or time, and sort consistently. Options with different nature or sorting criteria from others should be grouped with Group to reveal boundaries. ### Writing Item Label Write Item Label in noun form so users can distinguish at a glance, maintaining consistent vocabulary, length, and tone between Items. Item Label does not break or wrap in Content but displays as a single line in Trigger where it truncates with ellipsis if it exceeds width. Since Item Label may be truncated in Trigger even if fully visible in Content, confirm that intended Item Label displays without ellipsis at Trigger width. If Item Label does not fit on one line, prioritize shortening the Item Label itself. If supplementary explanation is needed, write it in Item Description. Item Description is not displayed in Trigger. ### Writing Placeholder The Placeholder displayed in Trigger when no value is selected should be written to make clear at a glance what kind of value to select. If Field has a Label, do not simply repeat that Label in the Placeholder. ## Choosing selection component ![Example comparing Radio/Checkbox and Select usage in timezone selection screen]() ![Example comparing Select Box and Chip usage]() Choose the component based on the amount of information needed per option, number of options, and Item Label length. Judge in the following order. 1. **If each option needs rich information like images, multi-line descriptions, or footer layout**, use [Select Box](/components/select-box). Always expanded in card form, allowing side-by-side comparison and selection of options. 2. **If there are 5 or more options, or a single-line Item Description is sufficient**, use Select. You can save space by collapsing the list and structure it by grouping with Group. 3. **If there are 2-4 options and Item Description is not needed**, divide by Item Label length. - If short, use [Chip](/components/chip). List horizontally for light selection. - If long, use [Radio Group](/components/radio) or [Checkbox](/components/checkbox). All options are visible at once for quick selection. See [Radio vs. Checkbox vs. Chip Group](/components/radio#radio-vs-checkbox-vs-chip-group) for detailed criteria between the three. If there are too many options and navigation by scrolling alone is difficult, consider a search-based selection (Combobox) pattern. Crispy does not yet provide Combobox. ## Select vs. Menu ![Example comparing Menu and Select]() [Menu](/components/menu) is a command list that executes actions, while Select is an input element that chooses a value to submit to a Form. | | Select | Menu | | ------------------------- | ---------------------------------------------- | ----------------------------------------- | | **Purpose** | Choosing a value to submit to Form | Executing an action | | **Timing of application** | Reflected after selection, save, or submission | Executed immediately when Item is pressed | | **Field combination** | Used with Field as Select Field | No Field combination | ## Specification ### Select Component spec (JSON): /rootage/components/select.json ### Select Trigger Component spec (JSON): /rootage/components/select-trigger.json ### Select Item Component spec (JSON): /rootage/components/select-item.json