FilePicker
File picker.
Props
- name (string):
name
HTML attribute to set to the element. - [OPTIONAL] id (string):
id
HTML attribute to set to the element. - [OPTIONAL] modifiers (string): List of modifiers to apply to the element. Defaults to
""
. - [OPTIONAL] helper (string): Element helper. Supports light markdown.
- [OPTIONAL] label (string): Element label. Supports light markdown.
- [OPTIONAL] placeholder (string): Element placeholder.
- [OPTIONAL] accept (string):
accept
HTML attribute to set to the element. - [OPTIONAL] multiple (string):
multiple
HTML attribute to set to the element. Defaults tofalse
. - [OPTIONAL] iconPosition ("left" | "right"): Position of the icon relatively to the label. Defaults to
"left"
. - [OPTIONAL] icon (string): Name of the icon to set to the element.
- [OPTIONAL] value (File | File[]): File picker value. Updating this prop with a new value will replace the current value by the one passed.
- [OPTIONAL] disabled (boolean): When element is disabled, a special
disabled
modifier is automatically added, and all its user interactions are disabled. Defaults tofalse
.
Events
- change (newValue: File[], event: InputEvent) => void: Triggered whenever input value is modified.
- focus (currentValue: File[], event: FocusEvent) => void: Triggered whenever the input is focused.
- blur (currentValue: File[], event: FocusEvent) => void: Triggered whenever the input is blurred.
Syntax
- React
- Vue
- Svelte
- HTML
<UIFilePicker
id="my-id"
modifiers="large"
name="test"
accept="image/*"
placeholder="Select a file..."
onChange={onChange}
onFocus={onFocus}
onBlur={onBLur}
/>
<UIFilePicker
id="my-id"
modifiers="large"
name="test"
accept="image/*"
placeholder="Select a file..."
:onChange="onChange"
:onFocus="onFocus"
:onBlur="onBLur"
/>
<UIFilePicker
id="my-id"
modifiers="large"
name="test"
accept="image/*"
placeholder="Select a file..."
onChange={onChange}
onFocus={onFocus}
onBlur={onBLur}
/>
<div id="my-id" class="ui-file-picker ui-file-picker--large">
<div class="ui-file-picker__wrapper">
<input
class="ui-file-picker__wrapper__field"
id="z8a8d7a5zad4"
name="test"
type="file"
accept="image/*"
/>
<span class="ui-file-picker__wrapper__placeholder">
Select a file...
</span>
</div>
</div>
Syntax - with label and helper
- React
- Vue
- Svelte
- HTML
<UIFilePicker
name="test"
label="Label"
helper="Helper"
/>
<UIFilePicker
name="test"
label="Label"
helper="Helper"
/>
<UIFilePicker
name="test"
label="Label"
helper="Helper"
/>
<div class="ui-file-picker">
<label
class="ui-file-picker__label"
for="z8a8d7a5zad4"
>
Label
</label>
<div class="ui-file-picker__wrapper">
<input
class="ui-file-picker__wrapper__field"
id="z8a8d7a5zad4"
name="test"
type="file"
/>
<span class="ui-file-picker__wrapper__placeholder" />
</div>
<span class="ui-file-picker__helper">
Helper
</span>
</div>
Syntax - multiple
- React
- Vue
- Svelte
- HTML
<UIFilePicker
name="test"
multiple
/>
<UIFilePicker
name="test"
multiple
/>
<UIFilePicker
name="test"
multiple
/>
<div class="ui-file-picker ui-file-picker--multiple">
<div class="ui-file-picker__wrapper">
<input
class="ui-file-picker__wrapper__field"
id="z8a8d7a5zad4"
name="test"
type="file"
multiple=""
/>
<span class="ui-file-picker__wrapper__placeholder" />
</div>
</div>
Syntax - disabled
- React
- Vue
- Svelte
- HTML
<UIFilePicker
name="test"
disabled
/>
<UIFilePicker
name="test"
disabled
/>
<UIFilePicker
name="test"
disabled
/>
<div class="ui-file-picker ui-file-picker--disabled">
<div class="ui-file-picker__wrapper">
<input
class="ui-file-picker__wrapper__field"
id="z8a8d7a5zad4"
name="test"
type="file"
tabindex="-1"
/>
<span class="ui-file-picker__wrapper__placeholder" />
</div>
</div>
Syntax - with right icon
- React
- Vue
- Svelte
- HTML
<UIFilePicker
name="test"
icon="star"
iconPosition="right"
/>
<UIFilePicker
name="test"
icon="star"
iconPosition="right"
/>
<UIFilePicker
name="test"
icon="star"
iconPosition="right"
/>
<div class="ui-file-picker">
<div class="ui-file-picker__wrapper">
<input
class="ui-file-picker__wrapper__field"
id="z8a8d7a5zad4"
name="test"
type="file"
/>
<i class="ui-file-picker__wrapper__icon">
star
</i>
<span class="ui-file-picker__wrapper__placeholder" />
</div>
</div>