Added support for "Label" components#703
Conversation
jchristgit
left a comment
There was a problem hiding this comment.
Thank you for the PR (and thank you for adding the since tags, that saves a lot of work for me (: ) I have one small comment but other than that it looks good to me.
|
I'll just biggy back on this open PR. Im not sure if Discord changed their API validation just today, because I didnt have this exact issue yesterday, but Component.TextInput has an empty string as its default for text_input =
Component.TextInput.text_input(
# The "nil" here gets ignored, I think the new() function skips over nil values.
nil,
field_id_str,
field_opts
)
%Component{text_input | label: nil} |
|
Could we change the default to just be an empty string or does that cause other issues then? |
|
The default for Component.TextInput is currently an empty string, which causes the problem. A text input inside of a label component must have null or nothing at all as their |
|
Hello guys any updates with this pull request? 😄 |
Discord nowadays heavily encourages the use of the "Label" component over "ActionRow" in modals. Some components like e.g. selects in modals even requiring their use since they don't have a label of their own.
On the API layer Labels accept their single child in the "component" property instead of "components". I was torn between trying to piggy back on the existing "components" field instead of adding a new one, but ultimately decided that a solution that stays closer to the API will probably be more beneficial in the long run. Very much open to input on this one though.
Thank you for the library!