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

rn-floating-input

v0.1.3

Published

A performant floating label TextInput for React Native with animated label, error shake, and full customization

Downloads

423

Readme

rn-floating-input

A performant floating label TextInput for React Native with animated label transitions, error shake animation, and full customization support.

Built with react-native-reanimated for smooth 60fps animations. No other dependency — uses plain StyleSheet.

Example

Installation

npm install rn-floating-input
# or
yarn add rn-floating-input

Peer Dependencies

npm install react-native-reanimated react-native-worklets

Make sure react-native-reanimated is properly configured in your project (babel plugin, etc).

Basic Usage

import { FloatingInput } from 'rn-floating-input'

function MyForm() {
  const [value, setValue] = useState('')

  return (
    <FloatingInput
      label="Email"
      value={value}
      onChangeText={setValue}
    />
  )
}

With Validation

<FloatingInput
  label="Email"
  value={values.email}
  onChangeText={handleChange('email')}
  onBlur={handleBlur('email')}
  error={errors.email}
  touched={touched.email}
  keyboardType="email-address"
  autoCapitalize="none"
/>

When touched and error are both truthy, the error message renders below the input and a shake animation plays.

With Right Element

<FloatingInput
  label="Password"
  value={password}
  onChangeText={setPassword}
  secureTextEntry={!showPassword}
  right={
    <Pressable onPress={() => setShowPassword(!showPassword)}>
      <Icon name={showPassword ? 'eye-off' : 'eye'} />
    </Pressable>
  }
/>

Pressable Mode

When onPress is provided, the input becomes a pressable area (useful for date pickers, dropdowns, etc):

<FloatingInput
  label="Date of Birth"
  value={selectedDate}
  onPress={() => openDatePicker()}
/>

Ref Methods

const inputRef = useRef<FloatingInputRef>(null)

<FloatingInput ref={inputRef} label="Name" value={name} onChangeText={setName} />

// Later:
inputRef.current?.focus()
inputRef.current?.blur()
inputRef.current?.clear()
inputRef.current?.isFocused()

Customization

Theme Prop

Override default colors and sizes:

<FloatingInput
  label="Name"
  value={name}
  onChangeText={setName}
  theme={{
    backgroundColor: '#F0F0F0',
    selectionColor: '#007AFF',
    borderRadius: 8,
    fontSize: 14,
    fontFamily: 'Inter-Regular',
  }}
/>

| Token | Default | Description | | --------------------- | --------- | ---------------------------------- | | backgroundColor | #EDEFF2 | Input container background | | labelColor | #878A99 | Inactive label color | | inputColor | #36373D | Text input color | | errorColor | #E3152E | Error label & message color | | selectionColor | #31BE30 | Cursor and selection color | | placeholderColor | #878A99 | Placeholder text color | | borderRadius | 14 | Container border radius | | fontSize | 16 | Input and inactive label font size | | labelActiveFontSize | 12 | Active (raised) label font size | | fontFamily | System | Font family for all text |

Styles Prop

Granular style overrides per element:

<FloatingInput
  label="Name"
  value={name}
  onChangeText={setName}
  styles={{
    inputContainer: { borderWidth: 1, borderColor: '#DDD' },
    label: { fontWeight: '600' },
    input: { letterSpacing: 0.5 },
    error: { marginLeft: 16 },
    right: { right: 16 },
  }}
/>

Animation Config

<FloatingInput
  label="Name"
  value={name}
  onChangeText={setName}
  animationConfig={{
    labelDuration: 200,     // Label transition duration (ms)
    shakeMagnitude: 2,      // Error shake distance (px)
    shakeDuration: 50,      // Each shake step duration (ms)
  }}
/>

Custom Input Renderer

Replace the default TextInput entirely:

<FloatingInput
  label="Custom"
  value={value}
  onChangeText={setValue}
  renderInput={(props) => <MyCustomInput {...props} />}
/>

TextInput Pass-through

Pass any additional TextInput props via textInputProps:

<FloatingInput
  label="Bio"
  value={bio}
  onChangeText={setBio}
  textInputProps={{
    numberOfLines: 4,
    textAlignVertical: 'top',
  }}
/>

Props

| Prop | Type | Default | Description | | ----------------- | ------------------------------ | ----------- | ---------------------------------------- | | value | string | — | Input value | | onChangeText | (text: string) => void | — | Change handler | | onBlur | () => void | — | Blur handler | | onFocus | () => void | — | Focus handler | | onPress | () => void | — | Makes input pressable (disables editing) | | label | string | — | Floating label text | | placeholder | string | — | Shown when label is active | | error | string | — | Error message | | touched | boolean | — | Whether field has been touched | | maxLength | number | — | Max input length | | keyboardType | KeyboardTypeOptions | 'default' | Keyboard type | | autoFocus | boolean | false | Auto focus on mount | | editable | boolean | true | Whether input is editable | | autoCapitalize | string | — | Auto-capitalization behavior | | secureTextEntry | boolean | false | Password mode | | right | ReactNode | — | Right slot element | | renderInput | (props) => ReactNode | — | Custom input renderer | | theme | FloatingInputTheme | — | Theme overrides | | styles | FloatingInputStyles | — | Per-element style overrides | | style | StyleProp<ViewStyle> | — | Input container style shorthand | | animationConfig | FloatingInputAnimationConfig | — | Animation overrides | | textInputProps | TextInputProps | — | Pass-through to underlying TextInput |

Exports

// Component
import { FloatingInput } from 'rn-floating-input'

// Types
import type {
  FloatingInputProps,
  FloatingInputRef,
  FloatingInputTheme,
  FloatingInputStyles,
  FloatingInputAnimationConfig,
} from 'rn-floating-input'

License

MIT