• Home
  • Articles
  • API Documentation
Search Results for

    Show / Hide Table of Contents
    • ToSic.Razor.Blade
      • IHtmlTag
      • IHtmlTagsService
      • IScrub
      • Tag
      • Tags
      • Text
    • ToSic.Razor.Html5
      • A
      • Abbr
      • Address
      • Area
      • Article
      • Aside
      • Audio
      • B
      • Base
      • Bdi
      • Bdo
      • Blockquote
      • Br
      • Button
      • Canvas
      • Caption
      • Cite
      • Code
      • Col
      • Colgroup
      • Comment
      • Data
      • Datalist
      • Dd
      • Del
      • Details
      • Dfn
      • Dialog
      • Div
      • Dl
      • Dt
      • Em
      • Embed
      • Fieldset
      • Figcaption
      • Figure
      • Footer
      • Form
      • H1
      • H2
      • H3
      • H4
      • H5
      • H6
      • Head
      • Header
      • Hr
      • I
      • Icon
      • Iframe
      • Img
      • Input
      • Ins
      • Kbd
      • Label
      • Legend
      • Li
      • Link
      • Main
      • Map
      • Mark
      • Meta
      • MetaOg
      • Meter
      • Nav
      • Noscript
      • Object
      • Ol
      • Optgroup
      • Option
      • Output
      • P
      • Param
      • Picture
      • Pre
      • Progress
      • Q
      • Rp
      • Rt
      • Ruby
      • S
      • Samp
      • Script
      • ScriptJsonLd
      • Section
      • Select
      • Small
      • Source
      • Span
      • Strong
      • Style
      • Sub
      • Summary
      • Sup
      • Svg
      • Table
      • Tbody
      • Td
      • Template
      • Textarea
      • Tfoot
      • Th
      • Thead
      • Time
      • Tr
      • Track
      • U
      • Ul
      • Var
      • Video
      • Wbr
    • ToSic.Razor.Markup
      • Attribute
      • AttributeOptions
      • Attributes
      • ITag
      • Tag<T>
      • TagBase
      • TagChildren
      • TagCustom
      • TagList
      • TagOptions
      • TagText
    • ToSic.Razor.StartUp
      • StartUp

    Class Tag<T>

    Helper commands to enable fluid coding with Tag Attributes and Common Helpers like Add and Wrap. This allows you to do things like

    Div().Id("myId").Class("row4").Class("xs")

    Inheritance
    System.Object
    ToSic.Razor.Markup.RawHtmlString
    TagBase
    Tag<T>
    A
    Abbr
    Address
    Area
    Article
    Aside
    Audio
    B
    Base
    Bdi
    Bdo
    Blockquote
    Br
    Button
    Canvas
    Caption
    Cite
    Code
    Col
    Colgroup
    Comment
    Data
    Datalist
    Dd
    Del
    Details
    Dfn
    Dialog
    Div
    Dl
    Dt
    Em
    Embed
    Fieldset
    Figcaption
    Figure
    Footer
    Form
    H1
    H2
    H3
    H4
    H5
    H6
    Head
    Header
    Hr
    I
    Iframe
    Img
    Input
    Ins
    Kbd
    Label
    Legend
    Li
    Link
    Main
    Map
    Mark
    Meta
    Meter
    Nav
    Noscript
    Object
    Ol
    Optgroup
    Option
    Output
    P
    Param
    Picture
    Pre
    Progress
    Q
    Rp
    Rt
    Ruby
    S
    Samp
    Script
    Section
    Select
    Small
    Source
    Span
    Strong
    Style
    Sub
    Summary
    Sup
    Svg
    Table
    Tbody
    Td
    Template
    Textarea
    Tfoot
    Th
    Thead
    Time
    Tr
    Track
    U
    Ul
    Var
    Video
    Wbr
    TagCustom
    TagText
    Implements
    System.Web.IHtmlString
    IHtmlTag
    ITag
    System.Collections.Generic.IEnumerable<ITag>
    System.Collections.IEnumerable
    Inherited Members
    TagBase.IsImmutable
    TagBase.PreProcessNewChild(Object)
    TagBase.ApplyChanges(CloneChanges)
    TagBase.TagName
    TagBase.TagOptions
    TagBase.ToString()
    TagBase.TagAttributes
    TagBase.TagChildren
    TagBase.TagStart
    TagBase.TagEnd
    Namespace: ToSic.Razor.Markup
    Assembly: ToSic.Razor.dll
    Syntax
    public abstract class Tag<T> : TagBase, IRawHtmlString, IHtmlString, IHtmlTag, ITag, IEnumerable<ITag>, IEnumerable where T : Tag<T>
    Type Parameters
    Name Description
    T

    Constructors

    | Improve this Doc View Source

    Tag(Boolean, String, TagOptions)

    Declaration
    protected Tag(bool dummyForConstructor, string tagOverride, TagOptions options = null)
    Parameters
    Type Name Description
    System.Boolean dummyForConstructor
    System.String tagOverride
    TagOptions options
    | Improve this Doc View Source

    Tag(String, Object, TagOptions)

    Declaration
    protected Tag(string name, object content, TagOptions options = null)
    Parameters
    Type Name Description
    System.String name
    System.Object content
    TagOptions options
    | Improve this Doc View Source

    Tag(String, TagOptions)

    Declaration
    protected Tag(string name = null, TagOptions options = null)
    Parameters
    Type Name Description
    System.String name
    TagOptions options
    | Improve this Doc View Source

    Tag(String, TagOptions, Object[])

    Declaration
    protected Tag(string name, TagOptions options, object[] content)
    Parameters
    Type Name Description
    System.String name
    TagOptions options
    System.Object[] content
    | Improve this Doc View Source

    Tag(Tag<T>, CloneChanges)

    Special constructor just for cloning with changes

    Declaration
    protected Tag(Tag<T> original, CloneChanges changes)
    Parameters
    Type Name Description
    Tag<T> original
    ToSic.Razor.Markup.CloneChanges changes

    Methods

    | Improve this Doc View Source

    Add(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
    public T 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
    T
    | Improve this Doc View Source

    AsHtmlTag()

    Declaration
    public IHtmlTag AsHtmlTag()
    Returns
    Type Description
    IHtmlTag
    | Improve this Doc View Source

    Attr(Object)

    Quickly add an attribute it always returns the tag itself again, allowing chaining of multiple add-calls

    Declaration
    public T Attr(object nameWithValue)
    Parameters
    Type Name Description
    System.Object nameWithValue

    Object which can be ToString()ed

    Returns
    Type Description
    T
    | Improve this Doc View Source

    Attr(String, Object, String)

    Quickly add an attribute it always returns the tag itself again, allowing chaining of multiple add-calls

    Declaration
    public T 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
    T
    | Improve this Doc View Source

    Class(String)

    class attribute

    Declaration
    public T Class(string value)
    Parameters
    Type Name Description
    System.String value
    Returns
    Type Description
    T
    | Improve this Doc View Source

    Data(String, Object)

    Add a data-... attribute

    Declaration
    public T 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
    T
    | Improve this Doc View Source

    Id(String)

    ID - set multiple times always overwrites previous ID

    Declaration
    public T Id(string id)
    Parameters
    Type Name Description
    System.String id
    Returns
    Type Description
    T
    | Improve this Doc View Source

    On(String, Object)

    Add a onEventName attribute for javascript events

    Declaration
    public T 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
    T
    | Improve this Doc View Source

    Style(String)

    style attribute. If called multiple times, will append styles.

    Declaration
    public T Style(string value)
    Parameters
    Type Name Description
    System.String value

    Style to add

    Returns
    Type Description
    T
    | Improve this Doc View Source

    Title(String)

    title attribute

    Declaration
    public T Title(string value)
    Parameters
    Type Name Description
    System.String value

    new title to set

    Returns
    Type Description
    T
    | Improve this Doc View Source

    Wrap(Object[])

    Wrap the tag around the new content, so this replaces all the content with what you give it

    Declaration
    public T 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
    T

    Implements

    System.Web.IHtmlString
    IHtmlTag
    ITag
    System.Collections.Generic.IEnumerable<T>
    System.Collections.IEnumerable
    • Improve this Doc
    • View Source
    In This Article
    Back to top Generated by DocFX