![JAR search and dependency download from the Maven repository](/logo.png)
com.raquo.laminar.shoelace.sl.Select.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
/**
* Selects allow you to choose items from a menu of predefined options.
*
* [[https://github.com/raquo/laminar-shoelace-components/blob/master/src/main/scala/com/raquo/laminar/shoelace/sl/Select.scala Select.scala source code]]
*
* [[https://shoelace.style/components/select Shoelace Select docs]]
*/
object Select extends WebComponent("sl-select") with ControlledInput {
@JSImport("@shoelace-style/shoelace/dist/components/select/select.js", JSImport.Namespace)
@js.native object RawImport extends js.Object
type Self = Select.type
type Ref = SelectComponent with dom.HTMLElement
override protected lazy val tag: CustomHtmlTag[Ref] = {
tagWithControlledInput(value, initial = "", onInput)
}
// -- Events --
/** Emitted when the control's value changes. */
lazy val onChange: EventProp[dom.Event] = eventProp("sl-change")
/** Emitted when the control's value is cleared. */
lazy val onClear: EventProp[dom.Event] = eventProp("sl-clear")
/** Emitted when the control receives input. */
lazy val onInput: EventProp[dom.Event] = eventProp("sl-input")
/** Emitted when the control gains focus. */
lazy val onFocus: EventProp[dom.Event] = eventProp("sl-focus")
/** Emitted when the control loses focus. */
lazy val onBlur: EventProp[dom.Event] = eventProp("sl-blur")
/** Emitted when the select's menu opens. */
lazy val onShow: EventProp[dom.Event] = eventProp("sl-show")
/** Emitted after the select's menu opens and all animations are complete. */
lazy val onAfterShow: EventProp[dom.Event] = eventProp("sl-after-show")
/** Emitted when the select's menu closes. */
lazy val onHide: EventProp[dom.Event] = eventProp("sl-hide")
/** Emitted after the select's menu closes and all animations are complete. */
lazy val onAfterHide: EventProp[dom.Event] = eventProp("sl-after-hide")
/** 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 --
/** The name of the select, submitted as a name/value pair with form data. */
lazy val name: HtmlAttr[String] = stringAttr("name")
/** The select's size. */
lazy val size: CommonKeys.size.type = CommonKeys.size
/** Placeholder text to show as a hint when the select is empty. */
lazy val placeholder: HtmlAttr[String] = stringAttr("placeholder")
/** Allows more than one option to be selected. */
lazy val multiple: HtmlAttr[Boolean] = boolAttr("multiple")
/**
* The maximum number of selected options to show when `multiple` is true. After the maximum, "+n" will be shown to
* indicate the number of additional items that are selected. Set to 0 to remove the limit.
*/
lazy val maxOptionsVisible: HtmlAttr[Int] = intAttr("max-options-visible")
/** Disables the select control. */
lazy val disabled: HtmlAttr[Boolean] = boolAttr("disabled")
/** Adds a clear button when the select is not empty. */
lazy val clearable: HtmlAttr[Boolean] = boolAttr("clearable")
/**
* Indicates whether or not the select is open. You can toggle this attribute to show and hide the menu, or you can
* use the `show()` and `hide()` methods and this attribute will reflect the select's open state.
*/
lazy val open: HtmlAttr[Boolean] = boolAttr("open")
/**
* Enable this option to prevent the listbox from being clipped when the component is placed inside a container with
* `overflow: auto|scroll`. Hoisting uses a fixed positioning strategy that works in many, but not all, scenarios.
*/
lazy val hoist: HtmlAttr[Boolean] = boolAttr("hoist")
/** Draws a filled select. */
lazy val filled: HtmlAttr[Boolean] = boolAttr("filled")
/** Draws a pill-style select with rounded edges. */
lazy val pill: HtmlAttr[Boolean] = boolAttr("pill")
/** The select's label. If you need to display HTML, use the `label` slot instead. */
lazy val label: HtmlAttr[String] = stringAttr("label")
/**
* The preferred placement of the select's menu. Note that the actual placement may vary as needed to keep the listbox
* inside of the viewport.
*/
lazy val placement: CommonKeys.placement.type = CommonKeys.placement
/** The select's help text. If you need to display HTML, use the `help-text` slot instead. */
lazy val helpText: HtmlAttr[String] = stringAttr("help-text")
/**
* By default, form controls are associated with the nearest containing `
© 2015 - 2025 Weber Informatics LLC | Privacy Policy