Interface IHtmlTag
Public interface for all Html5Tags
Inherited Members
Namespace: ToSic.Razor.Blade
Assembly: ToSic.Razor.dll
Syntax
public interface IHtmlTag : ITag, IEnumerable<ITag>, IEnumerable
Methods
| Improve this Doc View SourceAdd(Object[])
Add contents to this tag - at the end of the already added contents. If you want to replace the contents, use Wrap() instead
Declaration
IHtmlTag Add(params object[] children)
Parameters
Type | Name | Description |
---|---|---|
System.Object[] | children | a variable amount of tags / strings to add to the contents of this tag |
Returns
Type | Description |
---|---|
IHtmlTag | A new IHtmlTag object with the changes, allowing a fluid API |
Attr(Object)
Quickly add an attribute it always returns the tag itself again, allowing chaining of multiple add-calls
Declaration
IHtmlTag Attr(object nameWithValue)
Parameters
Type | Name | Description |
---|---|---|
System.Object | nameWithValue | Object which can be ToString()ed |
Returns
Type | Description |
---|---|
IHtmlTag | A new IHtmlTag object with the changes, allowing a fluid API |
Attr(String, Object, String)
Quickly add an attribute it always returns the tag itself again, allowing chaining of multiple add-calls
Declaration
IHtmlTag Attr(string name, object value = null, string appendSeparator = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | the attribute name, or a complete value like "name='value'" |
System.Object | value | optional value - if the attribute already exists, it will be appended |
System.String | appendSeparator | attribute appendSeparator in case the value is appended |
Returns
Type | Description |
---|---|
IHtmlTag | A new IHtmlTag object with the changes, allowing a fluid API |
Class(String)
class attribute
Declaration
IHtmlTag Class(string value)
Parameters
Type | Name | Description |
---|---|---|
System.String | value |
Returns
Type | Description |
---|---|
IHtmlTag | A new IHtmlTag object with the changes, allowing a fluid API |
Data(String, Object)
Add a data-... attribute
Declaration
IHtmlTag Data(string name, object value = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | the term behind data-, so "name" becomes "data-name". If empty, will just create a "data" attribute |
System.Object | value | string or object, objects will be json serialized |
Returns
Type | Description |
---|---|
IHtmlTag | A new IHtmlTag object with the changes, allowing a fluid API |
Id(String)
ID - set multiple times always overwrites previous ID
Declaration
IHtmlTag Id(string id)
Parameters
Type | Name | Description |
---|---|---|
System.String | id |
Returns
Type | Description |
---|---|
IHtmlTag | A new IHtmlTag object with the changes, allowing a fluid API |
On(String, Object)
Add a onEventName attribute for javascript events
Declaration
IHtmlTag On(string name, object value = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | the term behind data-, so "name" becomes "data-name" |
System.Object | value | string or object, objects will be json serialized |
Returns
Type | Description |
---|---|
IHtmlTag | A new IHtmlTag object with the changes, allowing a fluid API |
Style(String)
style attribute. If called multiple times, will append styles.
Declaration
IHtmlTag Style(string value)
Parameters
Type | Name | Description |
---|---|---|
System.String | value | Style to add |
Returns
Type | Description |
---|---|
IHtmlTag | A new IHtmlTag object with the changes, allowing a fluid API |
Title(String)
title attribute
Declaration
IHtmlTag Title(string value)
Parameters
Type | Name | Description |
---|---|---|
System.String | value | new title to set |
Returns
Type | Description |
---|---|
IHtmlTag | A new IHtmlTag object with the changes, allowing a fluid API |
Wrap(Object[])
Wrap the tag around the new content, so this replaces all the content with what you give it
Declaration
IHtmlTag Wrap(params object[] content)
Parameters
Type | Name | Description |
---|---|---|
System.Object[] | content | a variable amount of tags / strings to add to the contents of this tag |
Returns
Type | Description |
---|---|
IHtmlTag | A new IHtmlTag object with the changes, allowing a fluid API |