## class: `WyUpload`, `wy-upload`

Component for handling native file input and upload as a blob.

**Used sub components:**

*   [`<wy-button>`](./ui/wy-button)

### Fields

| Name     | Type                  | Default | Description                                    | Inherited From |
| -------- | --------------------- | ------- | ---------------------------------------------- | -------------- |
| `label`  | `string \| undefined` |         |                                                |                |
| `accept` | `string \| undefined` |         | File types to allow in the native file picker. |                |

### Methods

| Name             | Description                                          | Parameters                        | Return                       | Inherited From    |
| ---------------- | ---------------------------------------------------- | --------------------------------- | ---------------------------- | ----------------- |
| `whenReady`      | Resolves when the component has rendered first time. |                                   | `Promise<WeavySubComponent>` | WeavySubComponent |
| `dispatchAction` | Dispatch a \`wy-action\` event on the component.     | `detail: WyActionEventDetailType` | `boolean`                    | WeavySubComponent |

### Events

| Name            | Type                    | Description                      | Inherited From    |
| --------------- | ----------------------- | -------------------------------- | ----------------- |
| `blob-uploaded` | `BlobUploadedEventType` |                                  |                   |
| `ready`         | `CustomEvent`           | When the component has rendered. | WeavySubComponent |

### CSS Parts

| Name                    | Description                           |
| ----------------------- | ------------------------------------- |
| `wy-upload`             | The upload component.                 |
| `wy-upload-placeholder` | Slot for placeholder content.         |
| `wy-upload-action`      | Slot for the button of the input.     |
| `wy-upload-button`      | The default upload button with label. |

### Slots

| Name          | Description                            |
| ------------- | -------------------------------------- |
| `placeholder` | Placeholder content.                   |
| `action`      | Slot for replacing the default button. |

<details><summary>Private API</summary>

### Fields

| Name                | Privacy | Type                                                  | Default                                                              | Description | Inherited From    |
| ------------------- | ------- | ----------------------------------------------------- | -------------------------------------------------------------------- | ----------- | ----------------- |
| `#resolveContextId` | private | `(contextId: ContextIdType) => void \| undefined`     |                                                                      |             | WeavySubComponent |
| `#whenContextId`    | private |                                                       | `new Promise<ContextIdType>((r) => { this.#resolveContextId = r; })` |             | WeavySubComponent |
| `#resolveUser`      | private | `(user: UserType) => void \| undefined`               |                                                                      |             | WeavySubComponent |
| `#whenUser`         | private |                                                       | `new Promise<UserType>((r) => { this.#resolveUser = r; })`           |             | WeavySubComponent |
| `#resolveWeavy`     | private | `(weavy: WeavyType) => void \| undefined`             |                                                                      |             | WeavySubComponent |
| `#whenWeavy`        | private |                                                       | `new Promise<WeavyType>((r) => { this.#resolveWeavy = r; })`         |             | WeavySubComponent |
| `#resolveReady`     | private | `(component: WeavySubComponent) => void \| undefined` |                                                                      |             | WeavySubComponent |
| `#whenReady`        | private |                                                       | `new Promise<WeavySubComponent>((r) => { this.#resolveReady = r; })` |             | WeavySubComponent |

</details>

<hr/>

## Exports

| Kind                        | Name        | Declaration | Module                      | Package |
| --------------------------- | ----------- | ----------- | --------------------------- | ------- |
| `js`                        | `WyUpload`  | WyUpload    | lib/components/wy-upload.ts |         |
| `custom-element-definition` | `wy-upload` | WyUpload    | lib/components/wy-upload.ts |         |
