Files
web/components/TempDesignSystem/Text/Subtitle/index.tsx
2024-06-13 10:00:16 +02:00

28 lines
556 B
TypeScript

import { Slot } from "@radix-ui/react-slot"
import { subtitleVariants } from "./variants"
import type { SubtitleProps } from "./subtitle"
export default function Subtitle({
asChild = false,
className = "",
color,
hideEmpty = true,
textAlign,
textTransform,
...props
}: SubtitleProps) {
if (hideEmpty && !props.children) {
return null
}
const Comp = asChild ? Slot : "p"
const classNames = subtitleVariants({
className,
color,
textAlign,
textTransform,
})
return <Comp className={classNames} {...props} />
}