s-private API Documentation - v3.8.1
    Preparing search index...

    Function FormDropdownInput

    • A searchable dropdown input component for forms.

      Parameters

      • props: Props

        Dropdown configuration including options and labels

      Returns Element

      A searchable dropdown field with hidden input for form submission

      Combines Popover and Command components for a combobox experience. Supports:

      • Searchable options
      • Custom value entry
      • Form state preservation via GenericFormWrapper
      • Keyboard navigation

      State Management Note: This component uses local state for the selected value because:

      1. The FormValuesContext is read-only (used for restoring values after form errors)
      2. User selections need immediate UI feedback
      3. The hidden input submits the current value to the form

      The prevPreservedValue pattern syncs context changes (e.g., after form error) to local state during render, following React's recommended approach for "adjusting state when props change".

      <FormDropdownInput
      label="Category"
      htmlFor="category"
      name="category"
      options={[
      { id: "1", name: "Technology" },
      { id: "2", name: "Business" },
      ]}
      placeholder="Select a category"
      />

      GenericFormWrapper for form integration