Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhance PrismicRichText #187

Open
benembery opened this issue Jun 14, 2023 · 0 comments
Open

Enhance PrismicRichText #187

benembery opened this issue Jun 14, 2023 · 0 comments
Labels
enhancement New feature or request

Comments

@benembery
Copy link

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

  • Wrapping the rich text field in an additional outer HTML tag to apply the class there.
  • Creating a component that applies a custom serializer that applies the class.
  • Using asText for single elements and applying the markup manually, but this in-flexible for complex use cases where event a single fragment rich text field might be using labels in the writing room.

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

Additional context

@benembery benembery added the enhancement New feature or request label Jun 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant