Skip to content
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

[FormControlLabel] Add labelPlacement prop #12303

Merged
merged 1 commit into from
Jul 27, 2018
Merged

[FormControlLabel] Add labelPlacement prop #12303

merged 1 commit into from
Jul 27, 2018

Conversation

mbrookes
Copy link
Member

Closes #11618

I reused the RadioButtonsGroup demo to show the label on the left, and moved the FromControl required and error props examples to the CheckboxesGroup example. (They never really made sense on RadioButtons.)

@@ -74,6 +79,7 @@ function FormControlLabel(props, context) {
className={classNames(
classes.root,
{
[classes.start]: labelPlacement === 'start',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What're the pros/cons of using CSS over changing the DOM structure?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pros: It's simpler (so simple that it barely warrants its own prop).
Cons: ? (I'm not aware of any)

Copy link
Member

@oliviertassinari oliviertassinari Jul 27, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cons: confusing output when debugging in the dev tool. But I'm fine with the current tradeoff.

@oliviertassinari oliviertassinari added the new feature New feature or request label Jul 27, 2018
@@ -22,6 +22,10 @@ export const styles = theme => ({
cursor: 'default',
},
},
/* Styles applied to the root element if `position="start"`. */
start: {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you think of?

The variants applied by and enum property are prefixed, e.g. the colorPrimary class applied by the color="primary" property.

https://material-ui.com/guides/api/#api-design-approach

Copy link
Member

@oliviertassinari oliviertassinari Jul 27, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you think of renaming the start style rule, labelPositionStart?

@mbrookes mbrookes merged commit da32979 into mui:master Jul 27, 2018
@mbrookes mbrookes deleted the formControlLabel-add-labelPlacement branch July 27, 2018 18:16
@@ -22,6 +22,10 @@ export const styles = theme => ({
cursor: 'default',
},
},
/* Styles applied to the root element if `position="start"`. */
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

labelPositition="start"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new feature New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants