diff --git a/text/0000-component-boolean-arguments.md b/text/0000-component-boolean-arguments.md new file mode 100644 index 0000000000..f968932626 --- /dev/null +++ b/text/0000-component-boolean-arguments.md @@ -0,0 +1,94 @@ +- 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 + +``` + +should render as +```html + +``` + +### Align with attributes +This would align with how attributes behave currently. +Given an Input component: +```hbs + +``` + +if it is invoked like this: +```hbs + +``` + +it will render as +```html + +``` + + +## How we teach this + +This should be included in guides and also should be easier to teach as it is inline with HTML spec for attributes. + +## Drawbacks + +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 + +## Unresolved questions + +None at the moment.