question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

I want to use full width in the Form Control Label component.

See original GitHub issue

Duplicates

  • I have searched the existing issues

Latest version

  • I have tested the latest version

Summary 💡

function initItemsTemplate(items) {
    return items.map((answer, i) => {
        return (
            <Box key={i}>
                <FormControlLabel 
                    label={
                        <Typography key={i.toString()} variant="body2"
                            fullwidth
                            style={{ margin: '2px 0px 0px 0px' }}
                            children={`${answer.example}`}/>}
                    control={<Checkbox 
                                defaultChecked={answer.isChecked}
                                style={{ marginLeft: '0px'}} 
                                onchange
                                onChange={(event) => answerChecked(event, answer.id)}/>}/>
            </Box>
        );
    })
}

This is FormControlLabel component.

And the pink area is an area where you can click FormControlLabel.

I want the Checkbox event to work when I click on all areas as below.

Examples 🌈

This is a page that actually works. GitHub Source code parts.

Motivation 🔦

No response

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
jamesnet214commented, Nov 26, 2021

@abhinav-22-tech Thank you. That’s exactly what I want. FormGroup

1reaction
abhinav-22-techcommented, Nov 26, 2021

Yes, You will also use FormGroup.

<Box style={{ width: 300, backgroundColor: "#f1f1f1", padding: 10 }}>
      <FormGroup>
        <FormControlLabel
          label={<Typography children="Name" />}
          control={<Checkbox />}
        />
      </FormGroup>
</Box>

Check out: https://codesandbox.io/s/cocky-cannon-3kzr9?file=/src/Demo.tsx

Read more comments on GitHub >

github_iconTop Results From Across the Web

Can fullWidth be added to the FormControl context ... - GitHub
I would like to be able to consume the fullWidth FormControl state prop from the ... but multiple Material-UI components that use fullWidth....
Read more >
FormControlLabel API - Material UI - MUI
API reference docs for the React FormControlLabel component. Learn about the props, CSS, and other APIs of this exported module.
Read more >
C38: Using CSS width, max-width and flexbox to fit labels and ...
Define the width and max-width property for labels and inputs so they enlarge or shrink in the available space and respond to zoom...
Read more >
Forms - Bootstrap
Create horizontal forms with the grid by adding the .row class to form groups and using the .col-*-* classes to specify the width...
Read more >
Form Element - Lightning Design System
A form label should use either the <label> or <legend> elements with the class ... form elements will have an increased size of...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found