Checkboxes with no children #1555
-
Hello team, we currently have a table that has checkbox functionality. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 3 replies
-
Hey @vnguyen94. I've shared this with the team to gather some ideas. We'll be back in touch as soon as we can. |
Beta Was this translation helpful? Give feedback.
-
Hey @vnguyen94. The problem with allowing a checkbox to have optional children is accessibility. An accessible text label is a hard requirement for checkboxes. Luckily, we do have a way a to accomplish what you're after with Paste. You can use the ScreenReaderOnly component as the Checkbox children. This checks-off the accessibility requirement, as well as hiding the text to all but screen readers. Here's a quick example: https://codesandbox.io/s/busy-frog-cm7dc?file=/src/index.tsx |
Beta Was this translation helpful? Give feedback.
Hey @vnguyen94. The problem with allowing a checkbox to have optional children is accessibility. An accessible text label is a hard requirement for checkboxes.
Luckily, we do have a way a to accomplish what you're after with Paste. You can use the ScreenReaderOnly component as the Checkbox children. This checks-off the accessibility requirement, as well as hiding the text to all but screen readers. Here's a quick example: https://codesandbox.io/s/busy-frog-cm7dc?file=/src/index.tsx