Skip to content

Latest commit

 

History

History
79 lines (49 loc) · 1.55 KB

DOMDSL.md

File metadata and controls

79 lines (49 loc) · 1.55 KB

DOM DSL :

HTML Tags :
import sri.web.vdom.htmltags._ ( faster ,but output file size will be more(Tip : gzip and cache ) )

        or 
        
import sri.web.vdom.htmltagsNoInline._ (small file size , but less performant than inline version)

Example : No magic, all tags are plain scala methods.

 
 import sri.web.vdom.htmltags._ 
 import sri.web.all._
 
 val Component = (props : Props) => {
    div(id = "sri-web")(
      input(id = "sri-web-input"),
      div(key = "hello" , onClick = (e : ReactEventH) => println("OK!"))("Click Me"),
      div(key = 2, ref = (node : dom.html.Div) => { ... } )()
    )
 } 

If you want prefixed versions( <.div() , <.input(), ...) then import following

import sri.web.vdom.htmltagsPrefix_<._

    or
    
import sri.web.vdom.htmltagsNoInlinePrefix_<._
SVG Tags :
import sri.web.vdom.svgtags._ ( faster ,but output file size will be more(Tip : gzip and cache ) )

        or 
        
import sri.web.vdom.svgtagsNoInline._ (small file size , but less performant than inline version)

Example : No magic, all tags are plain scala methods.

 
 import sri.web.vdom.svgtags._ 
 import sri.web.all._
 
 val Component = (props : Props) => {
    svg(id = "sri-web")(
      rect(width = 120)()
    )
 } 

If you want prefixed versions( <.svg() , <.rect(), ...) then import following

import sri.web.vdom.svgtagsPrefix_<._

    or
    
import sri.web.vdom.svgtagsNoInlinePrefix_<._