Ariakit
/

SelectValue

Renders the current value state in the select store.

As a value component, it doesn't render any DOM elements and therefore doesn't accept HTML props. It can optionally accept a fallback prop to use as a default value if the store's value is undefined.

Additionally, it takes a children function that gets called with the current value as an argument. This is handy for rendering the value in a custom way.

Code examples

<Select>
<SelectValue fallback="Select a value" />
</Select>
<SelectItem value="Apple" />
<SelectItem value="Banana" />
<SelectItem value="Orange" />
function renderValue(value) {
// render custom JSX
}
<Select>
<SelectValue>{renderValue}</SelectValue>
</Select>
<SelectItem value="Apple" />
<SelectItem value="Banana" />
<SelectItem value="Orange" />

Required Props


fallback

T | undefined = ""

The value to use as a default if the store's value is undefined.

Optional Props


children

((value: ToPrimitive<T>) => React.ReactNode) | undefined

A function that gets called with the current value as an argument. This is handy for rendering the value in a custom way.


store

SelectStore<T> | undefined

Object returned by the useSelectStore hook. If not provided, the parent SelectList or SelectPopover components' context will be used.

Stay tuned

Join 1,000+ subscribers and receive monthly tips & updates on new Ariakit content.

No spam. Unsubscribe anytime. Read latest issue