question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Improve icon integration

See original GitHub issue

This function solves the problem (这个功能解决的问题)

The use of icons in buttons and menu’s is not very elegant and a lot of work. For example: To add an icon to a button, a template slot must be used, that contains an NIcon, that wraps an icon component, like this:

<NButton>
  <template #icon>
    <NIcon>
      <LinkOutlined/>
    </NIcon>
 </template
</NButton>

That is 7 lines for every icon. This adds a mental load reading code. Instead of seeing, ‘icon=…’ that simply expresses the intent to show an icon, there is all this code to read. This is what I mean with not very elegant.

Similarly, Showing an icon in a Dropdown, the docs recommend adding renderIcon function to the ‘icon’ field in the menu items. This too is cumbersome and distracting.

Expected API (期望的 API)

The proposed usage is to simply specify the icon component:

<NButton :icon="LinkOutlined" />

and for Dropdowns the item would contain a field {icon: LinkOutlined}

This minimizes the mental load in understanding the intent and is very elegant due to its simplicity.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:2
  • Comments:6

github_iconTop GitHub Comments

1reaction
hspaaycommented, Dec 13, 2021

Yes maintenance is always a concern. It would be nice if we would not be bound to this restriction.

I would like to offer the thought that fewer artifacts in the code makes it more readable for the user. After 25 years in development I’ve come to appreciate simplicity code. It looks like we have a different perspective on this.

Thank you kindly for taking the time to reply and for your efforts on naive-ui. I wish you good luck with this library.

0reactions
cardosofelipecommented, Jul 4, 2022

Hello, I would like to bump this feature request, this would be a great improvement over the current implementation. Maybe you could make a specific component: NIconButton. Could be something simple which accepts only an icon and renders a button with one-liner: <NIconButton :icon="LinkOutlined"/> Or something like that.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Improve icon integration · Issue #1829 · tusen-ai/naive-ui
This function solves the problem (这个功能解决的问题) The use of icons in buttons and menu's is not very elegant and a lot of work....
Read more >
ICON Integration Update – September 2022
The ICON Bridge integration with Binance Smart Chain has gone smoothly and the team has continued to patch recommended fixes and increase ......
Read more >
Icon Integration is Now Accenture
Accenture expands its enterprise warehouse supply chain and data analytics capabilities with the acquisition of Icon Integration in ANZ. Learn more.
Read more >
Integration update | ICON plc and PRA Health Sciences
There is a clear intent that the integration of ICON and PRA will be managed carefully, and over time. Both organisations have a...
Read more >
68332 Integration Icon Images, Stock Photos & Vectors
Find Integration Icon stock images in HD and millions of other ... Improve Efficiency, Integrated OT Security and Minimize Safety Risk Icons Stock...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found