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.

Feature: sublabels / option slots

See original GitHub issue

I would like to customize the options adding a new gray sublabel, like count but with my own text. The best solution would probably be a slot that allows the users of this component to change the labels with our own custom HTML:

<treeselect ...>
  <template slot="option" slot-scope="option">
    {{option.label}}
    ...other things i want to customize the label with here...
  </template>
</treeselect>

You can provide a default slot implementation as a fallback, so it’s a completely backwards compatible change and only adds new functionality.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

4reactions
riophaecommented, Nov 6, 2017

Hey, I just added the slot. It would be like this to use it:

<treeselect ...>
  <template slot="option" slot-scope="{ option }">
    {{option.label}}
    ...other things i want to customize the label with here...
  </template>
</treeselect>

Note that, slot-scope="{ option }" used destructuring. The option variable provides a lot of properties (e.g. isBranch, isLeaf, ancestors, level, …etc) for your template to consume. You can also use option.raw to access the original option data you passed to the component.

Another thing worth noting is that, since the count text is implemented in the fallback content, if you customized the slot then you have to implement the count text yourself too if you are using it.

Do you think the API design fits your needs? Any suggestions are welcome!

0reactions
riophaecommented, Mar 7, 2018

Hi, really sorry it took too long to have this feature finished. Just to let you know I just shipped it in v0.0.7.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Provide a slot for QOptionGroup to customise the label content
I'd like to use QOptionGroup for some of those settings, but can't follow that style, as there is no 'sublabel' prop, nor a...
Read more >
show security monitoring performance spu | Junos OS
Display the services processing unit (SPU) percent utilization for all FPC slots over the last 60 seconds. Use this command to track the...
Read more >
Voice Extensible Markup Language (VoiceXML) Version 2.0
A menu presents the user with a choice of options and then transitions to another dialog based on that choice. A subdialog is...
Read more >
IT – Applications Training and Support - SharpSchool
Creating Sublabels (Similar to Subfolders) . ... Calendar Appointment Slots – Sending Sign-Up Link to Staff .
Read more >
How to use the langcodes.tag_parser.LanguageTagError ...
To help you get started, we've selected a few langcodes.tag_parser.LanguageTagError examples, based on popular ways it is used in public projects.
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