Last modified: August 22, 2025
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.
design-guidelines-select-input
  1. Label: the label that describes the field’s purpose.
  2. Value: the field’s selected value.
import { Select } from '@hubspot/ui-extensions';

const Extension = () => {
  const [name, setName] = useState(null);
  const [validationMessage, setValidationMessage] = useState('');
  const [isValid, setIsValid] = useState(true);

  const options = [
    { label: 'Bill', value: 42 },
    { label: 'Ted', value: 43 },
  ];

  return (
    <Form>
      <Select
        label="Best Bill & Ted Character?"
        name="best-char"
        tooltip="Please choose"
        description="Please choose"
        placeholder="Bill or Ted?"
        required={true}
        error={!isValid}
        validationMessage={validationMessage}
        onChange={(value) => {
          setName(value);
          if (!value) {
            setValidationMessage('This is required');
            setIsValid(false);
          } else {
            setValidationMessage('Excellent!');
            setIsValid(true);
          }
        }}
        options={options}
      />
    </Form>
  );
};
PropTypeDescription
nameStringThe input’s unique identifier.
labelStringThe text that displays above the input.
optionsArrayThe 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.
valueString | number | booleanThe value of the input.
variantinput (default) | transparentThe visual style of the button
requiredBooleanWhen set to true, displays a required field indicator. Default is false.
readOnlyBooleanWhen set to true, users will not be able to fill the input field. Default is false.
tooltipStringThe text that displays in a tooltip next to the label.
descriptionStringText that describes the field’s purpose.
errorBooleanWhen 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.
validationMessageStringThe text to display if the input has an error.
onChange(value: string) => voidA callback function that is invoked when the value is committed.
onInput(value: string) => voidA callback function that is called and passed the value every time the search field is edited by the user. Prefer updating state in onChange as it fires less frequently, and if you need to update state here, consider debouncing your function.

Variants

Using the variant prop, you can set the input to be one of two styles:
  • input (default): a standard dropdown menu.
ui-extension-components-input-select-input-variant
  • transparent: a hyperlink dropdown menu.
ui-extension-components-input-select-transparent-variant

Usage examples

Use this type of field when there are a range of set options to choose from, such as:
  • A list of products that can be purchased.
  • A list of office locations to ship to.
  • A list of delivery options for a vendor.

Guidelines

  • 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.