
com.raquo.laminar.shoelace.sl.RadioGroup.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
/**
* Radio groups are used to group multiple [radios](/components/radio) or [radio buttons](/components/radio-button) so they function as a single form control.
*
* [[https://github.com/raquo/laminar-shoelace-components/blob/master/src/main/scala/com/raquo/laminar/shoelace/sl/RadioGroup.scala RadioGroup.scala source code]]
*
* [[https://shoelace.style/components/radio-group Shoelace RadioGroup docs]]
*/
object RadioGroup extends WebComponent("sl-radio-group") with ControlledInput {
@JSImport("@shoelace-style/shoelace/dist/components/radio-group/radio-group.js", JSImport.Namespace)
@js.native object RawImport extends js.Object
type Self = RadioGroup.type
type Ref = RadioGroupComponent with dom.HTMLElement
override protected lazy val tag: CustomHtmlTag[Ref] = {
tagWithControlledInput(value, initial = "", onInput)
}
// -- Events --
/** Emitted when the radio group's selected value changes. */
lazy val onChange: EventProp[dom.Event] = eventProp("sl-change")
/** Emitted when the radio group receives user 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 --
/**
* The radio group's label. Required for proper accessibility. If you need to display HTML, use the `label` slot
* instead.
*/
lazy val label: HtmlAttr[String] = stringAttr("label")
/** The radio groups's help text. If you need to display HTML, use the `help-text` slot instead. */
lazy val helpText: HtmlAttr[String] = stringAttr("help-text")
/** The name of the radio group, submitted as a name/value pair with form data. */
lazy val name: HtmlAttr[String] = stringAttr("name")
/** The current value of the radio group, submitted as a name/value pair with form data. */
lazy val defaultValue: HtmlAttr[String] = stringAttr("value")
/** The radio group's size. This size will be applied to all child radios and radio buttons. */
lazy val size: CommonKeys.size.type = CommonKeys.size
/**
* By default, form controls are associated with the nearest containing `
© 2015 - 2025 Weber Informatics LLC | Privacy Policy