This commit is contained in:
retoor 2026-06-11 15:04:01 +02:00
parent 205a8e1b08
commit 13e9bee16c
3 changed files with 6 additions and 3 deletions

View File

@ -29,7 +29,10 @@ export class AppUpload extends Component {
'<span class="dp-upload-icon">&#x1F4CE;</span>' +
'<span class="dp-upload-label"></span>' +
'<span class="dp-upload-count" hidden></span>';
this.button.querySelector(".dp-upload-label").textContent = this.attr("label", "Attach files");
const label = this.attr("label", "");
const labelEl = this.button.querySelector(".dp-upload-label");
labelEl.textContent = label;
labelEl.hidden = !label;
this.countEl = this.button.querySelector(".dp-upload-count");
this.input = document.createElement("input");

View File

@ -22,7 +22,7 @@ Set with the `mode` attribute:
| Attribute | Default | Description |
|---|---|---|
| `mode` | `attachment` | `attachment`, `direct`, or `field`. |
| `label` | `Attach files` | Button text. |
| `label` | (none) | Optional button text shown beside the icon. |
| `multiple` | off | Allow selecting more than one file. |
| `directory` | off | Allow selecting a whole directory (`webkitdirectory`). |
| `accept` | (none) | Native accept filter, e.g. `image/*`. |

View File

@ -146,7 +146,7 @@
<div class="auth-field auth-field-gap">
<label>Add an image (optional)</label>
<dp-upload mode="field" field-name="image" accept="image/*" label="Add image"></dp-upload>
<dp-upload mode="field" field-name="image" accept="image/*"></dp-upload>
</div>
<div class="auth-field auth-field-gap">