Files

17 lines
553 B
TypeScript
Raw Permalink Normal View History

2026-10-05 18:10:18 -04:00
import React from 'react';
2026-10-12 09:04:03 -04:00
import { useSkin } from '@/themes/skins';
2020-07-04 12:39:55 -07:00
2026-10-12 09:04:03 -04:00
export type LabelProps<E extends React.ElementType = 'label'> = {
2026-10-05 18:10:18 -04:00
as?: E;
isLight?: boolean;
} & Omit<React.ComponentPropsWithoutRef<E>, 'as' | 'isLight'>;
2026-10-12 09:04:03 -04:00
const Label = <E extends React.ElementType = 'label'>({ as, isLight, className, ...props }: LabelProps<E>) => {
2026-10-05 18:10:18 -04:00
const Component = (as || 'label') as React.ElementType;
2026-10-12 09:04:03 -04:00
const ui = useSkin('Label', { light: !!isLight });
2026-10-05 18:10:18 -04:00
2026-10-12 09:04:03 -04:00
return <Component {...ui('root', className)} {...props} />;
2026-10-05 18:10:18 -04:00
};
2020-07-04 12:39:55 -07:00
export default Label;