How to Disable PopoverTrigger Component? #3296
-
I have made a component using popover of shadcn ui. I want disable the trigger programmatically. export function Component<
T extends { id: number | string | boolean; name: string }
>({
disabled = false,
}: TProps<T>) {
const [open, setOpen] = useState(false)
return (
<div className="w-full">
<Popover open={open} onOpenChange={setOpen}>
<PopoverTrigger asChild disabled={disabled}>
// rest of the codes I have done this to make the Can anyone help me here, how can i do this? |
Beta Was this translation helpful? Give feedback.
Answered by
if1eight0sty
Jan 3, 2025
Replies: 1 comment
-
<Popover modal={true}>
<PopoverTrigger asChild>
<Button
variant="outline"
role="combobox"
className={cn(
"w-full justify-between",
!field.value && "text-muted-foreground",
)}
>
{field.value
? users.find(
(user) => user.id === field.value,
)?.name
: "Select User}
<ChevronsUpDown className="ml-2 h-4 w-4 shrink-0 opacity-50" />
</Button> this is the solution i found. we need set the |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
if1eight0sty
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
this is the solution i found. we need set the
modal
prop totrue
.for reference here