You need to sign in to do that
Don't have an account?
Ken Koellner @ Engageware
Select one of several items with icon when all are always visible in aura component
I'd like to put up a list of items such that all are always visible, not like a combo box / dropdown. One is preselected and the user may leave it or select a different one. I can do it with a single tag with lightning:radioGroup. But radioGroup only always the label to be text. I'd like to have a litlte block with an icon and a name. I'd like something like the example "Tiles in a List" on lightning-tile where one item may be selected.
Any idea of a tag, combination of tags, are styles to do that, preferable a snippet of code as an example.
Any idea of a tag, combination of tags, are styles to do that, preferable a snippet of code as an example.
I can code--
but what I want is --
I'm using lightning:verticalNavigationItem as an example but it's the same for lightning:radioGroup. I'm using radioGroup name and it works just fine with virtually no code to write but I'd like to get something fancier than a simple text label for each option.
It is not an pre-existing component of Salesforce (we create our own one).
onclick still works with a minimal access to the properties of the event (target id).
The standard slds tags mixed "display:block" and "display:flex" and that is problem for slds-nav-vertical__action.
You can override it (slds-nav-vertical__action2) and change the display parameter only.
Active and hover just change the width of the border blue bar on the left and the font weight for the visual effects.
Same CSS as last example.
The questions with SLDS are linked with the CSS (nice look) but you can achieve the same result with a list and checkboxes indeed (that was not the question).
There are many alternatives if you want to select many items and your list above is already sufficient for you. Good.