Skip to content

Feature idea - passing required attribute to rendered elements #12

@samrae7

Description

@samrae7

hey,

Do you think it would be ok to have it so that the input component adds an html attribute (required) to the input that it renders based on if the 'required' rule is in the list of rules for that component instance?

This would be so that if in my project I want different styling for a required input ( ie. an asterix next to the label for that input) I don't have to add a className for required in addition to adding the rule in the form config. The css wouldn't be part of the library but the library would give you the required attribute automatically.

Let me know if you agree with this. I could do a PR.

Could do something similar for other components eg, select ( which is passed required as a prop but doesn't pass it to the html elements it renders as far as I can see)

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