Skip to content

Commit e5585e1

Browse files
committed
feat(form): FileInput automatically swaps button type to text if children exist
1 parent 1508812 commit e5585e1

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

packages/form/src/file-input/FileInput.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ export const FileInput = forwardRef<HTMLInputElement, FileInputProps>(
7878
children: propChildren,
7979
theme = "primary",
8080
themeType = "contained",
81-
buttonType = "icon",
81+
buttonType = propChildren ? "text" : "icon",
8282
multiple = false,
8383
disableIconSpacing: propDisableIconSpacing,
8484
disableRepeatableFiles = false,

packages/form/src/file-input/__tests__/__snapshots__/FileInput.tsx.snap

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ exports[`FileInput should render correctly 2`] = `
3939
value=""
4040
/>
4141
<label
42-
class="rmd-file-input-label rmd-button rmd-button--icon rmd-button--contained rmd-button--primary"
42+
class="rmd-file-input-label rmd-button rmd-button--text rmd-button--contained rmd-button--primary"
4343
for="input"
4444
>
4545
<i
@@ -65,7 +65,7 @@ exports[`FileInput should render correctly 3`] = `
6565
value=""
6666
/>
6767
<label
68-
class="rmd-file-input-label rmd-button rmd-button--icon rmd-button--contained rmd-button--primary"
68+
class="rmd-file-input-label rmd-button rmd-button--text rmd-button--contained rmd-button--primary"
6969
for="input"
7070
>
7171
Custom children and no Icon

0 commit comments

Comments
 (0)