Select | UI components (BETA)
The Select
component renders a dropdown menu select field where a user can select a single value. A search bar will be automatically included when there are more than seven options.
- Label: the label that describes the field's purpose.
- Value: the field's selected value.
Prop | Type | Description |
---|---|---|
name |
String | The input's unique identifier. |
label |
String | The text that displays above the input. |
options Required |
Array | The options to display in the dropdown menu. label will be used as the display text, and value should be the option's unique identifier, which is submitted with the form. |
value |
String | number | boolean | The value of the input. |
variant |
input (default) | transparent |
The visual style of the button |
required |
Boolean | When set to true , displays a required field indicator. Default is false . |
readOnly |
Boolean | When set to true , users will not be able to fill the input field. Default is false . |
tooltip |
String | The text that displays in a tooltip next to the label. |
description |
String | Text that describes the field's purpose. |
error |
Boolean | When set to true , validationMessage is displayed as an error message if provided. The input will also render its error state to let the user know there's an error. If left false (default), validationMessage is displayed as a success message. |
validationMessage |
String | The text to display if the input has an error. |
onChange |
(value: string) => void | A callback function that is invoked when the value is committed. |
- DO: make label and description text concise and clear.
- DO: indicate if a field is required.
- DO: include clear validation error messages so that users know how to fix errors.
- DO: include placeholder text to help users understand what's expected in the field.
- DON'T: use this component when you want users to be able to select multiple options. For multiple options, use the MultiSelect component.
- DON'T: use placeholder text for critical information, as it will disappear once users begin to type. Critical information should be placed in the label and descriptive text, with additional context in the tooltip if needed.
Thank you for your feedback, it means a lot to us.
This form is used for documentation feedback only. Learn how to get help with HubSpot.