Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@rmwc/textfield

Package Overview
Dependencies
Maintainers
1
Versions
173
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@rmwc/textfield

RMWC TextField component

  • 14.0.3
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
3.1K
decreased by-29.53%
Maintainers
1
Weekly downloads
 
Created
Source

Text Fields

Text fields allow users to input, edit, and select text.

  • Module @rmwc/textfield
  • Import styles:
    • Using CSS Loader
      • import '@rmwc/textfield/styles';
    • Or include stylesheets
      • '@material/textfield/dist/mdc.textfield.css';
      • '@material/floating-label/dist/mdc.floating-label.css';
      • '@material/notched-outline/dist/mdc.notched-outline.css';
      • '@material/line-ripple/dist/mdc.line-ripple.css';
      • '@material/ripple/dist/mdc.ripple.css';
      • '@rmwc/icon/icon.css';
  • MDC Docs: https://material.io/develop/web/components/input-controls/text-field/

TextField Variants

Standard


<TextField label\="standard..." />


Outlined


<TextField outlined label\="outlined..." />


No Label


<TextField placeholder\="No label" />


Icons


<\>

  {/\* Leading and trailing icons can be used.\*/}

  <TextField icon\="search" trailingIcon\="close" label\="icon..." />

  {/\* If you need full control over the icon, you can pass the icon as options with your own props. Dont forget the TabIndex to make it clickable\*/}

  <TextField

    label\="trailingIcon..."

    trailingIcon\={{

      icon: 'close',

      tabIndex: 0,

      onClick: () \=> console.log('Clear')

    }}

  />

</\>


Fullwidth


<TextField fullwidth label\="fullwidth..." />


Textareas

You can make the TextField a textarea. Make sure to include outlined for proper styling You can optionally make help text always visible by passing an object as props with persistent set to true. Textareas can also have an optional character counter which will work with the maxLength property.


<div\>

  <TextField

    textarea

    label\="textarea..."

    rows\={8}

    maxLength\={20}

    characterCount

    resizeable

    helpText\={{

      persistent: true,

      validationMsg: true,

      children: 'The field is required'

    }}

  />

</div\>


Validation

Disabled


<TextField disabled label\="Disabled..." />


Required


<TextField required label\="Required..." value\="" />


Invalid


<TextField

  invalid

  label\="Invalid..."

  value\="#@!$"

  onChange\={() \=> {}}

/>


Validation Pattern


<TextField label\="Validate Pattern" pattern\="\[A-Za-z\]{3}" />


HTML Input Types

A preview of how material-components-web handles styling input types for your browser.


<\>

  <TextField label\="text" type\="text" />

  <TextField label\="color" type\="color" style\={{ width: '6rem' }} />

  <TextField label\="date" type\="date" />

  <TextField label\="datetime-local" type\="datetime-local" />

  <TextField label\="month" type\="month" />

  <TextField label\="range" type\="range" />

  <TextField label\="time" type\="time" />

  <TextField label\="week" type\="week" />

</\>


TextField

Keywords

FAQs

Package last updated on 30 Nov 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc