DocSpace-buildtools/web/ASC.Web.Components/src/components/file-input/README.md

39 lines
3.1 KiB
Markdown
Raw Normal View History

2020-07-17 11:33:59 +00:00
# FileInput
2020-07-16 08:42:10 +00:00
2020-07-17 11:33:59 +00:00
File entry field
2020-07-16 08:42:10 +00:00
### Usage
```js
2020-07-17 11:33:59 +00:00
import { FileInput } from "asc-web-components";
2020-07-16 08:42:10 +00:00
```
```jsx
2020-07-17 11:33:59 +00:00
<FileInput
placeholder="Input file"
accept=".doc, .docx"
onInput={(file) => {
console.log( file,
`name: ${file.name}`, `lastModified: ${file.lastModifiedDate}`, `size: ${file.size}`
);
}}
/>
2020-07-16 08:42:10 +00:00
```
### Properties
2020-07-17 11:33:59 +00:00
| Props | Type | Required | Values | Default | Description |
| ---------------- | :------------: | :------: | :--------------------------------------: | :-----: | ------------------------------------------------------------------------------------------------------ |
| `className` | `string` | - | - | - | Accepts class |
2020-07-17 12:16:14 +00:00
| `hasError` | `bool` | - | - | `false` | Indicates the input field has an error |
| `hasWarning` | `bool` | - | - | `false` | Indicates the input field has a warning |
2020-07-17 11:33:59 +00:00
| `id` | `string` | - | - | - | Used as HTML `id` property |
| `isDisabled` | `bool` | - | - | `false` | Indicates that the field cannot be used (e.g not authorised, or changes not saved) |
| `name` | `string` | - | - | - | Used as HTML `name` property |
| `onInput` | `func` | - | - | - | Called when a file is selected |
| `placeholder` | `string` | - | - | - | Placeholder text for the input |
2020-07-17 12:16:14 +00:00
| `scale` | `bool` | - | - | `false` | Indicates the input field has scale |
2020-07-17 11:33:59 +00:00
| `size` | `string` | - | `base`, `middle`, `big`, `huge`, `large` | `base` | Supported size of the input fields. |
| `style` | `obj`, `array` | - | - | - | Accepts css style |
| `accept` | `string` | - | - | - | Specifies files visible for upload |