Kinetic Input

A text field with a floating label, helper or error text, optional prefix and suffix, a clear button and a password toggle.

  • <kt-kinetic-input>
  • Inputs
  • No framework

Kinetic Input

The code

Copy the Kinetic Input

Fastest: press Copy on the card above for one complete file. To build it into your own project, use the files below: the markup, the styles, this component’s script and the shared effects script (effects.js) that every component uses.

<kt-kinetic-input label="Work email" type="email" placeholder="name@company.com" helper="We only use this to send your receipt." clearable></kt-kinetic-input>

<kt-kinetic-input label="Password" type="password" value="hunter2-horse" helper="Use at least 12 characters."></kt-kinetic-input>

<kt-kinetic-input label="Budget" prefix="$" suffix="USD" value="2400" clearable></kt-kinetic-input>

<kt-kinetic-input label="Workspace URL" value="acme corp" error="Use lowercase letters, numbers and dashes only."></kt-kinetic-input>

Attributes

NameWhat it doesDefault
labelFloating label that moves up once the field has focus or text.—
valueCurrent text. Kept in sync as the visitor types.—
type"text", "email" or "password" (adds a show/hide toggle).text
placeholderHint shown while the field is focused and empty.—
helperSmall text under the field.—
errorError message. When present the field turns red, shows this text and is marked invalid.—
prefixShort text before the value, such as a currency symbol.—
suffixShort text after the value, such as a unit.—
clearableShows a clear button while the field has text.—
disabledPresent when the field cannot be used.—
nameName of the inner input, so a surrounding form can read it.—
autocompletePassed to the inner input (for example "email").—
sfxSound-effect text on clear.スッ!

Keyboard and screen readers

  • A real input with a label tied to it by for/id; the floating label is still the accessible name.
  • Helper and error text is linked with aria-describedby; an error sets aria-invalid and is announced politely.
  • The password toggle is a button with aria-pressed and a "Show password"/"Hide password" name.
  • The clear button is skipped by Tab so it never interrupts typing; it is still clickable and keeps focus in the field.
  • Fires input and change events with the text in detail.value.

Styling variables

Every look is a CSS variable: --kt-accent, --kt-accent-ink, --kt-radius-btn, --kt-surface-radius, --kt-surface-bg, --kt-border-w, --kt-comp-shadow and --font-sans. The copied file sets them all from your choices.

FAQ

Kinetic Input: questions answered

How do I use the Kinetic Input?

Press Copy on the card to get a complete HTML file, or copy the HTML, CSS and JavaScript tabs into your own page. In your markup the element is written as <kt-kinetic-input>.

Which attributes does <kt-kinetic-input> accept?

label, value, type, placeholder, helper, error, prefix, suffix, clearable, disabled, name, autocomplete, sfx. Each one is described in the attributes table on this page.

Is the Kinetic Input accessible?

A real input with a label tied to it by for/id; the floating label is still the accessible name. Helper and error text is linked with aria-describedby; an error sets aria-invalid and is announced politely. The password toggle is a button with aria-pressed and a "Show password"/"Hide password" name. The clear button is skipped by Tab so it never interrupts typing; it is still clickable and keeps focus in the field. Fires input and change events with the text in detail.value.

Can I change the Kinetic Input colors, corners and font?

Yes. Use the options on this page: accent color, border radius, background, border, shadow and Google font. The copied code already contains your choices, and every one of them is a CSS variable you can edit later.