README
@sequenia/react-material-fields
React custom component with Material-UI design
Demo
https://sequenia.github.io/react-material-fields/
Requirements
React v16.0.0 and above, @material-ui/core v4.9.0 and above
Install
npm install --save @sequenia/react-material-fields
Usage
List of common properties for all fields:
name | type | default | description |
---|---|---|---|
className | string | your custom css (or jss) className | |
disableAutoComplete | boolean | false | disbaling/enabling standart autocomplete |
displayName | string | title of this field | |
displayNamePosition | string | "inside" | position of title: "inside" by default prop and "above" |
hasError | boolean | false | error highlight |
onChange | function | onChange event callback function | |
readOnly | boolean | false | field disabling |
variant | string | "outlined" | variants of styling: "outlined", "filled" and "standard" |
value | field's value (string, number, array or object) | ||
aboveLabelClassName | string | if displayNamePosition = "above" , this is label className prop |
TextField
It's a simple text, email, or number input field.
name | type | default | description |
---|---|---|---|
type | string | "text" | type of input: "text", "number" or "email" |
capitalization | string | "none" | text capitalization for field: "uppercase", "lowercase", "capitalize", "none" by default prop |
multiline | boolean | false | convert field to textarea |
rows | number | 5 | number of rows if multiline is true |
import React, { Component } from 'react'
import { TextField } from '@sequenia/react-material-fields'
class Example extends Component {
render() {
return <TextField displayName = { "Text field" }
disableAutoComplete = { true }
type = { "email" } />
}
}
PhoneField
Text field with number mask
name | type | is required | description |
---|---|---|---|
mask | array | yes | number mask array |
import React, { Component } from 'react'
import { PhoneField } from '@sequenia/react-material-fields'
class Example extends Component {
render() {
return <PhoneField displayName = { "Phone field" }
mask = { ['(', /[1-9]/, /\d/, /\d/, ')', ' ', /\d/, /\d/, /\d/, '-', /\d/, /\d/, /\d/, /\d/] } />
}
}
PasswordField
Password field with toggle password visibility.
name | type | default | description |
---|---|---|---|
disableShowPassword | boolean | false | disables visibility toggling |
iconClassName | string | className props for iconButton |
import React, { Component } from 'react'
import { PasswordField } from '@sequenia/react-material-fields'
class Example extends Component {
render() {
return <PasswordField displayName = { "Password field" }/>
}
}
DecimalField
Number field with special formatting. It has two number options: precision (length of number) and scale (length after point). Also you can set decimal separator, thousand separator and prefix/suffix string.
name | type | default | description |
---|---|---|---|
prefix | string | string prefix | |
suffix | string | string suffix | |
precision | number | 10 | length of number before point |
scale | number | 2 | length after point |
decimalSeparator | string | "," | separator symbol |
thousandSeparator | string | "." | separator symbol |
import React, { Component } from 'react'
import { DecimalField } from '@sequenia/react-material-fields'
class Example extends Component {
render() {
return <DecimalField displayName = { "Decimal field" }
suffix = { "