Kinetik UI

Float Field

.md

A text field whose label rises to the top edge on focus, with a ring that fades in and a shake for errors.

v1.0.0Live on webreact-native-reanimatedreact-native-worklets
Component preview

Installation

Kinetik CLI
npx kinetik-ui add float-field

The CLI copies the source and installs native dependencies with npx expo install, so versions match your Expo SDK. With shadcn: npx shadcn@latest add https://kinetik-ui.dev/r/float-field.json

Install manually

  1. Install dependencies
    npx expo install react-native-reanimated react-native-worklets
  2. Copy the source files
    • components/kinetik/float-field.tsx
    View source files

Usage

import { FloatField } from '@/components/kinetik/float-field';

<FloatField
  label="Email"
  hint="We only use it for receipts."
  error={invalid ? 'That does not look like an email address.' : undefined}
  value={email}
  onChangeText={setEmail}
  keyboardType="email-address"
  autoCapitalize="none"
/>;

When to use

  • Forms where space is tight and every field needs a visible name: sign up, checkout, profile.
  • Fields that validate on blur and need to say what is wrong right under the input.

When not to use

  • Long text. Use Grow Area, which grows with what is typed.
  • Search. A search field reads better with an icon and no floating label.

Notes

  • Every other TextInput prop (keyboard type, auto-complete, secure entry, return key) is passed through.
  • The label is the field's accessible name and the hint or error is its hint; a new error is also announced.
  • With reduced motion the label still moves, without a spring, and the field does not shake.

Props

FloatFieldProps

PropTypeDefaultDescription
labelrequiredstring—Sits inside the empty field and floats up to the top edge once it has focus or text.
valuerequiredstring—
onChangeTextrequired(text: string) => void—
errorstring—Shown in red under the field; the field shakes once each time a new error appears.
hintstring—Helper text under the field, replaced by the error while there is one.
styleStyleProp<ViewStyle>—

Performance and accessibility

Performance

Budget
A native text input with three shared values: label, ring and shake. Nothing runs at rest.
Measured

Pixel 9 emulator, API 35, release build · interaction median 1.06× the system Settings app on the same emulator (indicative only) · no frames drawn at rest · 135 MB app memory. The run types into both fields; the janky frames are the keyboard opening and closing, not the field.

Real-device measurement pending.

Accessibility

Reduced motion
The label moves without a spring and the field does not shake.
Screen readers
A text field named by its label, with the hint or error as its hint; a new error is announced.
Touch target
The whole field is the target, 56 pt tall.

Source files

components/kinetik/float-field.tsx is in the Code tab of the preview above.