Skip to content
Storybook

Input

Single-line text field with label, optional required marker, hint and error message.

Preview

React · live from the Storybook

HTML and CSS

The same component as plain HTML with pixels-ui.css, no framework needed.

We’ll never share your email.

Usage

  • Always show a visible label; placeholders are examples, not labels.
  • Put the hint under the field and replace it with the error when invalid.

Installation

Included in the core files. No extra install.

HTML
<link rel="stylesheet" href="/css/pixels-tokens.css">
<link rel="stylesheet" href="/css/pixels-ui.css">
<script src="/js/pixels-ui.js" defer></script>

Examples

Sizes

Height comes from --px-input-height-sm/md/lg.

Error

Add px-field--error, aria-invalid and point aria-describedby at the message.

Enter your full name.

Leading text and trailing icon

Add-ons for units, protocols or currency.

https://

Disabled

API reference

Class / attributeTypeDescription
px-fieldclassWraps label, input and hint. Max width --px-input-width.
px-field--errorclassError state (Figma State = Error).
px-inputclassField box. Put the <input> and icons inside.
px-input--sm · --lgclassSize.
px-label · px-label__reqclassLabel and required marker.
px-hint · px-hint--errorclassHint and error message.
px-input__addonclassLeading text add-on.

Figma properties

Input36 variants · page “Input Fields”Open

Single-line text field with label, optional required marker, hint and error message. Field height comes from --px-input-height-*; RTL variants mirror icon positions and use the Arabic locale mode. RTL…

PropertyTypeValues
LabelText“Full name”
HintText“This is the name on your account.”
Show labelBoolean—
Show hintBoolean—
RequiredBoolean—
Leading iconBoolean—
Leading icon swapInstance swap—
Trailing iconBoolean—
Error messageText“Enter your full name.”
SizeVariantSmall Medium Large
StateVariantActive Hover Focused Filled Disabled Error
DirectionVariantLTR RTL

Design tokens

Component tokens from the Figma Component collection. Override them to restyle just this component.

TokenAliasLight value
--px-input-content-placeholdercolor-content-neutral-placeholder#667085
--px-input-content-labelcolor-content-neutral-secondary#475467
--px-input-content-hintcolor-content-neutral-tertiary#667085
--px-input-content-errorcolor-content-danger-default#b42318
--px-input-radiusradius-1212px
--px-input-height-mdspacing-4040px
--px-input-padding-xspacing-1212px
--px-input-height-smspacing-3636px
--px-input-height-lgcontrol-height-lg48px
--px-input-gapspacing-88px
--px-input-field-gapspacing-88px
--px-input-width320px320px
--px-input-focus-halo#2563eb2e#2563eb2e

Accessibility

  • Connect label with for/id.
  • Link hint/error with aria-describedby; set aria-invalid on error.
  • Required: use the required attribute; the * is aria-hidden.