Components · Form & Input
Password Input
StableAdded v0.0.1
A password field with a built-in toggle to reveal or hide the entered value.
import { PasswordInput } from '@nexub/react';Playground
Props
<PasswordInput placeholder="Enter password…" />Examples
Default
Invalid
States
defaultdisabledinvalidloadingsize="sm"size="md"size="lg"
Props
| Prop | Type | Default | Description |
|---|---|---|---|
| placeholder | string | — | Placeholder text shown when the field is empty. |
| invalid | boolean | — | Applies error styling to indicate a validation failure. |
| disabled | boolean | — | Disables the input. |
| size | 'sm' | 'md' | 'lg' | — | Controls font size and padding. |
| visible | boolean | — | Shows the password as text. Controlled when set; pair with onVisibleChange. |
| defaultVisible | boolean | false | Initial visibility when uncontrolled. Defaults to false. |
| onVisibleChange | ((visible: boolean) => void) | — | Called when the reveal toggle is pressed. |
| clearable | boolean | — | Shows a clear button while there is a value. Clearing fires onChange with "". |
| leadingAddon | string | — | |
| leadingIcon | React.ReactNode | — | |
| loading | boolean | — | Spinner in the trailing slot and aria-busy on the input. |
| showCount | boolean | — | Shows a "12/80" counter; needs maxLength. Announced politely near the limit. |
| trailingAddon | string | — | |
| wrapperClassName | string | — |
On iOS & Android: PasswordInput
@nexub/react-nativeAlpha
import { PasswordInput } from '@nexub/react-native';
<PasswordInput label="Password" />Web vs mobile
Same tokens and prop names. Where the platforms differ:
| Web | iOS & Android | |
|---|---|---|
| Autofill | autocomplete="current-password". | Sets the platform password autofill hints (iOS Keychain, Android Autofill). |
Interactive preview of @nexub/react-native rendered for the web. Native chrome (switches, pickers, Liquid Glass) looks like the platform on a device.
On device

iPhone (iOS simulator)

Pixel (Android emulator)
Screenshots from the latest CI run of the showcase app; the live frame renders the same code for the web.
PasswordInput props
| Prop | Type | Default | Description |
|---|---|---|---|
| visible | boolean | — | Shows the password as plain text. Controlled: pair it with onVisibleChange. |
| defaultVisible | boolean | false | Whether the password starts out shown, when visible isn't set. |
| onVisibleChange | (visible: boolean) => void | — | Called with the new state when the show/hide toggle is pressed. |
| ref | React.Ref<React.ComponentRef<typeof TextInput>> | — | — |
| labelrequired | string | — | Visible label above the field (also its accessible name). |
| helperText | string | — | Hint under the field. Replaced by error when set. |
| error | string | — | Error message: red outline, announced, replaces the helper text. |
| required | boolean | — | Shows a required marker after the label, like web FormField. Checking the value is up to you. |
| disabled | boolean | — | — |
| size | Extract<ControlSize, 'sm' | 'md' | 'lg' | 'xl'> | 'lg' | Field height, the same names as web Input's size: sm and md are the compact desktop
heights, lg the mobile field height (48), xl the large touch height. |
| invalid | boolean | — | Red outline and announced as invalid, with or without an error message. |
| readOnly | boolean | — | Shows the value but it can't be changed. The field can still be focused and its text selected and copied; it sits on a quieter surface so it doesn't look editable. |
| leadingIcon | React.ReactNode | — | An icon (or any small node) at the start, inside the field. |
| trailingIcon | React.ReactNode | — | An icon (or any small node) at the end, inside the field, after the clear button. |
| leadingAddon | React.ReactNode | — | Text or a node in its own segment before the field, e.g. "https://". |
| trailingAddon | React.ReactNode | — | Text or a node in its own segment after the field, e.g. ".com" or "kg". |
| leading | React.ReactNode | — | The older name for leadingIcon: a node at the start, inside the field. |
| clearable | boolean | — | Shows a clear button while there is a value. Clearing fires onChangeText with "". |
| onClear | () => void | — | Called when the clear button empties the field, after onChangeText(""). |
| showCount | boolean | — | Shows a "12/80" counter; needs maxLength. Announced politely near the limit. |
| loading | boolean | — | Spinner in the trailing slot and busy for screen readers. |
| streaming | boolean | — | 12.5: an agent is filling this field. Busy for screen readers, with a calm shimmer on the field (none under Reduce Motion); it stays editable. Pass the value as it arrives. |
| generated | boolean | — | 12.5: the value came from an agent. Shows a "Suggested" mark beside the label, read as part of the field's hint. Typing in the field clears the mark; so do accept and clear. |
| onAcceptSuggestion | () => void | — | 12.5: with generated, shows an accept button beside the mark. |
| onClearSuggestion | () => void | — | 12.5: with generated, shows a clear button beside the mark. Clear the value here. |
| style | StyleProp<ViewStyle> | — | — |