UI Components

Need

  • Reused across environments
  • Loaded server-side
  • Loaded client-side

Blocks of content/behavior that can be:

Design goals

  • Full power of layouts
  • MVC routing conventions
  • Standard dependency interface
  • Basic content negotiation
  • Server- and client-side loaders
public interface IComponentManifest
{
    string HtmlBody { get; set; }
    IEnumerable<string> Styles { get; set; }
    IEnumerable<string> HeadScripts { get; set; }
    IEnumerable<string> BodyScripts { get; set; }
}

Use when

  • You have a self-contained chunk of content and behavior
     
  • You need to share functionality between different environments (e.g., Web and MVC)

Don't use when

  • A simple partial will do

UI Components

By Daniel Poindexter

UI Components

  • 396