<t-tag>

An HTML tag whose attributes the reader can change, with the live element right below it. Drag a number, click a word or toggle an attribute, and the element updates. It works the other way too: drag the slider below and its value follows.

0 100 5 40 false

<t-tag> works like <t-call>: its children are ordinary <t-num>, <t-choice> and <t-text> elements, and each one is an attribute. Their values are ordinary variables too, so other elements on the page can use them.

Attributes

AttributeDefaultDescription
tagdivThe element to show: its tag name, plus any attributes that don't change, such as tag='input type="range"'.

On the children:

AttributeDescription
nameThe variable. It's also the attribute's name, unless attr is set.
attrThe attribute's name, when it differs from the variable's. Use it for names that aren't valid variable names, such as aria-label or pixels-per-step.
contentMarks the child that goes between the opening and closing tags, instead of being an attribute. Put it last.

Text inside <t-tag> that isn't in a child is fixed content: <t-tag tag="button">Save</t-tag>.

Changing the element

The value and checked attributes go both ways. When the reader moves the slider, types in the field or ticks the box, the variable behind that attribute changes too, and so does everything else that reads it.

hello You typed characters.

Values

true Saves your work Save changes

Documenting an element

The element can be one of vangle's own, which makes <t-tag> a playground for its attributes. Change the range or the format, then drag the number in the preview:

0 20 5 %d cookies 3

Layout

The tag stays on one line while it fits. When it's too wide, each attribute goes on its own line:

<input
    type="range"
    min="0"
    max="100"
    step="5"
    value="40"
>