Feed
forceChatter:feed
Represents a Chatter Feed.
For Use In
Lightning Experience, Experience Builder Sites
A forceChatter:feed component represents a feed that’s specified by its type. Use the type attribute to display a specific feed type. For example, set type="groups" to display the feed from all groups the context user either owns or is a member of.
1<aura:component implements="force:appHostable">
2 <forceChatter:feed type="groups"/>
3</aura:component>You can also display a feed depending on the type selected. This example provides a drop-down menu that controls the type of feed to display
1<aura:component implements="force:appHostable">
2 <aura:handler name="init" value="{!this}" action="{!c.doInit}"/>
3 <aura:attribute name="options" type="List" />
4 <aura:attribute name="type" type="String" default="News" description="The type of feed" access="GLOBAL"/>
5 <aura:attribute name="types" type="String[]"
6 default="Bookmarks,Company,DirectMessages,Feeds,Files,Filter,Groups,Home,Moderation,Mute,News,PendingReview,Record,Streams,To,Topics,UserProfile"
7 description="A list of feed types"/>
8 <h1>My Feeds</h1>
9 <lightning:select aura:id="typeSelect" onchange="{!c.onChangeType}" label="Type" name="typeSelect">
10 <aura:iteration items="{!v.options}" var="item">
11 <option text="{!item.label}" value="{!item.value}" selected="{!item.selected}"/>
12 </aura:iteration>
13 </lightning:select>
14 <div aura:id="feedContainer" class="feed-container">
15 <forceChatter:feed />
16 </div>
17</aura:component>The types attribute specifies the feed types, which are set on the lightning:select component during component initialization. When a user selects a feed type, the feed is dynamically created and displayed.
1({
2 // Handle component initialization
3 doInit: function (component, event, helper) {
4 var type = component.get("v.type");
5 var types = component.get("v.types");
6 var opts = new Array();
7
8 // Set the feed types on the lightning:select component
9 for (var i = 0; i < types.length; i++) {
10 opts.push({
11 label: types[i],
12 value: types[i],
13 selected: types[i] === type,
14 });
15 }
16 component.set("v.options", opts);
17 },
18
19 onChangeType: function (component, event, helper) {
20 var typeSelect = component.find("typeSelect");
21 var type = typeSelect.get("v.value");
22 component.set("v.type", type);
23
24 // Dynamically create the feed with the specified type
25 $A.createComponent("forceChatter:feed", { type: type }, function (feed) {
26 var feedContainer = component.find("feedContainer");
27 feedContainer.set("v.body", feed);
28 });
29 },
30});The feed component is supported for Lightning Experience and Experience Builder sites based on the Customer Service, Customer Account Portal, Partner Central, and Build Your Own templates.
For a list of feed types, see the Chatter REST API Developer’s Guide.
Attributes
| Name | Description | Type | Default | Required |
|---|---|---|---|---|
| body | The body of the component. In markup, this is everything in the body of the tag. | Aura.Component[] | ||
| feedDesign | Valid values include DEFAULT ( shows inline comments on desktop, a bit more detail ) or BROWSE ( primarily an overview of the feed items ) | String | BROWSE | |
| subjectId | For most feeds tied to an entity, this is used specified the desired entity. Defaults to the current user if not specified | String | ||
| type | The strategy used to find items associated with the subject. Valid values include: Bookmarks, Company, DirectMessages, Feeds, Files, Filter, Groups, Home, Moderation, Mute, News, PendingReview, Record, Streams, To, Topics, UserProfile. | String |