npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@element-public/react-textfield

v1.1.5

Published

Textfield component for Element React

Downloads

477

Readme

Textfield

Description

Text fields let users enter and edit text into a UI.

See live demos on storybook

Storybook Textfield Demos

Install bundle from npm-e

npm i @element-public/react-components @element-public/themes

Optional: install the component individually

npm i @element-public/react-textfield @element-public/themes

Open ~/.npmrc in an editor and add the following line to enable the @element-public scope:


@element-public:registry=https://npm.platforms.engineering

Troubleshooting

See below if you have never installed a package from Bayer's npm-enterprise or run into the following error:


npm ERR! code E401
npm ERR! Unable to authenticate, your authentication token seems to be invalid.
npm ERR! To correct this please trying logging in again with:
npm ERR!     npm login

Setup an access token

See the devtools npm-e guide to learn how to create an access token if this is the first time you are using a npm-e package at Bayer or you do not have a line that starts with the following in your ~/.npmrc file:

//npm.platforms.engineering/:_authToken=

Notes

Textfield is an open text box that allows users to enter and/or edit text into a UI.

There are numerous Textfield props to enable customization of the component. Textfield has multiple different variants to choose from such as outlined, filled, and embedded - a special borderless textfield for inclusion in TopAppBar or TableTopBar.

Textfield Props

| Name | Type | Default | Required | Description | | -------------------- | ----------------------- | --------- | -------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | className | string | undefined | false | The css class name to be passed through to the component markup. | | containerProps | object | undefined | false | Properties to be added to the container of the textfield. | | counter | boolean | false | false | Enables a character count. Warning requires maxlength to be set. | | defaultValue | string | number | undefined | false | The starting value of the Textfield when working in uncontrolled mode. | | dense | boolean | false | false | The size of the Textfield will be reduced. | | disabled | boolean | false | false | Textfield will be disabled. | | focused | boolean | false | false | Sets the Textfield to the focused state. | | fullWidth | boolean | false | false | The Textfield will expand to 100% width. | | helperTextId | string | undefined | false | Randomly generated id for the helper text container element. May be overwritten. | | helperTextPersistent | boolean | false | false | Set the helper text to be permanently visible. | | helperTextValidation | boolean | false | false | Set the helper text to use validation styles. Helper text changes with valid (e.g., helper text will appear red when valid is set to 'false'). | | id | string | undefined | false | Randomly generated id for the input element. May be overwritten. | | label | string | null | false | Floating input label. Note: full-width Textfields do not support floating labels - any label on a full-width Textfield will be automatically mapped to a placeholder. | | labelId | string | undefined | false | Randomly generated id for the label element. May be overwritten. | | leadingIcon | string|React.ReactNode | null | false | Adds the given Icon or Icon Button to the left of the Textfield. Expects the name of a valid Material.io icon, however in React an icon or icon button component may be passed in instead for more control, | | maxlength | number | null | false | Restricts the number of characters that can be entered, best used with counter. | | noResize | boolean | true | false | Prevents resizing when using textarea. | | placeholder | string | null | false | Non-floating label text, will be replaced when the user starts typing. | | prefixText | string | null | false | Text that will appear before the label or value of the Textfield. It will be shown on focus. An example use-case might be a currency symbol such as $. Warning: This cannot be used with leadingIcon or textarea. | | suffixText | string | null | false | Text that will appear after the label or value of the Textfield. It will be shown on focus. An example use-case might be .00 if handling currency. Warning: This cannot be used with trailingIcon or textarea. | | textarea | boolean | false | false | Enabled multi-line text input. Note textarea cannot be used with the embedded variant. | | tooltip | boolean|object | null | false | If defined, a Tooltip will appear on the Textfield. Useful to show the full value, if the value is too long for the Textfield width. The object should be the needed Tooltip properties. Tooltip text prop will be set to the current value of the Textfield. See Tooltip docs for available props. | | trailingIcon | string|React.ReactNode | null | false | Adds the given Icon or Icon Button to the right of the Textfield . Expects the name of a valid Material.io icon, however in React an icon icon button component may be passed in instead for more control. | | type | string | 'text' | false | Support for built-in input types. Browser support for some advanced types such as color or date may be limited or appear differently between browsers. Note the Datepicker component should be preferred over the built-in date/time types as it offers more consistency and features.Note Slider type is not support, please use the Element Slider component instead.Accepted Values: text, password, color, email, url, number, tel, search, datetime-local, month, time, week, date | | valid | boolean | true | false | Applies an invalid style to the Textfield. | | value | string | number | undefined | false | The current value of the Textfield component. | | variant | string | 'filled' | false | Applies the selected styling to the Textfield. Note textarea does not support the embedded variant.Accepted Values: filled, outlined, embedded |

Textfield Deprecated Props

| Name | Type | Default | Required | Deprecated | Description | | -------------- | ------- | --------- | -------- | --------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- | | block | boolean | undefined | false | Use fullWidth instead. | Applies a full-width style where the Textfield will fill its container. | | containerClass | string | undefined | false | See containerProps. | Add a custom class to the Textfield container. | | embedded | boolean | undefined | false | Use variant='embedded' | An unfilled, non-outlined and full-width variant of Textfield, intended to be embedded in other components such as TopAppBar or TableHeader. | | filled | boolean | undefined | false | Use variant='filled' instead. | Apply filled style to the Textfield. Previously called primary. | | maxLength | number | undefined | false | Use maxlengthinstead. The case of this prop has changed to be more consistent. | Restricts the number of characters that can be entered, best used with counter. | | outlined | boolean | undefined | false | Usevariant='outlined'instead | Apply outlined style to the Textfield. Previously called secondary. | | primary | boolean | undefined | false | This feature is no longer supported. Usevariant='filled'instead. | Enable filled styling. | | search | boolean | undefined | false | Usevariant='embedded' | Enabled search bar styling, including a full width style. | | secondary | boolean | undefined | false | Usevariant='outlined'` instead. | Apply secondary style to the Textfield. |

Textfield Render Props

| Name | Type | Default | Required | Description | | --------------- | --------------- | ------- | -------- | ------------------------------------------------------------------------------ | | helperText | React.ReactNode | null | false | Helper text to be displayed below Textfield, by default only visible on focus. | | leadingContent | React.ReactNode | null | false | Custom content to appear before the input. | | trailingContent | React.ReactNode | null | false | Custom content to appear after the input. |

Textfield Events

| Name | Default | Required | Params | Description | | -------- | ------- | -------- | ------ | -------------------------------------------------------- | | onBlur | null | false | | Fired when focus leaves the input. | | onChange | null | false | | Fired when each character is entered into the Textfield. | | onFocus | null | false | | Fired when the input gains focus. |

Textfield Breaking Changes

| Description | | ------------------------------------------------------------------------------------------------------------------------------------------- | | children (removed): Please use value prop instead. | | containerStyle (removed): See containerProps. | | defaultContent (removed): This feature never quite worked correctly and is no longer supported. | | errorChecking (removed): Use valid instead. | | fullWidth: The behavior of fullWidth has changed since the previous version. If you need that original behavior use variant='embedded'. |