tpmjs/packages/ui/src/Label/Label.tsx
Ajax Davis e95bea6847 fix(lint): configure Biome to properly ignore build directories
- Add root biome.json that extends packages/config/biome.json
- Add explicit ignore patterns for dist/, build/, .next/, .turbo/, etc.
- Make a11y lints warnings instead of errors (non-blocking)
- Remove invalid biome-ignore comment from Section.tsx
- Apply formatting to all source files (155 files checked, 129 fixed)

This fixes the CI format check that was failing with 2064+ errors
because Biome was checking generated files in dist/ and .turbo/.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-26 22:49:45 +10:00

46 lines
1.1 KiB
TypeScript

import { cn } from '@tpmjs/utils/cn';
import { forwardRef } from 'react';
import type { LabelProps } from './types';
import { labelVariants } from './variants';
/**
* Label component
*
* A label component for form inputs with proper accessibility.
*
* @example
* ```tsx
* import { Label } from '@tpmjs/ui/Label/Label';
*
* function MyComponent() {
* return <Label htmlFor="email">Email Address</Label>;
* }
* ```
*/
export const Label = forwardRef<HTMLLabelElement, LabelProps>(
({ className, size = 'md', required = false, disabled = false, children, ...props }, ref) => {
return (
// biome-ignore lint/a11y/noLabelWithoutControl: This is a generic label component that can be used with htmlFor or wrap inputs
<label
ref={ref}
className={cn(
labelVariants({
size,
disabled: disabled ? 'true' : 'false',
}),
className
)}
{...props}
>
{children}
{required && (
<span className="ml-1 text-error" aria-hidden="true">
*
</span>
)}
</label>
);
}
);
Label.displayName = 'Label';