Open angeloashmore opened 9 months ago
<PrismicRichText>'s components prop is often simply used to assign CSS classes to a default element. For example, the following code renders <h1>s with a heading class:
<PrismicRichText>
components
<h1>
heading
<PrismicRichText field={doc.data.richTextField} components={{ heading1: ({ children }) => <h1 className="heading">{children}</h1> }} />
Except for the className="heading" portion, the code is mostly boilerplate:
className="heading"
heading1: ({ children }) => <h1 className="heading">{children}</h1>
Typing that full line anytime a class needs to be applied can feel tedious.
A shortcut or convention for adding classes to default elements would be helpful.
Example:
<PrismicRichText field={doc.data.richTextField} components={{ heading1: { className: "heading" } }} />
(The above example is just an idea and may not be the best or final implementation.)
None.
This request was proposed by @a-trost and discussed with @lihbr.
Is your feature request related to a problem? Please describe.
<PrismicRichText>
'scomponents
prop is often simply used to assign CSS classes to a default element. For example, the following code renders<h1>
s with aheading
class:Except for the
className="heading"
portion, the code is mostly boilerplate:Typing that full line anytime a class needs to be applied can feel tedious.
Describe the solution you'd like
A shortcut or convention for adding classes to default elements would be helpful.
Example:
(The above example is just an idea and may not be the best or final implementation.)
Describe alternatives you've considered
None.
Additional context
This request was proposed by @a-trost and discussed with @lihbr.