Skip to main content

useEnumValues

useEnumValues (deprecated, don't use)

Returns enum values passed to z.enum() for the field that's being rendered:

function MyDropdown() {
const values = useEnumValues(); // ['red', 'green', 'blue']
return (
<select>
{values.map((e) => {
//...
})}
</select>
);
}
const FormSchema = z.object({
favoriteColor: z.enum(["red", "green", "blue"]),
});