-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
Input refactoring. Split select, radio, textarea, text-input #342
Comments
👍 |
EDIT Moved this comment to issue description in edit clause |
|
Consider react-select when dealing with this. That's not a declaration that we will use it, only that we will review it. @binarykitchen Consideration as per #544 |
ok, fair enough, thanks |
From conversation in #618:
I know it's not quite intuitive at first, but it really opens the doors for extensibility. Should we do this with ES6 classes than you could extend any of those components and override its render call. I don't know if this is possible with Bootstrap but it would allow you to, for example, have two buttons before the input. We could do some validation logic to warn if you use an after component prior to any befores. /cc @cymen |
This is definitely better. (You already know my feelings about the 60 properties on the |
Hey! Is there any progress on this? I'd like to add a extra class name to this: // In InputBase.js.
var addonBefore = this.props.addonBefore ? _react2['default'].createElement(
'span',
{ className: 'input-group-addon', key: 'addonBefore' },
this.props.addonBefore
) : null; So I can have |
@jondeandres Sorry, I don't have a timetable for when the rewrite of the add-ons. Swamped with work and I just got back from vacation. |
Replacing with #1749. |
Currently they are in one codebase and the code is contaminated with multiple if statements...
I think it's worth splitting onto two, three or more distinct components. react-bootstrap is, perhaps, the only one that merged them together. My anti-favorite is
<Input type="select"/>
:(-- EDIT by @mtscout6 --
I originally wrote down these thoughts against #205, that issue has been resolved, but these notes apply better here.
I think we should extract smaller components, where some are not publicly exposed.
We could add these components publicly:
RadioGroup
- Addressed in [added] RadioButton and RadioGroup #962RadioButton
- Addressed in [added] RadioButton and RadioGroup #962CheckboxGroup
Checkbox
TextArea
TextInput
- With withtype
prop to support password, email, etc.FileInput
- This one doesn't even work with our current implementation, butwe should figure this one out at some point.
Select
Static
- Addressed in PR Static FormControl Component #674Submit
- Addressed in PR Splitting Button, Reset, and Submit from Input #626@ivan-kleshnin Correct me if I missed one.
The public components would make use of these private components:
FormGroup
- Genericform-group
and validation wrapper - Completed in Make Input form group rendering optional? #205InputGroup
- Generic label, help text, and addon wrapperEach control than can should implement a
getValue()
function.Since checkboxes do not correlate with each other the way radios do with the name property, I'm thinking they'd be different group types. This gets especially difficult when figuring out how to implement a
getValue()
function for the two different groups.Example form when all is said and done:
I know this introduces a lot of work and really isn't a quick solution, but I feel that something like this would allow the flexibility that everyone is looking for, and significantly simplify what is now a very large component.
The text was updated successfully, but these errors were encountered: