-
Notifications
You must be signed in to change notification settings - Fork 1.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
rx.heading responsive #2719
Comments
Hey @Valdes-Tresanco-MS Thanks for reporting this. I believe this needs to be supported in Reflex as well. In radix, the breakpoints for Responsive props are defined as dicts or objects (https://www.radix-ui.com/themes/docs/theme/breakpoints) rather than a list, The team will decide on what syntax we would want the API to look like(i.e whether we want to support list, or dicts or both). |
I would like to pick this up |
@wassafshahzad not sure how easy this will be - a fix for this would end up enabling all props for all components to take on a responsive list. Under the hood, we may have to convert these to media queries or something along those lines |
i think in the short term, we can at least process radix themes props given as a list into the native dict format supported by radix. User supplies It won't be a general solution, but we could generalize to "all props" later and take the quick win for now. |
I can do some RnD with the solution proposed by @masenf, if thats ok |
@wassafshahzad that would be great, thanks! Assigned you to this |
I'm sorry I cant figure this one out , please de assign me from this ticket |
It's now working with the following syntax: @rx.page()
def index() -> rx.Component:
return rx.center(
rx.heading(
"Test",
as_="h1",
color=["orange", "red", "purple", "blue", "green"],
size=rx.breakpoints(initial="4", xs="4", sm="5", md="7", lg="9"),
),
) |
Describe the bug
According to the radix-ui, headings are responsive (https://www.radix-ui.com/themes/docs/components/heading#api-reference). So, it should expected to accept a list of sizes. In reflex v0.4.0, several heading arguments expect a Literal, which limits the responsive behavior (ends in error if a list is defined, for example,
size=["4", "4", "5", "7", "9"]
. The same happen withweight
,align
andtrim
).color
instead, accepts a list of variants (for example,color=["orange", "red", "purple", "blue", "green"],
)Is this configuration a limitation or a simplification that will be implemented in future versions?
To Reproduce
This ends in error:
Expected behavior
I expected the rx.heading to have a similar API to radix-ui and be responsive, accepting a list of sizes.
Specifics (please complete the following information):
The text was updated successfully, but these errors were encountered: