{"id":13404124,"url":"https://github.com/n4kz/react-native-material-textfield","last_synced_at":"2025-05-14T15:07:16.597Z","repository":{"id":18646378,"uuid":"84718754","full_name":"n4kz/react-native-material-textfield","owner":"n4kz","description":"Material textfield","archived":false,"fork":false,"pushed_at":"2023-01-19T09:20:56.000Z","size":985,"stargazers_count":903,"open_issues_count":120,"forks_count":837,"subscribers_count":15,"default_branch":"master","last_synced_at":"2025-05-11T16:43:17.037Z","etag":null,"topics":["android","ios","material","material-design","react","react-native"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/n4kz.png","metadata":{"files":{"readme":"readme.md","changelog":"changelog.md","contributing":null,"funding":null,"license":"license.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-03-12T10:57:40.000Z","updated_at":"2025-03-02T14:54:45.000Z","dependencies_parsed_at":"2023-02-10T21:50:14.969Z","dependency_job_id":null,"html_url":"https://github.com/n4kz/react-native-material-textfield","commit_stats":null,"previous_names":[],"tags_count":44,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/n4kz%2Freact-native-material-textfield","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/n4kz%2Freact-native-material-textfield/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/n4kz%2Freact-native-material-textfield/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/n4kz%2Freact-native-material-textfield/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/n4kz","download_url":"https://codeload.github.com/n4kz/react-native-material-textfield/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254169574,"owners_count":22026213,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["android","ios","material","material-design","react","react-native"],"created_at":"2024-07-30T19:01:39.406Z","updated_at":"2025-05-14T15:07:16.561Z","avatar_url":"https://github.com/n4kz.png","language":"JavaScript","funding_links":[],"categories":["JavaScript","React Native","React, React Native"],"sub_categories":["Components React Native","Components"],"readme":"[npm-badge]: https://img.shields.io/npm/v/react-native-material-textfield.svg?colorB=ff6d00\n[npm-url]: https://npmjs.com/package/react-native-material-textfield\n[license-badge]: https://img.shields.io/npm/l/react-native-material-textfield.svg?colorB=448aff\n[license-url]: https://raw.githubusercontent.com/n4kz/react-native-material-textfield/master/license.txt\n[travis-badge]: https://api.travis-ci.org/n4kz/react-native-material-textfield.svg?branch=master\n[travis-url]: https://travis-ci.org/n4kz/react-native-material-textfield?branch=master\n[codeclimate-badge]: https://img.shields.io/codeclimate/maintainability/n4kz/react-native-material-textfield.svg\n[codeclimate-url]: https://codeclimate.com/github/n4kz/react-native-material-textfield\n[example-url]: https://cloud.githubusercontent.com/assets/2055622/24325711/eaa4ff08-11af-11e7-8550-2504c1580979.gif\n[rn-textinput]: https://facebook.github.io/react-native/docs/textinput.html#props\n[md-textfield]: https://material.io/guidelines/components/text-fields.html\n\n# react-native-material-textfield\n\n[![npm][npm-badge]][npm-url]\n[![license][license-badge]][license-url]\n[![travis][travis-badge]][travis-url]\n[![codeclimate][codeclimate-badge]][codeclimate-url]\n\nMaterial texfield with consistent behaviour on iOS and Android\n\n![example][example-url]\n\n## Features\n\n* Material design [guidelines][md-textfield] compliance\n* Consistent look and feel on iOS and Android\n* Animated state transitions (normal, focused and errored)\n* Customizable font size, colors and animation duration\n* Disabled state (with dotted underline)\n* Outlined and filled fields\n* Masked input support\n* Multiline text input\n* Character counter\n* Prefix and suffix\n* Accessory views\n* Helper text\n* RTL support\n* Pure javascript implementation\n\n## Installation\n\n```bash\nnpm install --save react-native-material-textfield\n```\n\n## Usage\n\n```javascript\nimport React, { Component } from 'react';\nimport {\n  TextField,\n  FilledTextField,\n  OutlinedTextField,\n} from 'react-native-material-textfield';\n\nclass Example extends Component {\n  fieldRef = React.createRef();\n\n  onSubmit = () =\u003e {\n    let { current: field } = this.fieldRef;\n\n    console.log(field.value());\n  };\n\n  formatText = (text) =\u003e {\n    return text.replace(/[^+\\d]/g, '');\n  };\n\n  render() {\n    return (\n      \u003cOutlinedTextField\n        label='Phone number'\n        keyboardType='phone-pad'\n        formatText={this.formatText}\n        onSubmitEditing={this.onSubmit}\n        ref={this.fieldRef}\n      /\u003e\n    );\n  }\n}\n```\n\n## Properties\n\n name                  | description                                 | type     | default\n:--------------------- |:------------------------------------------- | --------:|:------------------\n textColor             | Text input color                            |   String | rgba(0, 0, 0, .87)\n fontSize              | Text input font size                        |   Number | 16\n labelFontSize         | Text field label font size                  |   Number | 12\n lineWidth             | Text field underline width                  |   Number | 0.5\n activeLineWidth       | Text field active underline width           |   Number | 2\n disabledLineWidth     | Text field disabled underline width         |   Number | 1\n tintColor             | Text field accent color                     |   String | rgb(0, 145, 234)\n baseColor             | Text field base color                       |   String | rgba(0, 0, 0, .38)\n label                 | Text field label text                       |   String | -\n title                 | Text field helper text                      |   String | -\n prefix                | Text field prefix text                      |   String | -\n suffix                | Text field suffix text                      |   String | -\n error                 | Text field error text                       |   String | -\n errorColor            | Text field color for errored state          |   String | rgb(213, 0, 0)\n lineType              | Text field line type                        |   String | solid\n disabledLineType      | Text field line type in disabled state      |   String | dotted\n animationDuration     | Text field animation duration in ms         |   Number | 225\n characterRestriction  | Text field soft limit for character counter |   Number | -\n disabled              | Text field availability                     |  Boolean | false\n editable              | Text field text can be edited               |  Boolean | true\n multiline             | Text filed multiline input                  |  Boolean | false\n contentInset          | Layout configuration object                 |   Object | [{...}](#content-inset)\n labelOffset           | Label position adjustment                   |   Object | [{...}](#label-offset)\n inputContainerStyle   | Style for input container view              |   Object | -\n containerStyle        | Style for container view                    |   Object | -\n labelTextStyle        | Style for label inner Text component        |   Object | -\n titleTextStyle        | Style for title inner Text component        |   Object | -\n affixTextStyle        | Style for affix inner Text component        |   Object | -\n formatText            | Input mask callback                         | Function | -\n renderLeftAccessory   | Render left input accessory view            | Function | -\n renderRightAccessory  | Render right input accessory view           | Function | -\n onChangeText          | Change text callback                        | Function | -\n onFocus               | Focus callback                              | Function | -\n onBlur                | Blur callback                               | Function | -\n\nOther [TextInput][rn-textinput] properties will also work.\n\n### Content Inset\n\n name  | description                       | Normal | Filled | Outlined\n:----- |:--------------------------------- | ------:| ------:| --------:\n top   | Inset on the top side             |     16 |      8 |        0\n left  | Inset on the left side            |      0 |     12 |       12\n right | Inset on the right side           |      0 |     12 |       12\n label | Space between label and TextInput |      4 |      4 |        4\n input | Space between line and TextInput  |      8 |      8 |       16\n\n### Label Offset\n\n name | description                          | Normal | Filled | Outlined\n:---- |:------------------------------------ | ------:| ------:| --------:\n x0   | Horizontal offset for inactive state |      0 |      0 |        0\n y0   | Vertical offset for inactive state   |      0 |    -10 |        0 \n x1   | Horizontal offset for active state   |      0 |      0 |        0\n y1   | Vertical offset for active state     |      0 |     -2 |      -10\n\n## Methods\n\n name                   | description                   | returns\n:---------------------- |:----------------------------- | -------:\n focus()                | Acquire focus                 |       -\n blur()                 | Release focus                 |       -\n clear()                | Clear text field              |       -\n value()                | Get current value             |  String\n isFocused()            | Get current focus state       | Boolean\n isErrored()            | Get current error state       | Boolean\n isRestricted()         | Get current restriction state | Boolean\n isDefaultVisible()     | Get default value visibility  | Boolean\n isPlaceholderVisible() | Get placeholder visibility    | Boolean\n setValue()             | Set current value             |       -\n\n## Example\n\n```bash\ngit clone https://github.com/n4kz/react-native-material-textfield\ncd react-native-material-textfield/example\nnpm install\nnpm run ios # or npm run android\n```\n\n## Copyright and License\n\nBSD License\n\nCopyright 2017-2019 Alexander Nazarov. All rights reserved.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fn4kz%2Freact-native-material-textfield","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fn4kz%2Freact-native-material-textfield","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fn4kz%2Freact-native-material-textfield/lists"}