react-rainbow icon indicating copy to clipboard operation
react-rainbow copied to clipboard

Styling Input Field

Open mariuschiriac opened this issue 7 years ago • 3 comments

When i try to redefine css in Input component, it style only the outer element and i cannot access to the inner ones

i.e. i want to define the area inside the input field in black, and i create a custom css to do that const myStyle ={ backgroundColor:"black", borderRadius:"5px" } and now i pass the Input item as component into the field <Field key={key} className="rainbow-m-top_small" component={(props) => { return ( <Input style={myStyle} {...props}/> ) }} name={field.column_name} label={field.column_name} type="text" /> with the custom style.

That's the result. Schermata 2019-11-10 alle 11 40 10

but i want to make black the area inside the styled.div below "Label". Schermata 2019-11-10 alle 11 40 55

is there a way to do that?

mariuschiriac avatar Nov 10 '19 11:11 mariuschiriac

We are working on providing a theming solution for customization. Right now you could make introspection as: in app.js:

import { Input } from 'react-rainbow-components';
import './styles.css';

<Input className="my-custom-class" label="My Input" />

in styles.css:

.my-custom-class input {
    background-color: black;
}

But keep in mind that this is a workaround and it is bad practice. Stay tuned for future releases because theming will be the right solution for this case.

LeandroTorresSicilia avatar Nov 11 '19 15:11 LeandroTorresSicilia

Hi guys, I would like to move the label of the input to the left. Is there any way to do this through theming?

guidogr95 avatar Jan 29 '21 16:01 guidogr95

Hi guys, I would like to move the label of the input to the left. Is there any way to do this through theming?

Hi, @guidogr95 you can use the labelAlignment="left" prop We have an example that you can review https://react-rainbow.io/#!/Input/27

TahimiLeonBravo avatar Jan 29 '21 17:01 TahimiLeonBravo