-
Notifications
You must be signed in to change notification settings - Fork 13
Expand file tree
/
Copy pathHiddenWidget.jsx
More file actions
33 lines (31 loc) · 877 Bytes
/
HiddenWidget.jsx
File metadata and controls
33 lines (31 loc) · 877 Bytes
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
import PropTypes from 'prop-types';
/**
* Displays an `<input type="hidden" />`.
*/
export const HiddenWidget = ({ id, title, value, isOnEdit }) => {
const inputId = `field-${id}`;
return (
<>
{isOnEdit ? <label htmlFor={inputId}>Hidden: {title || id}</label> : null}
<input type="hidden" id={inputId} name={id} value={value} />
</>
);
};
HiddenWidget.propTypes = {
id: PropTypes.string.isRequired,
title: PropTypes.string,
description: PropTypes.string,
required: PropTypes.bool,
error: PropTypes.arrayOf(PropTypes.string),
value: PropTypes.string,
focus: PropTypes.bool,
onChange: PropTypes.func,
onBlur: PropTypes.func,
onClick: PropTypes.func,
onEdit: PropTypes.func,
onDelete: PropTypes.func,
minLength: PropTypes.number,
maxLength: PropTypes.number,
wrapped: PropTypes.bool,
placeholder: PropTypes.string,
};