classNames React Tailwind utility

export function classNames(...classes: string[]): string {
  return classes.filter(Boolean).join(' ');
}

With usage:

<span
  className={classNames(
    withConditiionalClass ? 'conditional-class' : 'default-class',
    'inline-flex cursor-pointer items-center px-3text-sm'
  )}
>
  My content
</span>