Select is not rendering the options #2415
-
I'm creating an application using Astro, React, Tailwind and Shadcn. It turns out that when I installed the Select component and tried to use it, I noticed that the option tag for some reason is not getting the value and text content. My component code looks like this: import {
Select,
SelectContent,
SelectGroup,
SelectItem,
SelectLabel,
SelectTrigger,
SelectValue,
} from "@/components/ui/select";
<Select>
<SelectTrigger className="w-[180px] ring-1 ring-muted-foreground ring-offset-0 focus:ring-2">
<SelectValue placeholder="4 Images" />
</SelectTrigger>
<SelectContent>
<SelectGroup>
<SelectLabel>Images</SelectLabel>
<SelectItem value="4images">4 Images</SelectItem>
<SelectItem value="3images">3 Images</SelectItem>
<SelectItem value="2images">2 Images</SelectItem>
<SelectItem value="1image">1 Image</SelectItem>
</SelectGroup>
</SelectContent>
</Select> I'm using the latest version, 0.5.0 at the moment. The import and installation is correct, I even used other shadcn components and only had a problem with select so far. As shown in the video below, the select does not expand with the options and only render an option tag with no value defined and without text content when I look in devtools. When I inspect it, a error.mp4 |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 5 replies
-
Are you using the If so, you'll need a Add the
|
Beta Was this translation helpful? Give feedback.
Are you using the
Select
component in a.astro
file?If so, you'll need a
client:*
directive to control hydration. As it stands, it seems JavaScript is not been rendered on the page so the component has no interactivity. Client DirectivesAdd the
client:load
directive to the component.<SelectDemo client:load />