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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@dax-ui/text-field

v0.8.0

Published

dax-ui TextField: text input and textarea with a label above, icons, character counter, locked state and custom colors

Readme

@dax-ui/text-field

Single- or multi-line text input in the filled or outline style: label above it, icons inside, a hint with an ⓘ icon and a character counter under it, and error, disabled, locked and password states. Wraps MUI's TextField; medium height and full width by default.

Every color comes from the app's theme (createAppTheme({ colors })), so each app gets its own brand. Set an app's defaults (variant, size, radius, colors, helper icon) once with FieldProvider from @dax-ui/field.

Installation

pnpm add @dax-ui/text-field

MUI and Emotion are included; the app only needs React 18 or 19.

One-time setup per app (skip if the app already uses dax-ui): install @dax-ui/theme and wrap the app in its UIProvider.

pnpm add @dax-ui/theme

Usage

import { TextField } from '@dax-ui/text-field';

// Controlled
const [email, setEmail] = useState('');
<TextField label="Email" type="email" value={email} onChange={(e) => setEmail(e.target.value)} />

// Filled style (outline is the default)
<TextField label="Email" variant="filled" />

// Hint, and an error message that replaces it
<TextField label="Email" helperText="We'll send the invite here" error={isValid ? false : 'Enter a valid email address'} />

// Required
<TextField label="Company name" required />

// Password: comes with a show-password button
<TextField label="Password" type="password" />

// Icons inside, interactive content at the end
<TextField label="Search" startIcon={<SearchIcon />} endAdornment={<IconButton aria-label="Clear"><XIcon /></IconButton>} />

// Text area with a counter
<TextField label="Notes" multiline minRows={3} maxRows={8} showCount maxLength={2000} />

// Read-only with the disabled look, still submitted with the form
<TextField label="Site" locked defaultValue="ABC-01" />

// Uncontrolled, inside a form
<form onSubmit={handleSubmit}>
  <TextField label="Name" name="name" defaultValue="Ada" />
</form>

One look per app

import { FieldProvider } from '@dax-ui/field';

// Every TextField and Dropdown inside gets these defaults; a field's own props still win.
<FieldProvider variant="filled" size="small" radius={8} helperIcon={null}>
  <App />
</FieldProvider>

Colors come from the theme. To restyle fields only, pass colors to FieldProvider or to one field, e.g. colors={{ focusBorder: '#6d28d9', focusBackground: '#f5f3ff' }} (see FieldColors in @dax-ui/field).

Props

| Prop | Type | Default | Description | | --- | --- | --- | --- | | className | string | | Class name for the field's root element. | | colors | Partial<FieldColors> | | Overrides any of the field's colors, e.g. { label: '#6d28d9', focusBorder: '#6d28d9' }. Unset keys keep the defaults (DEFAULT_FIELD_COLORS, or DEFAULT_FIELD_COLORS_DARK in dark mode). | | defaultValue | unknown | | Initial value, for an uncontrolled field. | | disabled | boolean | false | Disables the field. | | endAdornment | ReactNode | | Interactive content inside the input, after the text, e.g. a clear <IconButton aria-label="Clear">. | | endIcon | ReactNode | | Decorative icon inside the input, after the text, e.g. <CalendarIcon /> or <ClockIcon />. Hidden from screen readers. | | error | ReactNode | false | Error state: true turns the field red and marks the control aria-invalid; a message (string or node) does that and shows the message in place of helperText. | | fieldSlotProps | FormFieldSlotProps | | Style overrides for the label row, label, helper text and counter. Ignored with labelPlacement="floating". | | fullWidth | boolean | true | Stretches the field to the full width of its container. | | helperIcon | ReactNode | an info icon (ⓘ) | Icon before the helper or error text. Pass null to show the text without one. | | helperText | ReactNode | | Text under the control: a hint normally. Replaced by the error message when error is a message. | | hideLabel | boolean | false | Hides the label visually; it stays the input's accessible name. Ignored with labelPlacement="floating". | | id | string | | Id of the control, which the label points at. Generated when not set. | | label | ReactNode | | Label shown above the control. Also the control's accessible name, so always set it (use hideLabel to hide it visually). | | labelEnd | ReactNode | | Content at the far end of the label row, e.g. a "Forgot password?" link. Ignored with labelPlacement="floating". | | labelIcon | ReactNode | | Decorative icon before the label text, e.g. <CalendarIcon />. Sized to 16px. | | labelPlacement | "top" \| "start" \| "floating" | top | Where the label sits: top (above the input), start (beside it) or floating (MUI's label inside the border, the earlier default). | | labelWidth | string \| number | 160 | Width of the label column when labelPlacement is start. A number is px. | | locked | boolean | false | Read-only with the disabled look: grey background and text. Unlike disabled, the input stays focusable, readable by screen readers and is submitted with the form. For values fixed after creation, e.g. "Site". | | maxLength | number | | Maximum number of characters the input accepts. Shown in the counter with showCount. | | maxRows | string \| number | | Maximum number of rows of a multiline textarea before it scrolls. | | minRows | string \| number | | Minimum number of rows of a multiline textarea. | | multiline | boolean | false | Renders a growing <textarea> instead of an <input>. Use minRows / maxRows to bound it. | | name | string | | Name submitted with the form. | | onChange | ChangeEventHandler<HTMLInputElement \| HTMLTextAreaElement, Element> | | Called on every change; read the new value from event.target.value. | | optional | boolean | false | Adds "(optional)" after the label, for forms where most fields are required. | | optionalText | ReactNode | (optional) | Text shown after the label when optional is set. | | passwordToggle | boolean | true | With type="password", adds a button at the end of the input that shows or hides the password. | | passwordToggleIcons | PasswordToggleIcons | | Replaces the eye icons of the show-password button. | | passwordToggleLabel | string | Show password | Accessible name of the show-password button. It is a toggle (aria-pressed), so the name stays the same. | | placeholder | string | | Hint shown inside the empty input. Don't use it instead of label. | | radius | number | 12 | Corner radius of the input, in px. | | readOnly | boolean | false | Makes the input read-only while keeping its normal look. | | required | boolean | false | Marks the field as required: a red asterisk after the label, and aria-required on the control. | | requiredIndicator | ReactNode | * | What marks a required label. Hidden from screen readers. Ignored with labelPlacement="floating" (MUI shows *). | | showCount | boolean | false | Shows a character counter under the input on the right: "12/2000" with maxLength, "12" without. | | size | "small" \| "medium" \| "large" | medium | Input height: small (40px), medium (52px) or large (60px). With labelPlacement="floating" the default is small, and large is the same as medium (56px). | | startAdornment | ReactNode | | Interactive content inside the input, before the text, e.g. a currency <select>. | | startIcon | ReactNode | | Decorative icon inside the input, before the text, e.g. <SearchIcon />. Hidden from screen readers. | | style | CSSProperties | | Inline styles for the field's root element. | | sx | SxProps<Theme> | | Style overrides for the field's root element. | | type | HTMLInputTypeAttribute | text | HTML input type, e.g. email, password, number. password adds a show-password button (see passwordToggle). | | value | unknown | | Current value, for a controlled field. Use with onChange. | | variant | "filled" \| "outline" | outline | Input style: outline (surface background with a border) or filled (tinted background, no border until focused or in error). Set it for a whole app with <FieldProvider variant="filled">. |

Any other MUI TextField prop (autoComplete, inputRef, slotProps, ...) is passed through to MUI. sx, className and style go on the field's root element. ref is forwarded to the root element.