twbs / icons

Official open source SVG icon library for Bootstrap.
https://icons.getbootstrap.com
MIT License
7.39k stars 1.06k forks source link

TypeScript - Enumerate Icon Names #2063

Open titouandk opened 3 weeks ago

titouandk commented 3 weeks ago

Prerequisites

Proposal

Will it be possible to create a TypeScript type to enumerate all existing icons?

Like bi-arrow-left, bi-three-dots-vertical, ...

Motivation and context

Useful to provide autocompletion on bootstrap icons, or to restrict possible values when passing an icon to a component.

titouandk commented 2 weeks ago

I think that the types should rather follow the names given in the Bootstrap Icons doc (without the bi bi- prefixes we add in the CSS class).

Like arrow-left, share, ...

Here is a TS type file created listing the node_modules/bootstrap-icons/icons directory, using the following command:

ls icons/*.svg | sed 's|.*/||; s|\.svg$||' > icons_list.txt

The output has been post-processed to create the .ts file.