feat(label): add size prop to Label component for responsive text sizing

This commit is contained in:
micha 2025-06-11 20:12:29 +02:00
parent 94013d03ae
commit 444a8e0261
2 changed files with 13 additions and 8 deletions

View file

@ -5,16 +5,21 @@ import * as LabelPrimitive from '@radix-ui/react-label';
import { cn } from '@/lib/utils';
function Label({
className,
...props
}: React.ComponentProps<typeof LabelPrimitive.Root>) {
type LabelProps = React.ComponentProps<typeof LabelPrimitive.Root> & {
size?: 'default' | 'small' | 'large';
};
function Label({ className, size = 'default', ...props }: LabelProps) {
return (
<LabelPrimitive.Root
data-slot='label'
className={cn(
/* Text */
'text-sm',
size === 'small'
? 'text-sm'
: size === 'large'
? 'text-lg'
: 'text-base',
/* Background */
'',
/* Border */