feat: loosen up the zod validations and return null instead of throwing
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import { Slot } from "@radix-ui/react-slot"
|
||||
import { Children } from "react"
|
||||
|
||||
import { subtitleVariants } from "./variants"
|
||||
|
||||
@@ -13,7 +14,7 @@ export default function Subtitle({
|
||||
textTransform,
|
||||
...props
|
||||
}: SubtitleProps) {
|
||||
if (hideEmpty && !props.children) {
|
||||
if (hideEmpty && Children.count(props.children) === 0) {
|
||||
return null
|
||||
}
|
||||
const Comp = asChild ? Slot : "p"
|
||||
|
||||
Reference in New Issue
Block a user