prismicio / prismic-react

React components and hooks to fetch and present Prismic content
https://prismic.io/docs/technologies/homepage-reactjs
Apache License 2.0
153 stars 40 forks source link

Enhance PrismicRichText #187

Open benembery opened 10 months ago

benembery commented 10 months ago

Is your feature request related to a problem? Please describe.

No, more a request for an enhancement.

Describe the solution you'd like

I'd like to be able to apply css classes directly to a PrismicRichText component via a prop.

Most of the time I would use it apply a class to a single RichText element for example a title used in a slice. However, when there are multiple fragments to serialize it makes sense to wrap the elements with a div and apply the class there. In the instance of the multiple lines, I understand there is an argument that the component could ignore the class and leave it to the developer to create the wrapping div, or for consistency have the PrismicRichText always apply the class.

Describe alternatives you've considered

This limitation made more acute by frameworks like tailwindcss where the preference is to apply the class to the element.

Additional context