You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Roll out attrs passthrough to Select, Textarea, FormField #76
Button got attrs passthrough via #72 (spike) → #73 (implementation), and #70 tracks the remaining rollout to the rest of the interactive primitives. This issue narrows to the next three: Select, Textarea, FormField.
Current state
None of the three declare attrs on either engine — RESERVED_ATTRS in primitives.py has exactly one key ("button").
Wrapper-vs-control ambiguity (the design question #70 flagged)
All three render more than one element, and a caller's attribute almost always means the control, not the outer wrapper:
Select.jinja / select.html: outer <div class="field"> wrapper, inner <div class="select">, and the actual <select> control
Textarea.jinja / textarea.html: outer <div class="field"> wrapper, inner <div class="control">, and the actual <textarea> control
FormField.jinja / form-field.html: same wrapper/control split
hx-*, x-*, @click, data-*, aria-* etc. belong on the control element (<select>/<textarea>/the field's input) in every real-world case identified in #70 — not on the <div class="field"> wrapper.
Add attrs={} / attrs="{}" as a prop on each Jinja {#def} and each cotton <c-vars>
Add a RESERVED_ATTRS entry per primitive, listing the attributes it already renders itself (so attrs can't silently duplicate/override id, name, class, etc.)
Route through the existing render_attrs() / cf_ui_render_attrs machinery — no new escaping or validation logic needed, it's engine-agnostic already
Place the rendered attrs on the control element identified above, not the wrapper
Suggested tests
Per component, per engine (mirroring #73's test_cf_ui_class_tag.py / attrs tests for Button):
An undeclared attribute reaches the control element, not the wrapper
A declared prop (class, name, id) passed through attrs is rejected with a clear error, not silently duplicated
Attribute values containing quotes/< are escaped
Verified through the real compiler on the cotton side (render_to_string on a theme partial bypasses <c-vars> — see repo CLAUDE.md), not just unit tests
Scope
This issue is select + textarea + form-field only. checkbox-group, icon, badge, box remain tracked under #70's broader scope for a later pass.
Activity
feat(select,textarea,form-field): roll out attrs passthrough (#76) (#77)
fix(docs): correct stale Button-only attrs claim, pin the form-contro…
fix(docs): document JinjaX _attrs= for attrs passthrough (#78) (#81)
feat(primitives): attrs passthrough on Icon, Badge, Box, CheckboxGroup (
chore(release): 0.4.0 (#83) (#84)