Closed angeloashmore closed 2 years ago
Adding a fallback prop to <PrismicRichText> would be helpful to render content when a field's value is empty.
fallback
<PrismicRichText>
This functionality should mirror <PrismicText>'s fallback prop. See #105 for more details.
<PrismicText>
<PrismicRichText field={document.data.richTextField} fallback={<p>Empty content</p>} />
To do this today, one must use isFilled.richText() from @prismicio/helpers in a ternary.
isFilled.richText()
@prismicio/helpers
<div> {prismicH.isFilled.richText(document.data.richTextField) ? ( <PrismicRichText field={document.data.richTextField} /> ) : ( <p>Empty content</p> )} </div>
This is verbose and requires using a separate library.
N/A
Completed in #135.
Is your feature request related to a problem? Please describe.
Adding a
fallback
prop to<PrismicRichText>
would be helpful to render content when a field's value is empty.This functionality should mirror
<PrismicText>
'sfallback
prop. See #105 for more details.Describe the solution you'd like
Describe alternatives you've considered
To do this today, one must use
isFilled.richText()
from@prismicio/helpers
in a ternary.This is verbose and requires using a separate library.
Additional context
N/A