# SelectV2

**URL:** <https://community.dynatrace.com/t/selectv2/46367>\
**Category:** Developer Q&A Forum\
**Tags:** dynatrace-app-toolkit, strato, custom-app\
**Created:** [June 28, 2024, 10:40am UTC](https://community.dynatrace.com/t/selectv2/46367 "2024-06-28T10:40:35Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![veranika\_k](https://avatars.discourse-cdn.com/v4/letter/v/22d042/32.png) [@veranika\_k](https://community.dynatrace.com/u/veranika_k)\
**Post date:** [June 28, 2024, 10:40am UTC](https://community.dynatrace.com/t/selectv2/46367/1 "2024-06-28T10:40:35Z")

</div>

Hi! Is it possible to combine clearable props with the setting state? It seems that pressing “clear selection” does not affect the state.&nbsp;  
[https://developer.dynatrace.com/reference/design-system/preview/forms/SelectV2/#control-the-state](https://developer.dynatrace.com/reference/design-system/preview/forms/SelectV2/#control-the-state)

---

<div class="post-metadata">

**Author:** ![educampver](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/educampver/32/29917_2.png) [@educampver](https://community.dynatrace.com/u/educampver)\
**Post date:** [June 28, 2024, 1:04pm UTC](https://community.dynatrace.com/t/selectv2/46367/2 "2024-06-28T13:04:01Z")

</div>

hi&nbsp;[@veranika\_k](https://community.dynatrace.com/user/67240), what version of Strato are you using? I just tried the latest (0.114.3) and it works as expected (sets the value to null when the selection is cleared). Here’s the code I used:

```javascript
export const App = () => {
  const [singleValue, setSingleValue] = useState<string | null>(null);

  useEffect(() => {
    console.log(singleValue); // logs the selected option or null
  }, [singleValue]);

  return (
    <FormField>
      <Label>Select a country</Label>
      <SelectV2
        clearable
        name="country-selectV2"
        value={singleValue}
        onChange={setSingleValue}
      >
        <SelectV2.Content>
          <SelectV2.Option value="austria">Austria</SelectV2.Option>
          <SelectV2.Option value="germany">Germany</SelectV2.Option>
          <SelectV2.Option value="italy">Italy</SelectV2.Option>
          <SelectV2.Option value="spain">Spain</SelectV2.Option>
        </SelectV2.Content>
      </SelectV2>
    </FormField>
  );
};

```

Hope this helps.

---

<div class="post-metadata">

**Author:** ![veranika\_k](https://avatars.discourse-cdn.com/v4/letter/v/22d042/32.png) [@veranika\_k](https://community.dynatrace.com/u/veranika_k)\
**Post date:** [June 28, 2024, 3:08pm UTC](https://community.dynatrace.com/t/selectv2/46367/3 "2024-06-28T15:08:23Z")

</div>

I am using -&nbsp;0.111.7 - so I will check with the latter version and let you know! Thank you!

---

<div class="post-metadata">

**Author:** ![PennyScully](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/pennyscully/32/32029_2.png) [@PennyScully](https://community.dynatrace.com/u/PennyScully)\
**Post date:** [July 2, 2024, 6:31am UTC](https://community.dynatrace.com/t/selectv2/46367/4 "2024-07-02T06:31:56Z")

</div>

Hi&nbsp;[@veranika\_k](https://community.dynatrace.com/user/67240)&nbsp;- I hope the solution above solution worked for you, if so, please ‘accept as solution’, to help us close this community question.

Thanks, Penny
