Select component in UIKit2 only works as a child of Form component

I’m attempting to use Select component as the example shown in the documentation, i.e., without being a child of the Form component and using onChange function to capture the selected value.

In this case, the drop down doesn’t work and the field behaves like a text field showing the value of the defaultSelected option.

Once I wrap the Select component with a Form, it then works as expected.

Would it be possible to use Select without Form? My intended use case is to use Select/Options to change the rowsPerPage parameter of a Table component.

The problem is found with `@forge/react@9.2.0. I don’t know if this is a regression of some sort or it’s work as intended - I haven’t tested with other versions of the package.

1 Like

Hi,

This works for me, using UI Kit 2, and without a component:

      <Select
        label="Search in Project Roles"
        name="filterPRDRole"
        onChange={(s) => { setFilterPRDRole(s.value); }}
      >
        <Option defaultSelected label="All" value="" />
        {roles.map((role) => (
          <Option label={role.name} value={role.id} />
        ))}
      </Select>

I have updated @forge/react, using 9.2.0.

3 Likes