-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Dynamic CSS for custom block #9959
Comments
Can you expand on your use-case? Is it possible that CSS variations could be applied either through a Preemptively closing, but let's reopen if the question remains unsettled. |
We have a custom block where we used some arrow with pseudo-elements. We want to change the color of this arrow as per color selection blockwise. For eg. For block 1 arrow color should be red. And if I duplicate the block 1 then second block color should be changed to 'green'. Reference screenshot - https://goo.gl/hZ9YP6 |
From what I understand then, the color would be user-selected? In which case, I might suggest storing this value as an attribute of the block, which can then be accessed in the server-side implementation of your block. The components are here, though not documented at the moment (cc @jorgefilipecosta in case I'm missing some): https://github.com/WordPress/gutenberg/tree/master/packages/editor/src/components/colors I expect it would work very similarly to the color options for both the Paragraph and Button blocks, in case you want to reference those in the meantime: |
How to add CSS for before after pseudo element in Gutenberg block?
As no unique id generated on the frontend, is there another way to write CSS for pseudo-element?
The text was updated successfully, but these errors were encountered: