palantir / blueprint

A React-based UI toolkit for the web
https://blueprintjs.com/
Apache License 2.0
20.51k stars 2.15k forks source link

Suggestion: Export Icons with "Icon" Appended to Component Name #6258

Open dylangrandmont opened 1 year ago

dylangrandmont commented 1 year ago

Environment

Feature request

The introduction of statically imported icons is a nice improvement in v5. Unfortunately the icon names can look ambiguous when reading code, especially for icons with generic names. For example, <Icon icon={IconNames.USER} /> was very clear while <User /> is ambiguous without looking at the import statement it comes from (i.e. it is not clear that this component is an icon).

I suggest appending the word "Icon" to all the exported names of these components. For the above example, <UserIcon />. This change could be introduced in a backwards compatible way with the non-appended names marked as deprecated. This pattern exists in other UI libraries, like material-ui.

Sorry to not have noticed this and provided feedback prior to v5's release.

Examples

Current

import { Download } from "@blueprintjs/icons";

...
    <Download size={16} />}

Proposal

import { DownloadIcon } from "@blueprintjs/icons";

...
    <DownloadIcon size={16} />}
adidahiya commented 1 year ago

Fair point, I will consider this API improvement for v5.x.