I am trying to use the shadcn dropdown component in my react application. I am not using Tailwind. I followed their docs and chose the path to add the code manually, but now I get an error:
Module not found: Can't resolve '@/lib/utils'
3 | import { CheckIcon, ChevronRightIcon, DotFilledIcon } from "@radix-ui/react-icons";
4 |
> 5 | import { cn } from "@/lib/utils";
6 |
7 | const DropdownMenu = DropdownMenuPrimitive.Root;
Please guide me on what needs to be added to folder @/lib/utils.
cn() can be found in the shadcn git repo:
import * as React from "react"
import { clsx, type ClassValue } from "clsx"
import { twMerge } from "tailwind-merge"
export function cn(...inputs: ClassValue[]) {
return twMerge(clsx(inputs))
}
source: https://github.com/shadcn-ui/ui/blob/bebc2843f0e0daa4e508def74fb3ba8a08e98f6f/apps/www/lib/utils.ts#L5C1-L6C1
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With