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

Feature request: Style attribute support #24

Closed
a-h opened this issue Oct 4, 2021 · 0 comments
Closed

Feature request: Style attribute support #24

a-h opened this issue Oct 4, 2021 · 0 comments

Comments

@a-h
Copy link
Owner

a-h commented Oct 4, 2021

Support constant attributes

{% templ StaticStyledComponent() %}
  <div style="background-color: red;">{%= "text" %}</div>
{% endtempl %}

Do not allow setting style as a dynamic string

This would not be allowed.

{% templ StyledComponent(backgroundColor string) %}
  <div style={%= "background-color: " + backgroundColor %}>{%= "text" %}</div>
{% endtempl %}

Do not allow the inclusion of any other elements or template items within a style element

This would not be allowed. Only SafeCSS would be allowed here, if anything.

{% templ StyledComponent(css string) %}
  <style type="text/css">
   {%= css %}
  </style>
{% endtempl %}

To render raw CSS, a templ.RawCSS component can be used

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant