mirror of
https://github.com/ershisan99/flashcards-example-project.git
synced 2025-12-16 12:33:18 +00:00
24 lines
578 B
TypeScript
24 lines
578 B
TypeScript
import { ComponentPropsWithoutRef, FC, ReactNode } from 'react'
|
|
|
|
import * as LabelRadixUI from '@radix-ui/react-label'
|
|
import { clsx } from 'clsx'
|
|
|
|
import s from './label.module.scss'
|
|
|
|
export type LabelProps = {
|
|
label?: ReactNode
|
|
} & ComponentPropsWithoutRef<'label'>
|
|
|
|
export const Label: FC<LabelProps> = ({ children, className, label, ...rest }) => {
|
|
const classNames = {
|
|
label: clsx(s.label, className),
|
|
}
|
|
|
|
return (
|
|
<LabelRadixUI.Root {...rest}>
|
|
{label && <div className={classNames.label}>{label}</div>}
|
|
{children}
|
|
</LabelRadixUI.Root>
|
|
)
|
|
}
|