3

It appears like lightning:carousel requires lightning:carouselImage for each panel within it. Unfortunately lightning:carouselImage is not documented at all as of this ask.

FAILS:

<lightning:carousel>
    <aura:iteration items="{!v.records.data}" var="r" indexVar="i">
        <lightning:formattedRichText value="{!r.Message_Body__c}"/>
    </aura:iteration>
</lightning:carousel>

WORKS:

    <lightning:carousel>
        <aura:iteration items="{!v.records.data}" var="r" indexVar="i">
            <lightning:carouselImage
                     src = "/_slds/icons/utility-sprite/svg/symbols.svg?cache=9.8.0#notification"
                     header = "{!r.Message_Title__c}"
                     description = "{!r.Message_Body__c}"
                     alternativeText = "{!r.Message_Title__c}"/>
        </aura:iteration>
    </lightning:carousel>

BUT, THE QUESTION IS:

Message_Body__c is setup as a rich text area field. And when used as above, this is how it looks:

enter image description here

Is there a way to display formatted rich text in the description? Well, not really looking to implement/reinvent a custom carousel component via their SLDS and custom methods.

  • Maybe you could use the dreamhouse carousel? github.com/dreamhouseapp/dreamhouse-sfdx/blob/master/force-app/… – Caspar Harmer Jun 14 '18 at 23:46
  • Ummm... I am looking for formatted 'text' within a carousel panel. The example you provided doesn't take header/description parameters into consideration at all, instead shows images which is not what I am looking for. Plus, I realized that this question is somewhat broader. Meaning, how can we show rich text when using notices and/or toasts via the lightning:notificationsLibrary? Or even 'message' parameter in $A.get('e.force:showToast')? – Lightning Evangelist Jun 15 '18 at 15:11
  • Yes, but since the component will be modifiable, you can control what displays... so you can put what you like there. ie, you create this component in your org and modify how it works. – Caspar Harmer Jun 15 '18 at 20:49
  • In that modifiable component, how can you pass rich text to lightning:carouselImage? Or are you saying we can put anything (like lightning:inputRichText) within lightning:carousel? Neither work for me as stated in the question. Do you mind spinning up a concept for me please? – Lightning Evangelist Jun 15 '18 at 21:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.