PasswordInput
Captures a password. `strengthCheck` adds a strength hint, which guides the member without blocking them.
Health
Source
Design
Storybook
Playground
No Example
Accessibility
partially-compliant
Platform
Universal
Accessibility issues
the show/hide password button is not accessible with keyboard navigation
- Overview
- Props
- Figma
Usage
Input help text
Strength check
This input has a built-in strength check that can be enabled by passing strengthCheck prop. It doesn't enforce validation but provides a visual indicator of the strength of the password:
Localization
This input comes with built-in localization for the strength check and visibility indicator. To change the language, pass locale prop. The default is en.
Controlled
import { useState } from "react";
import { TextInput } from "murray";
function Demo() {
const [value, setValue] = useState("");
return <TextInput value={value} onChange={(newValue) => setValue(newValue)} />;
}
Error state
Invalid name
Disabled state
Condensed theme
For applications with condensed theme density, this component renders in a condensed style:
Usage in <Form>
On web, TextInput can be used in <Form> component and be controleld by Formik:
Playground
Loading...
tip
This component is universal, its usage is the same in
murray and murray/mobile.PasswordInput props
| Name | Type | Default Value | Description | Usage count |
|---|---|---|---|---|
| aria-describedby | string | Id of an element outside the input that also describes it, such as an error shared by several inputs | ||
| aria-label | string | Accessibility label, only necessary when not associated with a label | ||
| aria-required | boolean | Overrides `aria-required` set by `required`, to mark the input as mandatory without the asterisk | ||
| autoFocus | boolean | If true, focuses the input on componentDidMount.The default value is false. | ||
| cursor | Cursor | Enforce a cursor type | ||
| defaultValue | string | Uncontrolled default value. | ||
| disabled | boolean | Disable input | ||
| enterKeyHint | "search""done""go""next""send" | |||
| error | ReactNode | Contents of `InputError` component, if not set, error is not rendered. | ||
| focused | boolean | Show focus styles even when the input isn't focused, e.g. while a readonly input's picker is open | ||
| helpText | ReactNode | Contents of `InputHelp` component, if not set, description is not rendered. | ||
| id | string | |||
| label* | ReactNode | Contents of `InputLabel` component, if not set, label is not rendered. | ||
| locale | Locale | Language to use for strengh validation | ||
| max | stringnumber | |||
| maxLength | number | Maximum string length that the user can enter in UTF-16 code units | ||
| min | stringnumber | |||
| minLength | number | Maximum string length that the user can enter in UTF-16 code units | ||
| name | string | Html input name | ||
| onChange | ((value: string) => void) | Trigger when input value is changing | ||
| onPress | ((event: GestureResponderEvent) => void) | |||
| placeholder | string | |||
| readonly | boolean | Make input readonly | ||
| render | 1 possibilities((elements: { input: ReactNode; prefix?: ReactNode; suffix?: ReactNode; }, pseudoState: PseudoState) => ReactNode) | Fully control how input, prefix and suffix are rendererd | ||
| renderPlaceholder | (() => ReactNode) | To render a custom placeholder view when the field is empty | ||
| required | boolean | Adds required attribute to the input and a red asterisk on the right side of label, `false` by default Determines whether the input should have `aria-required` attribute | ||
| step | stringnumber | |||
| strengthCheck | boolean | Enables password strength feedback | ||
| title | string | Html input title | ||
| value | string | Control the input. |
Undocumented props
| Name | Type | Default Value | Description | Usage count |
|---|---|---|---|---|
| autoCapitalize | any | |||
| autoComplete | any | |||
| autoCorrect | any | |||
| clearButtonMode | any | |||
| onBlur | any | |||
| onSubmitEditing | any | |||
| ref | any | |||
| returnKeyType | any | |||
| testID | any | |||
| textContentType | any |