@@ -68,6 +68,7 @@ private static IReactEnvironment Environment
6868 /// <param name="containerId">ID to use for the container HTML tag. Defaults to an auto-generated ID</param>
6969 /// <param name="clientOnly">Skip rendering server-side and only output client-side initialisation code. Defaults to <c>false</c></param>
7070 /// <param name="serverOnly">Skip rendering React specific data-attributes during server side rendering. Defaults to <c>false</c></param>
71+ /// <param name="containerClass">HTML class(es) to set on the container tag</param>
7172 /// <returns>The component's HTML</returns>
7273 public static IHtmlString React < T > (
7374 this IHtmlHelper htmlHelper ,
@@ -76,14 +77,19 @@ public static IHtmlString React<T>(
7677 string htmlTag = null ,
7778 string containerId = null ,
7879 bool clientOnly = false ,
79- bool serverOnly = false
80+ bool serverOnly = false ,
81+ string containerClass = null
8082 )
8183 {
8284 var reactComponent = Environment . CreateComponent ( componentName , props , containerId ) ;
8385 if ( ! string . IsNullOrEmpty ( htmlTag ) )
8486 {
8587 reactComponent . ContainerTag = htmlTag ;
8688 }
89+ if ( ! string . IsNullOrEmpty ( containerClass ) )
90+ {
91+ reactComponent . ContainerClass = containerClass ;
92+ }
8793 var result = reactComponent . RenderHtml ( clientOnly , serverOnly ) ;
8894 return new HtmlString ( result ) ;
8995 }
@@ -100,21 +106,27 @@ public static IHtmlString React<T>(
100106 /// <param name="htmlTag">HTML tag to wrap the component in. Defaults to <div></param>
101107 /// <param name="containerId">ID to use for the container HTML tag. Defaults to an auto-generated ID</param>
102108 /// <param name="clientOnly">Skip rendering server-side and only output client-side initialisation code. Defaults to <c>false</c></param>
109+ /// <param name="containerClass">HTML class(es) to set on the container tag</param>
103110 /// <returns>The component's HTML</returns>
104111 public static IHtmlString ReactWithInit < T > (
105112 this IHtmlHelper htmlHelper ,
106113 string componentName ,
107114 T props ,
108115 string htmlTag = null ,
109116 string containerId = null ,
110- bool clientOnly = false
117+ bool clientOnly = false ,
118+ string containerClass = null
111119 )
112120 {
113121 var reactComponent = Environment . CreateComponent ( componentName , props , containerId ) ;
114122 if ( ! string . IsNullOrEmpty ( htmlTag ) )
115123 {
116124 reactComponent . ContainerTag = htmlTag ;
117125 }
126+ if ( ! string . IsNullOrEmpty ( containerClass ) )
127+ {
128+ reactComponent . ContainerClass = containerClass ;
129+ }
118130 var html = reactComponent . RenderHtml ( clientOnly ) ;
119131
120132#if LEGACYASPNET
0 commit comments