Skip to content

Primitives have no attribute-passthrough mechanism (Button, FormField, Select, Textarea, etc.) #71

Closed

Description

@fsecada01

Problem

None of cf-ui's primitives — Button, FormField, Select, Textarea, Notification, Badge, Box, etc. — expose a way to attach arbitrary extra HTML attributes. Each takes only a fixed, named prop set (e.g. Button: content, variant, size, state, href, type, full_width, extra_class).

Found while migrating 525_OP_Board_Application (issue tracked there as #9 Part B) from Bulma to cf-ui/daisyUI. That app has its own server-driven "LiveView"-style component pattern: forms and buttons carry a custom data-event="..." attribute that a small JS layer reads to trigger WebSocket-driven server re-renders. Other real-world callers would hit the same wall with Alpine.js bindings (x-model, :class, @click, x-show), hx-* attributes, or plain data-*/aria-* attributes.

Because there's no passthrough, any element carrying such an attribute is currently unsafe to route through a Cf: primitive — doing so silently drops the attribute and the behavior it drives, with no error or warning at render time or in tests. In the 525 migration this forced a chunk of the codebase (query/search forms, event-bearing buttons, an entire advanced-filters block, plus three files that are almost entirely Alpine-bound: CRUDForm, Search, ReportFileDragDrop) to stay on raw Bulma/hand-converted classes rather than adopt cf-ui, specifically because of this gap — not because the primitives were the wrong shape otherwise.

Suggested fix

Add a passthrough mechanism to at least the interactive primitives (Button first, since it's the most commonly attribute-bearing) — e.g. an attrs: dict[str, str] | None = None prop that renders as literal key="value" pairs on the root element, similar to how many component libraries handle "rest props." Both the Jinja and cotton engines would need it for parity.

Happy to help validate a fix against the 525 migration as a real consumer if useful — no code changes proposed here since edits to this repo go through its own PR process, not from consumer repos directly.

Activity

  1. fsecada01 commented on Aug 19, 2026

    @fsecada01
    OwnerAuthor

    Closing as superseded by #70, which documents the same gap with a concrete real-consumer repro, proposed rollout order, and test checklist.

    This issue's own opening case — Button — is resolved: attrs passthrough shipped on both engines via #72 (spike) → #73. The remaining primitives this issue named (FormField, Select, Textarea, etc.) are tracked under #70's proposed scope instead of here, to avoid two open issues describing the same fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions