reflex icon indicating copy to clipboard operation
reflex copied to clipboard

`rx.text_area` doesnt apply some css props correctly

Open ElijahAhianyo opened this issue 1 year ago β€’ 2 comments

This is a similar issue with rx.input(rx.text_field) where Radix wraps the component in a root div in the DOM, so styles get applied to the the wrapped div than the intended component (text_area in this case).


rx.text_area(
            "This sentense has a speling mistake.",
            rows="4",
            spellcheck=True,
            spelling_error_underline=True,
            padding="0.5rem",
            background_color="red"
        ),
Screenshot 2024-07-29 at 2 24 56 PM

Not sure what we can do about this, but Im creating this issue to track it

ElijahAhianyo avatar Jul 29 '24 14:07 ElijahAhianyo

Hello, Can you assign this bounty to me and give further instructions, After successful completion can you interview me

kalyankotikalapudi avatar Aug 06 '24 03:08 kalyankotikalapudi

Yes we will, ok just assigned it to you. We aren't giving further guidance/answering questions for the bounties but your welcome to give it a shot.

Alek99 avatar Aug 06 '24 15:08 Alek99

hi @ElijahAhianyo, are you sure if this is a bug? To me it looks like only those styles are being applied to wrapped div element that are not supported by radix UI textarea component in this case: padding, background_color.

dimritium avatar Aug 12 '24 19:08 dimritium

Here, text_area does not support wrapping the inside elements separately in radix. But we might use reflex raw HTML element in this

kalyankotikalapudi avatar Aug 12 '24 19:08 kalyankotikalapudi

ah sorry, I also checked the Radix implementation for TextArea, it applies the style to the textarea parent div only.

so is this a bug in reflex implementation?

dimritium avatar Aug 12 '24 19:08 dimritium

rx.text_area(
    "This sentence has a spelling mistake.",
    rows="4",
    spellcheck=True,
    spelling_error_underline=True,
    style={
        "& textarea": {
            "padding": "0.5rem",
            "background_color": "red",
        }
    }
)

This solution uses the style prop and targets the textarea element directly within the Radix UI component. The & textarea selector should apply the styles to the textarea element itself, rather than the wrapper div.

bhaskar552 avatar Aug 22 '24 03:08 bhaskar552