forceChatter:feed

Represents a Chatter feed.

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.

<aura:component implements="force:appHostable">
    <forceChatter:feed type="groups"/>	    
</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.

<aura:component implements="force:appHostable">
    <aura:handler name="init" value="{!this}" action="{!c.doInit}"/>
    <aura:attribute name="type" type="String" default="News" description="The type of feed" access="GLOBAL"/>
    <aura:attribute name="types" type="String[]"
                    default="Bookmarks,Company,Files,Groups,Home,News,People"
                    description="A list of feed types"/>
   <h1>My Feeds</h1>
   <ui:inputSelect aura:id="typeSelect" change="{!c.onChangeType}" label="Type"/>
    <div aura:id="feedContainer" class="feed-container">
        <forceChatter:feed />
    </div>	
</aura:component>

The types attribute specifies the feed types, which are set on the ui:inputSelect component during component initialization. When a user selects a feed type, the feed is dynamically created and displayed.

({
    // Handle component initialization 
    doInit : function(component, event, helper) {
        var type = component.get("v.type");
        var types = component.get("v.types");
        var typeOpts = new Array();
    
        // Set the feed types on the ui:inputSelect component
        for (var i = 0; i < types.length; i++) {
            typeOpts.push({label: types[i], value: types[i], selected: types[i] === type});
        }
        component.find("typeSelect").set("v.options", typeOpts);
    },
    
	onChangeType : function(component, event, helper) {
        var typeSelect = component.find("typeSelect");
        var type = typeSelect.get("v.value");
        component.set("v.type", type);
		
        // Dynamically create the feed with the specified type
        $A.createComponent("forceChatter:feed", {"type": type}, function(feed) {
            var feedContainer = component.find("feedContainer");
            feedContainer.set("v.body", feed);	
        });
    }
})

The feed is supported for Salesforce1 only. You can include the feed in a component and access it in the Salesforce1 app. For a list of feed types, see the Chatter REST API Developer's Guide.

Attributes

Attribute Name Attribute Type Description Required?
body Component[] The body of the component. In markup, this is everything in the body of the tag.
feedDesign String Valid values include DEFAULT ( shows inline comments on desktop, a bit more detail ) or BROWSE ( primarily an overview of the feed items )
subjectId String For most feeds tied to an entity, this is used specified the desired entity. Defaults to the current user if not specified
type String The strategy used to find items associated with the subject. Valid values include: News, Home, Record, To.