v0.20.230 - 6.3 / 6.2

attributes / properties

How pota decides whether an unnamespaced prop writes to an attribute or a property, and the conventions that fall out of it.

# Attributes vs Properties

Since v0.18.184, pota defaults to setting attributes. Use the prop: namespace to force a property assignment — typical cases: value and checked on form inputs, srcObject on media, innerHTML, or any custom-element property that expects a non-string value.

# Deleting

  • property (prop:*): assigning null or undefined sets the property to null.
  • attribute (default): passing false, null or undefined removes the attribute. true sets it to the empty string.

# Children

Passing children as a prop is only honoured when the element has no explicit child nodes in JSX. If both are set, the explicit childNodes win and the children prop is ignored.

# xmlns

The xmlns attribute is inherited by children, so SVG, MathML, and other XML dialects work out of the box with their own namespaces — no special wrapper needed.

# Events

Event names in on:* are case-sensitive — on:click and on:Click bind different events. This matches how custom events are typically named.

# Props With Default Behavior

NameDescription
use:refcallback to get a reference to the element
use:connectedconnected adds a callback to the mount event
use:disconnecteddisconnected adds a callback to the unmount event
classsets classes in the element in various ways
stylesets styles in the element in various ways
use:css<span use:css="class{color:green} class:hover{color:red}"/> becomes <span class="c1ywn32bqhvrzp"/>

# SVG

test: SVG + xlink

# Showing XML Test

Testing if keeps the parent xmlns using a toggling Show