Skip to content

Add classes support to {{ stimulus_controller }} #123

@sukei

Description

@sukei

The stimulus_controller function is a great addition but is not feature complete. Targets and actions are already discussed here, so I won't talk about it. However classes are not covered.

As stated by the Stimulus documentation:

CSS class attributes must be specified on the same element as the data-controller attribute.

I think that stimulus_controller should add classes support too. But, I don't know how the function signature should change to support this without breaking things. Until the official implementation arrived, I came to the following:

stimulus_controller('layout/panel', { active: true }, { hide: d-none' }, 'focusable') which rendered data-controller="layout--panel focusable" data-layout--panel-active-value="true" data-layout--panel-hide-class="d-none".

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions