Skip to content

Checkbox: value prop not being used to populate the input's value attribute #7762

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
maxchan23 opened this issue Mar 6, 2025 · 1 comment · May be fixed by #7789
Open

Checkbox: value prop not being used to populate the input's value attribute #7762

maxchan23 opened this issue Mar 6, 2025 · 1 comment · May be fixed by #7789
Labels
Type: Bug Issue contains a defect related to a specific component.

Comments

@maxchan23
Copy link

maxchan23 commented Mar 6, 2025

Describe the bug

When using the value prop in a Checkbox component, I noticed that the value is not being used to populate the actual input's value attribute.

Image

Reproducer

No response

System Information

-

Steps to reproduce the behavior

  1. Go to the Checkbox documentation -> scroll to the Dynamic section : https://primereact.org/checkbox/
  2. inspect the Marketing checkbox, click into its input element
  3. the value attribute is not being set as intended even though the category is being passed in as a value prop

Expected behavior

The value should be used to populate the input's value attribute. I'm currently working around this by adding a defaultValue in the pt prop like so pt={{ input: { defaultValue: category } }}

@maxchan23 maxchan23 added the Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible label Mar 6, 2025
@melloware melloware added Type: Bug Issue contains a defect related to a specific component. and removed Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible labels Mar 7, 2025
@melloware
Copy link
Member

@KumJungMin @maxchan23 i think this was intentional by PrimeTek. See PrimeVue does the same thing and uses the checked field.

https://github.com/primefaces/primevue/blob/master/packages/primevue/src/checkbox/Checkbox.vue

It looks like the only place PrimeVue sets the value is here: https://github.com/primefaces/primevue/blob/master/packages/primevue/src/checkbox/Checkbox.vue#L8C14-L8C19

To the string "value" as a placeholder.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug Issue contains a defect related to a specific component.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants