arsenaltech / nova-tab

Laravel Nova Tabs
74 stars 17 forks source link

[Feature] Allow to add icon to tabs #7

Closed bernhardh closed 6 years ago

bernhardh commented 6 years ago

It would be great, if we could add extra HTML to tab-title for example to add icons.

image

If you do it directly:

new NovaTab('<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" class="sidebar-icon"><path fill="var(--sidebar-icon)" d="M3 1h4c1.1045695 0 2 .8954305 2 2v4c0 1.1045695-.8954305 2-2 2H3c-1.1045695 0-2-.8954305-2-2V3c0-1.1045695.8954305-2 2-2zm0 2v4h4V3H3zm10-2h4c1.1045695 0 2 .8954305 2 2v4c0 1.1045695-.8954305 2-2 2h-4c-1.1045695 0-2-.8954305-2-2V3c0-1.1045695.8954305-2 2-2zm0 2v4h4V3h-4zM3 11h4c1.1045695 0 2 .8954305 2 2v4c0 1.1045695-.8954305 2-2 2H3c-1.1045695 0-2-.8954305-2-2v-4c0-1.1045695.8954305-2 2-2zm0 2v4h4v-4H3zm10-2h4c1.1045695 0 2 .8954305 2 2v4c0 1.1045695-.8954305 2-2 2h-4c-1.1045695 0-2-.8954305-2-2v-4c0-1.1045695.8954305-2 2-2zm0 2v4h4v-4h-4z"></path></svg> Images', [
                ...
]),

it works, but you will also have the html stuff in the url/permalink like so:

https://www.test.local/nova/resources/cities/34/edit#%3Csvg-xmlns=%22http://www.w3.org/2000/svg%22-viewbox=%220-0-20-20%22-class=%22sidebar-icon%22%3E%3Cpath-fill=%22var(--sidebar-icon)%22-d=%22m3-1h4c1.1045695-0-2-.8954305-2-2v4c0-1.1045695-.8954305-2-2-2h3c-1.1045695-0-2-.8954305-2-2v3c0-1.1045695.8954305-2-2-2zm0-2v4h4v3h3zm10-2h4c1.1045695-0-2-.8954305-2-2v4c0-1.1045695-.8954305-2-2-2h-4c-1.1045695-0-2-.8954305-2-2v3c0-1.1045695.8954305-2-2-2zm0-2v4h4v3h-4zm3-11h4c1.1045695-0-2-.8954305-2-2v4c0-1.1045695-.8954305-2-2-2h3c-1.1045695-0-2-.8954305-2-2v-4c0-1.1045695.8954305-2-2-2zm0-2v4h4v-4h3zm10-2h4c1.1045695-0-2-.8954305-2-2v4c0-1.1045695-.8954305-2-2-2h-4c-1.1045695-0-2-.8954305-2-2v-4c0-1.1045695.8954305-2-2-2zm0-2v4h4v-4h-4z%22%3E%3C/path%3E%3C/svg%3E-bilder

So, maybe you could filter out HTML from the link.

shabbirbharmal commented 6 years ago

Added 3rd argument to NovaTab constructor which accepts html and can be used to override label