Skip to content

Radix UI Select Value Not Updating — Fix Controlled Select

DodaTech Updated 2026-06-24 1 min read

In this fix, you'll learn how to manage Radix UI Select value state. This matters for select/dropdown controls, and appears in form fields and configuration selectors.

The Problem

The following code demonstrates the typical mistake:

<Select>
  <SelectTrigger>
    <SelectValue placeholder="Select..." />
  </SelectTrigger>
  <SelectContent>
    <SelectItem value="1">Option 1</SelectItem>
    <SelectItem value="2">Option 2</SelectItem>
  </SelectContent>
</Select>
// Selected value not displayed — placeholder always shows

The Fix

Here is the corrected version:

const [value, setValue] = useState('1');
<Select value={value} onValueChange={setValue}>
  <SelectTrigger className="w-[180px]">
    <SelectValue />
  </SelectTrigger>
  <SelectContent>
    <SelectItem value="1">Option 1</SelectItem>
    <SelectItem value="2">Option 2</SelectItem>
  </SelectContent>
</Select>
// Selected value displays correctly in the trigger

Prevention

  • Use controlled mode with value and onValueChange props on Select.
  • The value string must exactly match a SelectItem value prop.
  • SelectValue placeholder shows when no value is selected.
  • For uncontrolled usage, use defaultValue prop instead of value.
  • SelectItem children render as the displayed text for that option.

Common Mistakes with ui select value

  1. Non-exhaustive pattern matches that compile with warnings then crash at runtime
  2. Misunderstanding that String is [Char] with poor performance for large text operations
  3. Using foldl instead of foldl' causing stack overflow on large lists

These mistakes appear frequently in real-world RADIX code. DodaTech's contributors have identified these patterns through analysis of open-source projects and production systems.

Practice Exercise

Write a pure function that safely divides two integers using Maybe, then test it with edge cases like division by zero and negative numbers.

This exercise reinforces the concepts covered in this guide. Try implementing it before checking online solutions.

FAQ

### What does SelectValue render?

It renders the text content of the SelectItem whose value matches the current Select value. If no value is matched, it shows the placeholder text.

Can SelectValue have a different display than the SelectItem?

No — SelectValue displays the SelectItem's children by default. For custom display, use SelectValue as child and provide a custom component.

How do I reset a controlled Select to no value?

Set the value state to empty string: setValue(''). The SelectValue placeholder will appear. An empty string won't match any SelectItem value.

Built by the developers of DodaTech

Doda Browser, DodaZIP & Durga Antivirus Pro