Element

zio.blocks.html.Dom.Element
See theElement companion trait
object Element

Attributes

Companion
trait
Source
Dom.scala
Graph
Supertypes
trait Sum
trait Mirror
class Object
trait Matchable
class Any
Self type
Element.type

Members list

Type members

Classlikes

sealed trait Cell extends Element

A table cell (<th> or <td>), accepted as an element child of tr(...).

A table cell (<th> or <td>), accepted as an element child of tr(...).

Attributes

Source
Dom.scala
Supertypes
trait Element
trait Dom
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
Known subtypes
trait Td
class TdElement
trait Th
class ThElement
final case class Generic(tag: String, attributes: Chunk[Attribute], children: Chunk[Dom]) extends Element

A generic HTML element.

A generic HTML element.

Represents any standard HTML tag (e.g., "div", "p", "span"). Text content in children is HTML-escaped during rendering.

Equality is structural across all Element implementations: a Generic equals any other element with the same tag, attributes, children, and text-escaping semantics, regardless of the concrete class (e.g., Generic("li", ...) equals the equivalent LiElement).

Value parameters

attributes

attribute key-value pairs

children

child DOM nodes

tag

the element tag name (e.g., "div", "h1")

Attributes

Source
Dom.scala
Supertypes
trait Element
trait Dom
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
sealed trait Li extends Element

An `

An `

  • list item, accepted as an element child oful(...)andol(...). Produced by theli(...)` factory.

Attributes

Source
Dom.scala
Supertypes
trait Element
trait Dom
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
Known subtypes
class LiElement
final case class LiElement(attributes: Chunk[Attribute], children: Chunk[Dom]) extends Element, Li

An `

An `

  • ` list item element.

Equality is structural across all Element implementations, so a LiElement equals a Generic("li", ...) with the same attributes and children.

Value parameters

attributes

attribute key-value pairs

children

child DOM nodes

Attributes

Source
Dom.scala
Supertypes
trait Li
trait Element
trait Dom
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
sealed trait Opt extends SelectChild

An `` element, accepted as an element child of select(...) and optgroup(...). Produced by the opt(...)/option(...) DSL factories.

An `` element, accepted as an element child of select(...) and optgroup(...). Produced by the opt(...)/option(...) DSL factories.

Attributes

Source
Dom.scala
Supertypes
trait SelectChild
trait Element
trait Dom
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
Known subtypes
class OptElement
final case class OptElement(attributes: Chunk[Attribute], children: Chunk[Dom]) extends Element, Opt

An `` element.

An `` element.

Equality is structural across all Element implementations, so an OptElement equals a Generic("option", ...) with the same attributes and children.

Value parameters

attributes

attribute key-value pairs

children

child DOM nodes

Attributes

Source
Dom.scala
Supertypes
trait Opt
trait SelectChild
trait Element
trait Dom
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
sealed trait Optgroup extends SelectChild

An `` element, accepted as an element child of select(...). Produced by the optgroup(...) factory.

An `` element, accepted as an element child of select(...). Produced by the optgroup(...) factory.

Attributes

Source
Dom.scala
Supertypes
trait SelectChild
trait Element
trait Dom
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
Known subtypes
final case class OptgroupElement(attributes: Chunk[Attribute], children: Chunk[Dom]) extends Element, Optgroup

An `` element.

An `` element.

Unlike the other typed elements, this class intentionally does not override apply(DomModifier*), and withChildren returns a plain Element, so replacing children drops the Optgroup marker — children belong in the optgroup(...) factory, which enforces that restriction at compile time. Attributes can still be attached via withAttributes, preserving the marker.

Equality is structural across all Element implementations, so an OptgroupElement equals a Generic("optgroup", ...) with the same attributes and children.

Value parameters

attributes

attribute key-value pairs

children

child DOM nodes (`` elements only)

Attributes

Source
Dom.scala
Supertypes
trait Optgroup
trait SelectChild
trait Element
trait Dom
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
final case class Script(attributes: Chunk[Attribute], children: Chunk[Dom]) extends Element

An HTML script element.

An HTML script element.

The Script element renders its children WITHOUT HTML-escaping, allowing inline JavaScript to be rendered as-is. Provides convenience methods inlineJs(code) to inject escaped JavaScript or externalJs(url) to link external scripts.

Equality is structural across all Element implementations, including the text-escaping semantics: because Script renders its children unescaped, it never equals an equally-shaped Generic("script", ...), whose children would be escaped on render.

Value parameters

attributes

attribute key-value pairs

children

child DOM nodes (typically Text with JavaScript code)

Attributes

Source
Dom.scala
Supertypes
trait Element
trait Dom
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
sealed trait SelectChild extends Element

An or, accepted as an element child of select(...).

An or, accepted as an element child of select(...).

Attributes

Source
Dom.scala
Supertypes
trait Element
trait Dom
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
Known subtypes
trait Opt
class OptElement
trait Optgroup
final case class Style(attributes: Chunk[Attribute], children: Chunk[Dom]) extends Element

An HTML style element.

An HTML style element.

The Style element renders its children WITHOUT HTML-escaping, allowing inline CSS to be rendered as-is. Provides convenience method inlineCss(code) to inject CSS code directly.

Equality is structural across all Element implementations, including the text-escaping semantics: because Style renders its children unescaped, it never equals an equally-shaped Generic("style", ...), whose children would be escaped on render.

Value parameters

attributes

attribute key-value pairs

children

child DOM nodes (typically Text with CSS code)

Attributes

Source
Dom.scala
Supertypes
trait Element
trait Dom
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
sealed trait Td extends Cell

A <td> data cell, accepted as an element child of tr(...). Produced by the td(...) factory.

A <td> data cell, accepted as an element child of tr(...). Produced by the td(...) factory.

Attributes

Source
Dom.scala
Supertypes
trait Cell
trait Element
trait Dom
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
Known subtypes
class TdElement
final case class TdElement(attributes: Chunk[Attribute], children: Chunk[Dom]) extends Element, Td

A <td> table data cell element.

A <td> table data cell element.

Equality is structural across all Element implementations, so a TdElement equals a Generic("td", ...) with the same attributes and children.

Value parameters

attributes

attribute key-value pairs

children

child DOM nodes

Attributes

Source
Dom.scala
Supertypes
trait Td
trait Cell
trait Element
trait Dom
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
sealed trait Th extends Cell

A <th> header cell, accepted as an element child of tr(...). Produced by the th(...) factory.

A <th> header cell, accepted as an element child of tr(...). Produced by the th(...) factory.

Attributes

Source
Dom.scala
Supertypes
trait Cell
trait Element
trait Dom
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
Known subtypes
class ThElement
final case class ThElement(attributes: Chunk[Attribute], children: Chunk[Dom]) extends Element, Th

A <th> table header cell element.

A <th> table header cell element.

Equality is structural across all Element implementations, so a ThElement equals a Generic("th", ...) with the same attributes and children.

Value parameters

attributes

attribute key-value pairs

children

child DOM nodes

Attributes

Source
Dom.scala
Supertypes
trait Th
trait Cell
trait Element
trait Dom
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
sealed trait Tr extends Element

A <tr> table row, accepted as an element child of table(...). Produced by the tr(...) factory.

A <tr> table row, accepted as an element child of table(...). Produced by the tr(...) factory.

Attributes

Source
Dom.scala
Supertypes
trait Element
trait Dom
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
Known subtypes
class TrElement
final case class TrElement(attributes: Chunk[Attribute], children: Chunk[Dom]) extends Element, Tr

A <tr> table row element.

A <tr> table row element.

Unlike permissive elements (li, th, td), this class intentionally keeps the row content model intact: it does not override apply(DomModifier*), and withChildren returns a plain Element, so replacing children drops the Tr marker — children belong in the tr(...) factory, which enforces the restriction at compile time. Attributes can still be attached via withAttributes, preserving the marker.

Equality is structural across all Element implementations, so a TrElement equals a Generic("tr", ...) with the same attributes and children.

Value parameters

attributes

attribute key-value pairs

children

child DOM nodes (<th>/<td> cells only)

Attributes

Source
Dom.scala
Supertypes
trait Tr
trait Element
trait Dom
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
sealed trait Void extends Dom, CssSelectable

A sealed trait for void HTML elements that cannot have children.

A sealed trait for void HTML elements that cannot have children.

Void elements accept attributes but reject children at compile time. They self-close when rendered (e.g., ``, <img src="../..."/>).

Unlike Element, this trait does not extend Dom.Element so it does not inherit apply(DomModifier*) — only attributes can be applied via apply(Attribute, Attribute*).

Subtypes include:

Attributes

Source
Dom.scala
Supertypes
trait Dom
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
Known subtypes
class VoidGeneric
final case class VoidGeneric(tag: String, attributes: Chunk[Attribute]) extends Void

A generic void HTML element.

A generic void HTML element.

Represents any void HTML tag (e.g., "br", "img", "input"). Only accepts attributes, not children — enforced at compile time.

Value parameters

attributes

attribute key-value pairs

tag

the element tag name (e.g., "br", "img")

Attributes

Source
Dom.scala
Supertypes
trait Void
trait Dom
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all

Inherited and Abstract types

type MirroredElemLabels <: Tuple

The names of the product elements.

The names of the product elements.

Attributes

Inherited from:
Mirror
Source
Mirror.scala
type MirroredLabel <: String

The name of the type.

The name of the type.

Attributes

Inherited from:
Mirror
Source
Mirror.scala