summaryrefslogtreecommitdiff
path: root/preact/demo/textFields.js
blob: 58f69f175b4f83252bfc28b738d987d9ceac3fcc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import React, { useState } from 'react';
import TextField from '@material-ui/core/TextField';

/** @jsx React.createElement */

const PatchedTextField = props => {
	const [value, set] = useState(props.value);
	return (
		<TextField {...props} value={value} onChange={e => set(e.target.value)} />
	);
};

const TextFields = () => (
	<div>
		<TextField
			variant="outlined"
			margin="normal"
			fullWidth
			label="Cannot type in"
		/>
		<PatchedTextField
			variant="outlined"
			margin="normal"
			fullWidth
			label="I can"
		/>
		<TextField
			defaultValue="Reset after blur or empty"
			variant="outlined"
			margin="normal"
			fullWidth
			label="default value"
		/>
	</div>
);

export default TextFields;