-
-
Notifications
You must be signed in to change notification settings - Fork 208
Styling the chip input #20
Comments
The best option would be to support multiple styles via prop. The current styles prop only supports to override the root element.
This is also the way material-ui handles further styling. Are there any more styling needs you want to achieve? For further details see the style props for used components: |
Additional infos that might of some interest :
Explanations: You can also find the default styles used by ChipInput author in the code source here. As for inline styling CSS-in-JS, the 2 i've read the most about are Aphrodite and JSS. Hope it helps. |
@syntacticsugar @saschb2b I wanted to at first, but then I didn't implement a
Example (from the stories): <ChipInput
defaultValue={['foo', 'bar']}
fullWidth
chipRenderer={({ value, isFocused, isDisabled, handleClick, handleRequestDelete }, key) => (
<Chip
key={key}
style={{ margin: '8px 8px 0 0', float: 'left', pointerEvents: isDisabled ? 'none' : undefined }}
backgroundColor={isFocused ? green800 : green300}
onTouchTap={handleClick}
onRequestDelete={handleRequestDelete}
>
<Avatar size={32}>{value[0].toUpperCase()}</Avatar>
{value}
</Chip>
)}
/> You can use this to create any chip style you want, e.g. chips with avatars. And when #9 is done, it's even more powerful. :) |
I'll look into all this over the next few days, and get back with my updates, thank you! |
Hello! I'm kind of new to inline styling in React. Specifically, for components that create nested divs without classes (and instead of inline styles) that I cannot access from the code I use to create that component.
For example, among other things, I'd like to increase the size of the input text as shown:
I only managed to do so as shown above, but inspecting element and manually typing it in the Developer Tools bar :
This div was nested several divs deep. Naturally, if it had some sort of class attached, I'd be able to go into my CSS/LESS file and style it, but inside my project JS file, I only have:
I saw in your Readme/documentation that the
style
property can take an object (exstyle={ { backgroundColor: silver } }
), but how do I target individually nested divs?Because after I increase the font-size of the input text, I also need to style the chips' background colors, etc.
Thank you so much! I would appreciate being pointed in the right direction at least. Sorry if this is such a basic question, but I did Google 'react js inline styles', found some library called Radium, but am not sure if this is the best way to go about it.
The text was updated successfully, but these errors were encountered: