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

[TextField] Add demo for color prop #18220

Merged
merged 4 commits into from
Nov 7, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions docs/src/pages/components/text-fields/ColorTextFields.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import React from 'react';
import { makeStyles } from '@material-ui/core/styles';
import TextField from '@material-ui/core/TextField';

const useStyles = makeStyles(theme => ({
root: {
display: 'flex',
flexWrap: 'wrap',
'& > *': {
width: 200,
margin: theme.spacing(1),
},
},
}));

export default function ColorTextField() {
const classes = useStyles();

return (
<form className={classes.root} noValidate autoComplete="off">
<TextField id="standard-secondary" label="Standard secondary" color="secondary" />
<TextField
id="filled-secondary"
label="Filled secondary"
variant="filled"
color="secondary"
/>
<TextField
id="outlined-secondary"
label="Outlined secondary"
variant="outlined"
color="secondary"
/>
</form>
);
}
38 changes: 38 additions & 0 deletions docs/src/pages/components/text-fields/ColorTextFields.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import React from 'react';
import { createStyles, makeStyles, Theme } from '@material-ui/core/styles';
import TextField from '@material-ui/core/TextField';

const useStyles = makeStyles((theme: Theme) =>
createStyles({
root: {
display: 'flex',
flexWrap: 'wrap',
'& > *': {
width: 200,
margin: theme.spacing(1),
},
},
}),
);

export default function ColorTextField() {
const classes = useStyles();

return (
<form className={classes.root} noValidate autoComplete="off">
<TextField id="standard-secondary" label="Standard secondary" color="secondary" />
<TextField
id="filled-secondary"
label="Filled secondary"
variant="filled"
color="secondary"
/>
<TextField
id="outlined-secondary"
label="Outlined secondary"
variant="outlined"
color="secondary"
/>
</form>
);
}
8 changes: 7 additions & 1 deletion docs/src/pages/components/text-fields/text-fields.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ The `select` prop makes the text field use the [Select](/components/selects/) co

## Icons

There are multiple ways to display an icon with a text field.
There are multiple ways to display an icon with a text field.

{{"demo": "pages/components/text-fields/InputWithIcon.js"}}

Expand Down Expand Up @@ -94,6 +94,12 @@ The component takes care of the most used properties, then it's up to the user t

{{"demo": "pages/components/text-fields/Inputs.js"}}

## Color

The `color` prop changes the highlight color of the text field when focused.

{{"demo": "pages/components/text-fields/ColorTextFields.js"}}

## Customized inputs

Here are some examples of customizing the component. You can learn more about this in the
Expand Down