Skip to content

Conversation

javiereguiluz
Copy link
Member

Q A
Bug fix? no
New feature? no
Issues -
License MIT

This confused me. On Symfony Slack folks mentioned that changing this behavior would be bad for DX (e.g. we can do it in components backend by a PHP class with typed properties but we cannot for anonymous components). So, I think it might be enough to mention this in the docs. Thanks.

@javiereguiluz javiereguiluz added the docs Improvements or additions to documentation label Jul 15, 2024
@carsonbot carsonbot added the Status: Needs Review Needs to be reviewed label Jul 15, 2024
@Kocal
Copy link
Member

Kocal commented Jul 15, 2024

That's remind this ESLint rule for Vue.js: https://eslint.vuejs.org/rules/no-boolean-default

Ideally when you conceive your component, you don't want to use boolean props with a default value to true, to enforce HTML standard.

Depending on whether or not you want your close button to be displayed by default, you will need to have a property withCloseButton or withoutCloseButton default to false, meaning that you can simply use a prop with the static syntax like this:

<twig:Alert message="..." withCloseButton/>

<twig:Alert message="..." withoutCloseButton />

@carsonbot carsonbot added Status: Reviewed Has been reviewed by a maintainer and removed Status: Needs Review Needs to be reviewed labels Jul 17, 2024
@kbond kbond force-pushed the twig_component_html branch from c249129 to c9dc8cf Compare July 18, 2024 13:00
@kbond
Copy link
Member

kbond commented Jul 18, 2024

Thanks Javier.

@kbond kbond merged commit 391e250 into symfony:2.x Jul 18, 2024
@javiereguiluz javiereguiluz deleted the twig_component_html branch July 18, 2024 13:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Improvements or additions to documentation Status: Reviewed Has been reviewed by a maintainer
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants