Skip to content

The table uses key for the label when assigned an empty string #1582

@miss-manners

Description

@miss-manners

In the table component, the label is assigned as follows.

f.label = f.label || startCase(f.key)

(Permalink to this line in the table component)

But evaluating f.label this way means that the empty string will be falsy and f.key will be used instead.

An empty label is common in actionable columns where a header may not be desirable. It would be reasonable to assume that a user would provide an empty string in this case, but doing so provides a confusing result.

The documentation notes that the label, "Defaults to the field's key (in humanized format) if not provided." But that is deceptive because a standard user would assume providing an empty string is providing a value.
(Link to this section in the documentation)

I suggest modifying this assignment to allow empty string, and making it clear in the documentation that any other falsy value will result in the key being used.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions