Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/cijiugechu/react-file-attachment
React bindings for file-attachment-element
https://github.com/cijiugechu/react-file-attachment
binding component file-attachment react
Last synced: 8 days ago
JSON representation
React bindings for file-attachment-element
- Host: GitHub
- URL: https://github.com/cijiugechu/react-file-attachment
- Owner: cijiugechu
- License: mit
- Created: 2022-05-01T16:00:35.000Z (over 2 years ago)
- Default Branch: master
- Last Pushed: 2022-05-02T05:29:38.000Z (over 2 years ago)
- Last Synced: 2023-08-24T08:53:55.598Z (about 1 year ago)
- Topics: binding, component, file-attachment, react
- Language: TypeScript
- Homepage: https://cijiugechu.github.io/react-file-attachment/
- Size: 75.2 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# react-file-attachment
React bindings for [file-attachment-element](https://github.com/github/file-attachment-element).
## Installation
```bash
npm install react-file-attachment
# or yarn
yarn add react-file-attachment
# or pnpm
pnpm add react-file-attachment
```## Usage
#### Plain
```jsx
import FileAttachment from 'react-file-attachment';const App = () => {
return (
Your tips here
)
}
```#### specifying the file types
```jsx
import FileAttachment from 'react-file-attachment';const App = () => {
return (
Your tips here
)
}
```#### render accepted file names
```jsx
import FileAttachment from 'react-file-attachment';const App = () => {
return (
{
return fileNames.map((n) => {n})
}}
>
Your tips here
)
}
```#### styling the element
```jsx
import FileAttachment from 'react-file-attachment';const App = () => {
return (
Your tips here
)
}
```#### events
```tsx
import FileAttachment from 'react-file-attachment';
import type {FileAcceptEvent, FileAcceptEvented} from 'react-file-attachment';const App = () => {
const onFileAccept = (evt: FileAcceptEvent) => {
console.log(evt.detail.attachments);
}const onFileAccepted = (evt: FileAcceptedEvent) => {
console.log(evt.detail.attachments);
}
return (
Your tips here
)
}
```