
com.raquo.laminar.shoelace.sl.Textarea.scala Maven / Gradle / Ivy
package com.raquo.laminar.shoelace.sl
import com.raquo.laminar.keys.{EventProp, HtmlProp, HtmlAttr}
import com.raquo.laminar.api.L
import com.raquo.laminar.nodes.Slot
import com.raquo.laminar.tags.CustomHtmlTag
import org.scalajs.dom
import scala.scalajs.js
import scala.scalajs.js.|
import scala.scalajs.js.annotation.JSImport
// This file is generated at compile-time by ShoelaceGenerator.scala
/**
* Textareas collect data from the user and allow multiple lines of text.
*
* [[https://github.com/raquo/laminar-shoelace-components/blob/master/src/main/scala/com/raquo/laminar/shoelace/sl/Textarea.scala Textarea.scala source code]]
*
* [[https://shoelace.style/components/textarea Shoelace Textarea docs]]
*/
object Textarea extends WebComponent("sl-textarea") with ControlledInput {
@JSImport("@shoelace-style/shoelace/dist/components/textarea/textarea.js", JSImport.Namespace)
@js.native object RawImport extends js.Object
type Self = Textarea.type
type Ref = TextareaComponent with dom.HTMLTextAreaElement
override protected lazy val tag: CustomHtmlTag[Ref] = {
tagWithControlledInput(value, initial = "", onInput)
}
// -- Events --
/** Emitted when the control loses focus. */
lazy val onBlur: EventProp[dom.Event] = eventProp("sl-blur")
/** Emitted when an alteration to the control's value is committed by the user. */
lazy val onChange: EventProp[dom.Event] = eventProp("sl-change")
/** Emitted when the control gains focus. */
lazy val onFocus: EventProp[dom.Event] = eventProp("sl-focus")
/** Emitted when the control receives input. */
lazy val onInput: EventProp[dom.Event] = eventProp("sl-input")
/** Emitted when the form control has been checked for validity and its constraints aren't satisfied. */
lazy val onInvalid: EventProp[dom.Event] = eventProp("sl-invalid")
// -- Attributes --
lazy val title: HtmlAttr[String] = stringAttr("title")
/** The name of the textarea, submitted as a name/value pair with form data. */
lazy val name: HtmlAttr[String] = stringAttr("name")
/** The current value of the textarea, submitted as a name/value pair with form data. */
lazy val defaultValue: HtmlAttr[String] = stringAttr("value")
/** The textarea's size. */
lazy val size: CommonKeys.size.type = CommonKeys.size
/** Draws a filled textarea. */
lazy val filled: HtmlAttr[Boolean] = boolAttr("filled")
/** The textarea's label. If you need to display HTML, use the `label` slot instead. */
lazy val label: HtmlAttr[String] = stringAttr("label")
/** The textarea's help text. If you need to display HTML, use the `help-text` slot instead. */
lazy val helpText: HtmlAttr[String] = stringAttr("help-text")
/** Placeholder text to show as a hint when the input is empty. */
lazy val placeholder: HtmlAttr[String] = stringAttr("placeholder")
/** The number of rows to display by default. */
lazy val rows: HtmlAttr[Int] = intAttr("rows")
/** Controls how the textarea can be resized. */
lazy val resize: HtmlAttr[String] = stringAttr("resize")
/** Disables the textarea. */
lazy val disabled: HtmlAttr[Boolean] = boolAttr("disabled")
/** Makes the textarea readonly. */
lazy val readOnly: HtmlAttr[Boolean] = boolAttr("readonly")
/**
* By default, form controls are associated with the nearest containing `
© 2015 - 2025 Weber Informatics LLC | Privacy Policy