From 2069a00a763da8b7ee1af9fc66b994de4534fa14 Mon Sep 17 00:00:00 2001 From: hakubo Date: Fri, 30 Nov 2018 21:44:49 +0100 Subject: [PATCH 1/7] Draft of component-boolean-arguments RFC --- text/0000-component-boolean-argumens.md | 56 +++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 text/0000-component-boolean-argumens.md diff --git a/text/0000-component-boolean-argumens.md b/text/0000-component-boolean-argumens.md new file mode 100644 index 0000000000..a71fa7cbcc --- /dev/null +++ b/text/0000-component-boolean-argumens.md @@ -0,0 +1,56 @@ +- Start Date: 11/30/2018 +- RFC PR: (leave this empty) +- Ember Issue: (leave this empty) + +# Component boolean Arguments + +## Summary + +This RFC proposes to add a boolean argument to components, that aligns with boolean attribute of regular DOM elements. + +## Motivation + +Currently to pass a boolean property to a component a developer has to explicitly pass `true` as an argument. +e.g. +```hbs + ``` -and inside a component `...attributes` should also contain `disabled` attribute. e.g. +should render as +```html + +``` +### Align with attributes +This would align with how attributes behave currently. +Given an Input component: ```hbs ``` -should render as: + +if it is invoked like this: +```hbs + +``` + +it will render as ```html ``` From 49bf7cce0bec74243813350098979d28740d3007 Mon Sep 17 00:00:00 2001 From: Jakub Olek Date: Mon, 17 Dec 2018 23:45:03 +0100 Subject: [PATCH 6/7] Update info about the alternatives --- text/0000-component-boolean-arguments.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/text/0000-component-boolean-arguments.md b/text/0000-component-boolean-arguments.md index 01fa17c8d2..2ecdd5e98d 100644 --- a/text/0000-component-boolean-arguments.md +++ b/text/0000-component-boolean-arguments.md @@ -85,8 +85,9 @@ Can't think of any at the moment. ## Alternatives -- In React if a prop is passed with no value it is truthy inside of a component. -- In Vue if a prop is passed with no value it is falsy inside of a component. +- In both React and Vue if a prop is passed with no value it is truthy inside of a component. +-- https://vuejs.org/v2/guide/components-props.html#Passing-a-Boolean +-- https://reactjs.org/docs/jsx-in-depth.html#props-default-to-true ## Unresolved questions From 8d6d88a802771be0414054dcabbafe9594a67c09 Mon Sep 17 00:00:00 2001 From: Jakub Olek Date: Mon, 17 Dec 2018 23:46:08 +0100 Subject: [PATCH 7/7] fix bullet points --- text/0000-component-boolean-arguments.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/text/0000-component-boolean-arguments.md b/text/0000-component-boolean-arguments.md index 2ecdd5e98d..f968932626 100644 --- a/text/0000-component-boolean-arguments.md +++ b/text/0000-component-boolean-arguments.md @@ -86,8 +86,8 @@ Can't think of any at the moment. ## Alternatives - In both React and Vue if a prop is passed with no value it is truthy inside of a component. --- https://vuejs.org/v2/guide/components-props.html#Passing-a-Boolean --- https://reactjs.org/docs/jsx-in-depth.html#props-default-to-true + - https://vuejs.org/v2/guide/components-props.html#Passing-a-Boolean + - https://reactjs.org/docs/jsx-in-depth.html#props-default-to-true ## Unresolved questions