Skip to content
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

Cannot specify File Input multiple attribute #1386

Closed
msaron opened this issue Feb 25, 2017 · 6 comments
Closed

Cannot specify File Input multiple attribute #1386

msaron opened this issue Feb 25, 2017 · 6 comments

Comments

@msaron
Copy link

msaron commented Feb 25, 2017

I tried all different ways but could not specify the following input for selecting multiple files. Single file selection works fine. How to specify the multiple property?

<input type="file" multiple />

@msaron msaron changed the title Cannot specify File Input multiple Cannot specify File Input multiple attribute Feb 25, 2017
@levithomason
Copy link
Member

There is a whitelist array of HTML input props in the Input component. These props are spread in the HTML input component within the div wrapper. The multiple prop simply needs to be added to that array.

@msaron
Copy link
Author

msaron commented Feb 26, 2017

Maybe there should be a way of adding any additional props that makes it flexible for any future HTML5 attributes that come along?

@levithomason
Copy link
Member

levithomason commented Feb 26, 2017

Given there are a small finite number of these props and they change very infrequently, I think it makes sense to whitelist them.

A workaround is to use the input prop to define the HTML inputs props:

http://react.semantic-ui.com/elements/input

input		{custom}	       Shorthand for creating the HTML Input.
<Input input={{ multiple: true }} />

// or

<Input input={<input multiple />} />

You can pass a type, props object, or an element there ^ 👍

@msaron
Copy link
Author

msaron commented Feb 26, 2017

Thanks for the example. I did not know that you could use the Input like this.

@levithomason
Copy link
Member

Indeed, the crux of this library is the power of our shorthand props. They have yet to be documented #561 😄

@levithomason
Copy link
Member

Released in [email protected].

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants