Utils
sidcn/utilsFreeUtility
Utility functions and types
Live preview
live · rendered by the registry
Rendered by sidcn on their own page — this is the component running, not a screenshot of it.Install it
npx shadcn@latest add https://ui.siddhesh.cc/r/utils.jsonSource
1import { clsx, type ClassValue } from "clsx";2import { twMerge } from "tailwind-merge";34export function cn(...inputs: ClassValue[]) {5 return twMerge(clsx(inputs));6}78export function isMac() {9 const navigator_ = navigator as Navigator & {10 userAgentData?: { platform?: string };11 };12 const macRegex = /mac|iphone|ipad|ipod/i;1314 return (15 navigator_.userAgentData?.platform?.toLowerCase().includes("mac") ??16 macRegex.test(navigator_.userAgent)17 );18}
