Skip to content

FileInput does not support empty label #2716

@cschilbe

Description

@cschilbe

Current Behaviour

The FileInput component supports the buttonLabel prop and the InputFile.Button component supports the label prop but assigning an empty string (label="") results in the component rendering the default label of Upload File.

Image

Expected Behaviour

I would like to be able to assign and empty string to the label prop and have the button component rendered without a label so I can use the component as an icon only button.

Image

Proposal

The fix appears to be a trivial change here https://github.com/GetJobber/atlantis/blob/master/packages/components/src/InputFile/InputFileButton.tsx#L25

label={label || contextLabel}

to:

label={label ?? contextLabel}

If label is defined then it is used even if empty instead of only used if not empty. This shouldn't have unintended impacts as the prop is not required so likely is not passed as empty string when the default is actually wanted.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions