Skip to content

Commit 61e6716

Browse files
feat(uui-input-file): Only show add button when multiple or no file selected (#395)
* Update uui-input-file.element.ts Only show add button when multiple or no file selected * missing import --------- Co-authored-by: Jacob Overgaard <[email protected]>
1 parent c817a5d commit 61e6716

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

packages/uui-input-file/lib/uui-input-file.element.ts

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { defineElement } from '@umbraco-ui/uui-base/lib/registration';
22
import { property, query, state } from 'lit/decorators.js';
3-
import { css, html, LitElement } from 'lit';
3+
import { css, html, LitElement, nothing } from 'lit';
44
import { UUIFileDropzoneElement } from '@umbraco-ui/uui-file-dropzone/lib';
55
import { FormControlMixin } from '@umbraco-ui/uui-base/lib/mixins';
66
import { demandCustomElement } from '@umbraco-ui/uui-base/lib/utils';
@@ -265,11 +265,13 @@ export class UUIInputFileElement extends FormControlMixin(LitElement) {
265265
label="Drop files here"></uui-file-dropzone>
266266
<div id="files">
267267
${this._renderFiles()}
268-
<uui-button
269-
@click=${this._handleClick}
270-
id="add-button"
271-
look="placeholder"
272-
label="Add"></uui-button>
268+
${this._files.length === 0 || this.multiple
269+
? html`<uui-button
270+
@click=${this._handleClick}
271+
id="add-button"
272+
look="placeholder"
273+
label="Add"></uui-button>`
274+
: nothing}
273275
</div>
274276
`;
275277
}

0 commit comments

Comments
 (0)