domdefs.ff4s.HtmlProps.scala Maven / Gradle / Ivy
package ff4s
import ff4s.HtmlProp
import ff4s.codecs._
// #NOTE: GENERATED CODE
// - This file is generated at compile time from the data in Scala DOM Types
// - See `project/DomDefsGenerator.scala` for code generation params
// - Contribute to https://github.com/raquo/scala-dom-types to add missing tags / attrs / props / etc.
trait HtmlProps {
/**
* Create custom HTML element property
*
* @param name - name of the prop in JS, e.g. "value"
* @param codec - used to encode V into DomV, e.g. StringAsIsCodec,
*
* @tparam V - value type for this prop in Scala
* @tparam DomV - value type for this prop in the underlying JS DOM.
*/
def htmlProp[V, DomV](name: String, codec: Codec[V, DomV]): HtmlProp[V, DomV] = new HtmlProp(name, codec)
@inline protected def boolProp(name: String): HtmlProp[Boolean, Boolean] = htmlProp(name, BooleanAsIsCodec)
@inline protected def stringProp(name: String): HtmlProp[String, String] = htmlProp(name, StringAsIsCodec)
// -- Props --
/**
* In addition to the checked and unchecked states, there is a third state
* a checkbox can be in: indeterminate. This is a state in which it's
* impossible to say whether the item is toggled on or off.
*
* [[https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/checkbox#Indeterminate_state_checkboxes checkbox#Indeterminate_state_checkboxes @ MDN]]
*/
lazy val indeterminate: HtmlProp[Boolean, Boolean] = boolProp("indeterminate")
/**
* When the value of the type attribute is "radio" or "checkbox", this property
* determines whether it is checked or not.
* This is different from `checked` _attribute_,
* which contains the _initial_ checked status of the element.
* More info: https://stackoverflow.com/a/6004028/2601788 (`checked` behaves similar to `value`)
*
* See also: defaultChecked prop / attribute
*/
lazy val checked: HtmlProp[Boolean, Boolean] = boolProp("checked")
/**
* Indicates whether an `