 class KDRySwitch extends KDInputView
   constructor:(options)->
     options = $.extend
-      type : "switch"       # mandatory
-      size : "small"        # a String "small" or "big"
-    ,options  
+      type : "switch"                 # mandatory
+      size : options.size or "small"  # a String "small" or "big"
+    ,options
     super options
     @setClass options.size
     @setPartial "<input class='checkbox hidden no-kdinput' type='checkbox' name='#{@getName()}'/>"
 
   setDomElement:(cssClass)->
-    @domElement = $ "<div class='kdinput kdinputswitch-ry off #{cssClass}'><a href='#' class='on' title='turn on'>ON</a><a href='#' class='off' title='turn off'>OFF</a></div>"
+    title = @getOptions().title or ""
+    @domElement = $ "<div class='kdinput kdinputswitch-ry off #{cssClass}'>#{title}"+
+                    "<a href='#' class='on' title='turn on'>ON</a><a href='#' class='off' title='turn off'>OFF</a></div>"
 
   setDefaultValue:(value) ->
     switch value

    @switchStateChanged() if wCallback

  _setOn:(wCallback = yes)->
    return if @getValue()
    @inputDefaultValue = on
    @getDomElement().find("input").eq(0).attr "checked",yes
    @$('a.off').removeClass('active')

    , 0

  _setOff:(wCallback = yes)->
    return if not @getValue() and wCallback
    @inputDefaultValue = off
    @getDomElement().find("input").eq(0).attr "checked",no
    @$('a.on').removeClass('active')
